git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix handling of not_for_merge '.' flag in refspec.
@ 2005-09-29 23:53 Tom Prince
  2005-09-30  0:47 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Tom Prince @ 2005-09-29 23:53 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Tom Prince

canon_refs_list_for_fetch did not know about '.', so it mangled any
reference with it. Further, it added '.' to any refspec on the command
line other than the first.

Signed-off-by: Tom Prince <tom.prince@ualberta.net>


---

 Documentation/pull-fetch-param.txt |    5 +++--
 git-parse-remote.sh                |   16 +++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

446dda983492e3c07dc73b271cb9208a4359a734
diff --git a/Documentation/pull-fetch-param.txt b/Documentation/pull-fetch-param.txt
--- a/Documentation/pull-fetch-param.txt
+++ b/Documentation/pull-fetch-param.txt
@@ -49,7 +49,7 @@
 
 <refspec>::
 	The canonical format of a <refspec> parameter is
-	'+?<src>:<dst>'; that is, an optional plus '+', followed
+	'.?+?<src>:<dst>'; that is, an optional plus '+', followed
 	by the source ref, followed by a colon ':', followed by
 	the destination ref.
 
@@ -68,7 +68,8 @@
 	ref that matches it is fast forwarded using <src>.
 	Again, if the optional plus '+' is used, the local ref
 	is updated even if it does not result in a fast forward
-	update.
+	update. If the optional dot '.' is used, the remote ref
+	is fetched, but not used for merging.
 
 	Some short-cut notations are also supported.
 
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -72,8 +72,15 @@ canon_refs_list_for_fetch () {
 	dot_prefix=
 	for ref
 	do
+		not_for_merge=
 		force=
 		case "$ref" in
+		.*)
+			ref=$(expr "$ref" : '\.\(.*\)')
+			not_for_merge=.
+			;;
+		esac
+		case "$ref" in
 		+*)
 			ref=$(expr "$ref" : '\+\(.*\)')
 			force=+
@@ -94,7 +101,12 @@ canon_refs_list_for_fetch () {
 		heads/* | tags/* ) local="refs/$local" ;;
 		*) local="refs/heads/$local" ;;
 		esac
-		echo "${dot_prefix}${force}${remote}:${local}"
+		case "$octopus$not_for_merge" in
+		'')	
+			not_for_merge=$dot_prefix
+			;;
+		esac
+		echo "${not_for_merge}${force}${remote}:${local}"
 		dot_prefix=.
 	done
 }
@@ -114,6 +126,7 @@ get_remote_default_refs_for_fetch () {
 		# This prefixes the second and later default refspecs
 		# with a '.', to signal git-fetch to mark them
 		# not-for-merge.
+		octopus=
 		canon_refs_list_for_fetch $(sed -ne '/^Pull: */{
 						s///p
 					}' "$GIT_DIR/remotes/$1")
@@ -155,6 +168,7 @@ get_remote_refs_for_fetch () {
 			;;
 		    esac
 		fi
+		octopus=t
 		canon_refs_list_for_fetch "$ref"
 	    done
 	    ;;

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

* Re: [PATCH] Fix handling of not_for_merge '.' flag in refspec.
  2005-09-29 23:53 [PATCH] Fix handling of not_for_merge '.' flag in refspec Tom Prince
@ 2005-09-30  0:47 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2005-09-30  0:47 UTC (permalink / raw)
  To: Tom Prince; +Cc: git

Tom Prince <tom.prince@ualberta.net> writes:

> canon_refs_list_for_fetch did not know about '.', so it mangled any
> reference with it. Further, it added '.' to any refspec on the command
> line other than the first.

The dot trick was supposed to be internal.  If you have the
following three lines in a remotes/xyzzy file:

	URL: http://xyzzy.xz/balances.git
        Pull: frotz nitfol
        Pull: rezrov

    $ git pull xyzzy

    - fetch frotz, nitfol, and rezrov; merge frotz into the
      current branch

    $ git pull xyzzy nitfol

    - fetch nitfol only; merge nitfol into the current branch.

    $ git pull xyzzy nitfol rezrov

    - fetch nitfol and rezrov; merge them into the current
      branch (an Octopus).

The '.' is in no way part of the <refspec> format.  It may not
be a bad idea to explicitly forbid it, but currently we don't.

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

end of thread, other threads:[~2005-09-30  0:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-29 23:53 [PATCH] Fix handling of not_for_merge '.' flag in refspec Tom Prince
2005-09-30  0:47 ` 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).