git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: GIT PULL] ext4 updates for 3.5

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 1, 2012, 18:55 UTC
Message-ID
<7v8vg63lri.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CA+55aFxgZupkAotfjUuWcfwTzHDYg0Afezme62P17=EX2KN+UQ@mail.gmail.com>
Linus Torvalds <torvalds@linux-foundation.org> writes:
> Apparently git request-pull is too damn smart for its own good, and
> will find the tags even when they aren't mentioned, making you think
> it made it to me. Bot it doesn't - so then I have to go search for
> them by hand.
Something like this, perhaps.
 git-request-pull.sh | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/git-request-pull.sh b/git-request-pull.sh
index e6438e2..5ca786e 100755
--- a/git-request-pull.sh
+++ b/git-request-pull.sh
@@ -57,9 +57,13 @@ headrev=$(git rev-parse --verify "$head"^0) || exit
 merge_base=$(git merge-base $baserev $headrev) ||
 die "fatal: No commits in common between $base and $head"
 
-# $head is the token given from the command line. If a ref with that
-# name exists at the remote and their values match, we should use it.
-# Otherwise find a ref that matches $headrev.
+# $head is the token given from the command line, and $tag_name, if
+# exists, is the tag we are going to show the commit information for.
+# If that tag exists at the remote and it points at the commit, use it.
+# Otherwise, if a branch with the same name as $head exists at the remote
+# and their values match, use that instead.
+#
+# Otherwise find a random ref that matches $headrev.
 find_matching_ref='
 	sub abbr {
 		my $ref = shift;
@@ -70,24 +74,29 @@ find_matching_ref='
 		}
 	}
 
-	my ($exact, $found);
+	my ($tagged, $branch, $found);
 	while (<STDIN>) {
 		my ($sha1, $ref, $deref) = /^(\S+)\s+(\S+?)(\^\{\})?$/;
 		next unless ($sha1 eq $ARGV[1]);
 		$found = abbr($ref);
+		if ($deref) {
+			$tagged = $found;
+			last;
+		}
 		if ($ref =~ m|/\Q$ARGV[0]\E$|) {
 			$exact = $found;
-			last;
 		}
 	}
-	if ($exact) {
+	if ($tagged) {
+		print "$tagged\n";
+	} elsif ($exact) {
 		print "$exact\n";
 	} elsif ($found) {
 		print "$found\n";
 	}
 '
 
-ref=$(git ls-remote "$url" | perl -e "$find_matching_ref" "$head" "$headrev")
+ref=$(git ls-remote "$url" | perl -e "$find_matching_ref" "$head" "$headrev" "$tag_name")
 
 url=$(git ls-remote --get-url "$url")
 
Previous: Linus TorvaldsNext: Junio C Hamano
Message 2 of 8 in “Re: GIT PULL] ext4 updates for 3.5”
  1. Linus TorvaldsJun 1, 2012
  2. Junio C HamanoJun 1, 2012
  3. Junio C HamanoJun 1, 2012
  4. Linus TorvaldsJun 1, 2012
  5. Ted Ts'oJun 1, 2012
  6. Linus TorvaldsJun 1, 2012
  7. Ted Ts'oJun 1, 2012
  8. Junio C HamanoJun 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.