git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3/3] fetch: optionally store the current remote information in the config
@ 2006-04-30 13:24 Johannes Schindelin
  2006-04-30 14:19 ` Jakub Narebski
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Johannes Schindelin @ 2006-04-30 13:24 UTC (permalink / raw)
  To: git


Instead of editing files, you can now say

	git pull --store junio \
		git://git.kernel.org/pub/scm/git/git.git next:next

and next time, just

	git pull junio

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

---

	This is what the patch series is all about.

	If there is no interest in a feature like this, let's just forget
	about the whole "remote info in config" thing.

	If there is interest, I could add the same functionality to
	builtin-push.

 Documentation/fetch-options.txt |    6 ++++++
 git-fetch.sh                    |   19 +++++++++++++++++++
 git-pull.sh                     |    8 ++++++--
 3 files changed, 31 insertions(+), 2 deletions(-)

6bd937b0de211465e9664f8dc890fc5066617b73
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 13f34d3..caf98de 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -16,6 +16,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.
+
 \--no-tags::
 	By default, `git-fetch` fetches tags that point at
 	objects that are downloaded from the remote repository
diff --git a/git-fetch.sh b/git-fetch.sh
index 280f62e..ac122da 100755
--- a/git-fetch.sh
+++ b/git-fetch.sh
@@ -15,8 +15,10 @@ no_tags=
 tags=
 append=
 force=
+keep=
 verbose=
 update_head_ok=
+store=
 exec=
 upload_pack=
 while case "$#" in 0) break ;; esac
@@ -34,6 +36,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
 		;;
@@ -235,6 +241,12 @@ then
 	fi
 fi
 
+if test "$store"
+then
+    git-repo-config remote."$store".url $remote ||
+	die "Could not store into $store"
+fi
+
 fetch_main () {
   reflist="$1"
   refs=
@@ -243,6 +255,11 @@ fetch_main () {
   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 "z$ref" : 'z\.' >/dev/null
@@ -381,6 +398,8 @@ fetch_main () {
 
 fetch_main "$reflist"
 
+store=
+
 # automated tag following
 case "$no_tags$tags" in
 '')
diff --git a/git-pull.sh b/git-pull.sh
index 4611ae6..ab0fba3 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -8,7 +8,7 @@ USAGE='[-n | --no-summary] [--no-commit]
 LONG_USAGE='Fetch one or more remote refs and merge it/them into the current HEAD.'
 . git-sh-setup
 
-strategy_args= no_summary= no_commit=
+strategy_args= no_summary= no_commit= store=
 while case "$#,$1" in 0) break ;; *,-*) ;; *) break ;; esac
 do
 	case "$1" in
@@ -31,6 +31,10 @@ do
 		esac
 		strategy_args="${strategy_args}-s $strategy "
 		;;
+	-S|--store)
+		store="-S $2"
+		shift
+		;;
 	-h|--h|--he|--hel|--help)
 		usage
 		;;
@@ -43,7 +47,7 @@ do
 done
 
 orig_head=$(git-rev-parse --verify HEAD) || die "Pulling into a black hole?"
-git-fetch --update-head-ok "$@" || exit 1
+git-fetch --update-head-ok $store "$@" || exit 1
 
 curr_head=$(git-rev-parse --verify HEAD)
 if test "$curr_head" != "$orig_head"
-- 
1.3.1.g38c00-dirty

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2006-05-03  0:36 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-30 13:24 [PATCH 3/3] fetch: optionally store the current remote information in the config Johannes Schindelin
2006-04-30 14:19 ` Jakub Narebski
2006-04-30 15:52   ` Johannes Schindelin
2006-04-30 16:07     ` Jakub Narebski
     [not found] ` <20060430103046.35c1385f.seanlkml@sympatico.ca>
2006-04-30 14:30   ` sean
2006-04-30 15:49     ` Johannes Schindelin
     [not found]       ` <20060430123709.11fcdd5f.seanlkml@sympatico.ca>
2006-04-30 16:37         ` sean
2006-04-30 16:51           ` Jakub Narebski
     [not found]             ` <20060430131936.43598f6f.seanlkml@sympatico.ca>
2006-04-30 17:19               ` sean
2006-04-30 17:35                 ` Jakub Narebski
2006-04-30 17:09           ` Johannes Schindelin
     [not found]             ` <20060430132819.3af8e9d1.seanlkml@sympatico.ca>
2006-04-30 17:28               ` sean
2006-04-30 22:21       ` Junio C Hamano
2006-05-02  8:59 ` Junio C Hamano
2006-05-02 12:42   ` Johannes Schindelin
2006-05-03  0:36     ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).