[RFC] git-fetch: Optionally store fetch information under a nick

From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Date: 2005-12-17 01:16:17
This is on top of my .git/remotes/* -> .git/config patch. With this, you
can do:

	git pull -S junio git://git.kernel.org/pub/scm/git/git.git \
		master:junio todo:todo +pu:pu

once, and after that,

	git pull junio

will have the same effect.

Signed-off-by: Johannes "always off by one" Schindelin <Johannes.Schindelin@gmx.de>

---

	This was what git-repo-config was all about, but I backed off a
	little when I felt not much enthusiasm for remote information in
	the config.

	However, when I tried to get a CVS user to work *with* (as opposed
	to *on*) git, he told me that he was sick of editing files, and
	if there would be a more user friendly way to store the remote
	information. So, I whipped this up.

 Documentation/fetch-options.txt |    6 ++++++
 git-fetch.sh                    |   16 ++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)

2bbb9ef0fc8601a91f0b36ad27a7e2be09cc6e46
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 200c9b2..a1d9210 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -10,6 +10,12 @@
 	fetches is a descendant of `<lbranch>`.  This option
 	overrides that check.
 
+-S, \--store <nick>::
+	Store the URL and the refnames in the config file so that
+	`git fetch <nick>` repeats the exercise.
+	If the nick exists already, edit the URL, but append the
+	refnames.
+
 -t, \--tags::
 	By default, the git core utilities will not fetch and store
 	tags under the same name as the remote repository;  ask it
diff --git a/git-fetch.sh b/git-fetch.sh
index 0a4fc98..f3f6146 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -16,6 +16,7 @@ append=
 force=
 verbose=
 update_head_ok=
+store=
 while case "$#" in 0) break ;; esac
 do
 	case "$1" in
@@ -25,6 +26,10 @@ do
 	-f|--f|--fo|--for|--forc|--force)
 		force=t
 		;;
+	-S|--s|--st|--sto|--stor|--store)
+		store="$2"
+		shift
+		;;
 	-t|--t|--ta|--tag|--tags)
 		tags=t
 		;;
@@ -204,10 +209,21 @@ then
 	fi
 fi
 
+if test "$store"
+then
+    git-repo-config remote."$store".url $remote ||
+	die "Could not store into $store"
+fi
+
 for ref in $reflist
 do
     refs="$refs$LF$ref"
 
+    if test "$store"
+    then
+	git-repo-config remote."$store".pull "$ref" '^$'
+    fi
+
     # These are relative path from $GIT_DIR, typically starting at refs/
     # but may be HEAD
     if expr "$ref" : '\.' >/dev/null
-- 
0.99.9.GIT
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Sat Dec 17 01:16:51 2005

This archive was generated by hypermail 2.1.8 : 2005-12-17 01:17:00 EST