{"thread":{"id":"2861","subject":"[RFC] git-fetch: Optionally store fetch information under a nick","startedAt":"2005-12-16T14:16:17Z","lastAt":"2005-12-16T14:16:17Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13724","messageId":"Pine.LNX.4.63.0512161514490.8170@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"2861","inReplyTo":null,"subject":"[RFC] git-fetch: Optionally store fetch information under a nick","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2005-12-16T14:16:17Z","receivedAt":"2005-12-16T14:16:17Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThis is on top of my .git/remotes/* -> .git/config patch. With this, you\ncan do:\n\n\tgit pull -S junio git://git.kernel.org/pub/scm/git/git.git \\\n\t\tmaster:junio todo:todo +pu:pu\n\nonce, and after that,\n\n\tgit pull junio\n\nwill have the same effect.\n\nSigned-off-by: Johannes \"always off by one\" Schindelin <Johannes.Schindelin@gmx.de>\n\n---\n\n\tThis was what git-repo-config was all about, but I backed off a\n\tlittle when I felt not much enthusiasm for remote information in\n\tthe config.\n\n\tHowever, when I tried to get a CVS user to work *with* (as opposed\n\tto *on*) git, he told me that he was sick of editing files, and\n\tif there would be a more user friendly way to store the remote\n\tinformation. So, I whipped this up.\n\n Documentation/fetch-options.txt |    6 ++++++\n git-fetch.sh                    |   16 ++++++++++++++++\n 2 files changed, 22 insertions(+), 0 deletions(-)\n\n2bbb9ef0fc8601a91f0b36ad27a7e2be09cc6e46\ndiff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt\nindex 200c9b2..a1d9210 100644\n--- a/Documentation/fetch-options.txt\n+++ b/Documentation/fetch-options.txt\n@@ -10,6 +10,12 @@\n \tfetches is a descendant of `<lbranch>`.  This option\n \toverrides that check.\n \n+-S, \\--store <nick>::\n+\tStore the URL and the refnames in the config file so that\n+\t`git fetch <nick>` repeats the exercise.\n+\tIf the nick exists already, edit the URL, but append the\n+\trefnames.\n+\n -t, \\--tags::\n \tBy default, the git core utilities will not fetch and store\n \ttags under the same name as the remote repository;  ask it\ndiff --git a/git-fetch.sh b/git-fetch.sh\nindex 0a4fc98..f3f6146 100755\n--- a/git-fetch.sh\n+++ b/git-fetch.sh\n@@ -16,6 +16,7 @@ append=\n force=\n verbose=\n update_head_ok=\n+store=\n while case \"$#\" in 0) break ;; esac\n do\n \tcase \"$1\" in\n@@ -25,6 +26,10 @@ do\n \t-f|--f|--fo|--for|--forc|--force)\n \t\tforce=t\n \t\t;;\n+\t-S|--s|--st|--sto|--stor|--store)\n+\t\tstore=\"$2\"\n+\t\tshift\n+\t\t;;\n \t-t|--t|--ta|--tag|--tags)\n \t\ttags=t\n \t\t;;\n@@ -204,10 +209,21 @@ then\n \tfi\n fi\n \n+if test \"$store\"\n+then\n+    git-repo-config remote.\"$store\".url $remote ||\n+\tdie \"Could not store into $store\"\n+fi\n+\n for ref in $reflist\n do\n     refs=\"$refs$LF$ref\"\n \n+    if test \"$store\"\n+    then\n+\tgit-repo-config remote.\"$store\".pull \"$ref\" '^$'\n+    fi\n+\n     # These are relative path from $GIT_DIR, typically starting at refs/\n     # but may be HEAD\n     if expr \"$ref\" : '\\.' >/dev/null\n-- \n0.99.9.GIT\n"}]}