{"thread":{"id":"4037","subject":"[PATCH] fetch, pull: ask config for remote information","startedAt":"2006-05-03T13:20:21Z","lastAt":"2006-05-03T13:20:21Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19427","messageId":"Pine.LNX.4.63.0605031519100.6949@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"4037","inReplyTo":null,"subject":"[PATCH] fetch, pull: ask config for remote information","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2006-05-03T13:20:21Z","receivedAt":"2006-05-03T13:20:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nNow you can say\n    \n    [remote.junio]\n        url = git://git.kernel.org/pub/scm/git/git.git\n        pull = next:next\n    \n    in your .git/config.\n    \nSigned-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tThis is 5a223a0d434c874984a0251eca4520ef95718a6d redone.\n\n\tThe conversion tool will follow in a few minutes, after\n\ta bit of testing.\n\n git-parse-remote.sh |   28 ++++++++++++++++++++++++----\n 1 files changed, 24 insertions(+), 4 deletions(-)\n\ndiff --git a/git-parse-remote.sh b/git-parse-remote.sh\nindex c9b899e..187f088 100755\n--- a/git-parse-remote.sh\n+++ b/git-parse-remote.sh\n@@ -10,7 +10,10 @@ get_data_source () {\n \t\t# Not so fast.\tThis could be the partial URL shorthand...\n \t\ttoken=$(expr \"z$1\" : 'z\\([^/]*\\)/')\n \t\tremainder=$(expr \"z$1\" : 'z[^/]*/\\(.*\\)')\n-\t\tif test -f \"$GIT_DIR/branches/$token\"\n+\t\tif test \"$(git-repo-config --get \"remote.$token.url\")\"\n+\t\tthen\n+\t\t\techo config-partial\n+\t\telif test -f \"$GIT_DIR/branches/$token\"\n \t\tthen\n \t\t\techo branches-partial\n \t\telse\n@@ -18,7 +21,10 @@ get_data_source () {\n \t\tfi\n \t\t;;\n \t*)\n-\t\tif test -f \"$GIT_DIR/remotes/$1\"\n+\t\tif test \"$(git-repo-config --get \"remote.$1.url\")\"\n+\t\tthen\n+\t\t\techo config\n+\t\telif test -f \"$GIT_DIR/remotes/$1\"\n \t\tthen\n \t\t\techo remotes\n \t\telif test -f \"$GIT_DIR/branches/$1\"\n@@ -35,6 +41,15 @@ get_remote_url () {\n \tcase \"$data_source\" in\n \t'')\n \t\techo \"$1\" ;;\n+\tconfig-partial)\n+\t\ttoken=$(expr \"z$1\" : 'z\\([^/]*\\)/')\n+\t\tremainder=$(expr \"z$1\" : 'z[^/]*/\\(.*\\)')\n+\t\turl=$(git-repo-config --get \"remote.$token.url\")\n+\t\techo \"$url/$remainder\"\n+\t\t;;\n+\tconfig)\n+\t\tgit-repo-config --get \"remote.$1.url\"\n+\t\t;;\n \tremotes)\n \t\tsed -ne '/^URL: */{\n \t\t\ts///p\n@@ -56,8 +71,10 @@ get_remote_url () {\n get_remote_default_refs_for_push () {\n \tdata_source=$(get_data_source \"$1\")\n \tcase \"$data_source\" in\n-\t'' | branches | branches-partial)\n+\t'' | config-partial | branches | branches-partial)\n \t\t;; # no default push mapping, just send matching refs.\n+\tconfig)\n+\t\tgit-repo-config --get-all \"remote.$1.push\" ;;\n \tremotes)\n \t\tsed -ne '/^Push: */{\n \t\t\ts///p\n@@ -111,8 +128,11 @@ # Returns list of src: (no store), or sr\n get_remote_default_refs_for_fetch () {\n \tdata_source=$(get_data_source \"$1\")\n \tcase \"$data_source\" in\n-\t'' | branches-partial)\n+\t'' | config-partial | branches-partial)\n \t\techo \"HEAD:\" ;;\n+\tconfig)\n+\t\tcanon_refs_list_for_fetch \\\n+\t\t\t$(git-repo-config --get-all \"remote.$1.fetch\") ;;\n \tbranches)\n \t\tremote_branch=$(sed -ne '/#/s/.*#//p' \"$GIT_DIR/branches/$1\")\n \t\tcase \"$remote_branch\" in '') remote_branch=master ;; esac\n"}]}