Skip to content

config: support scp-style --url

Fabian Pottbäcker git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3urlmatch: normalize ssh and ftp default portst/unit-tests/u-urlmatch-normalization.c urlmatch.c+21 -42 replies
2/3t1300: cover --url for some --get-urlmatch testst/t1300-config.sh+14 -00 replies
3/3config: use url_parse for --urlDocumentation/git-config.adoc builtin/config.c t/t1300-config.sh+50 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] config: support scp-style --url

Almost all git commands support the same set of URL formats, which includes the scp-style shortcut for ssh. This format is the default format of multiple large git services, presented to users when pressing a clone button. The config --url option was a notable exception. This is only relevant for scripting, it only affects the config get command.

This series consists of three commits: the first adds URL default port normalization to FTP and SSH, the second adds some git-config tests for --url which seemed missing (present for --get-urlmatch), and the third uses the recently added url_parse to support scp-style URLs in --url.

Uses in scripting of this change include smaller tools to automatically configure some settings based on some remote, like setting up author info based on a user git config value scoped to ssh://service.com, which is useful because git hosters often offer an email obfuscation/forwarding feature and this would enable easier management of identities with multiple accounts (like work and private).

This could of course be more useful with adjustments to fmt_ident to support this, with appropriate config options (what remote, copy values to repo config or use globals automatically, ...). Which would have been somewhat out of scope for this and requiring some more intricate changes I did not feel comfortable with yet.

Fabian Pottbäcker (3):
urlmatch: normalize ssh and ftp default ports
t1300: cover --url for some --get-urlmatch tests
config: use url_parse for --url

 Documentation/git-config.adoc           |  5 +++
 builtin/config.c                        |  2 +-
 t/t1300-config.sh                       | 58 +++++++++++++++++++++++++
 t/unit-tests/u-urlmatch-normalization.c |  9 ++++
 urlmatch.c                              | 16 +++++--
 5 files changed, 85 insertions(+), 5 deletions(-)

base-commit: 9a0c4701dcd5725c4184599322b52933ff5005ca

Signature · 1 line
2.50.1 (Apple Git-155)