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

Re: Fix git-rev-parse breakage

From
Junio C Hamano <junkio@cox.net>
Date
Aug 24, 2005, 18:52 UTC
Message-ID
<7v4q9fdv5w.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<Pine.LNX.4.58.0508231908170.3317@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 8 quoted lines
> The --flags cleanup caused problems: we used to depend on the fact that 
> "revs_only" magically suppressed flags, adn that assumption was broken by 
> the recent fixes.
>
> It wasn't a good assumption in the first place, so instead of 
> re-introducing it, let's just get rid of it.
>
> This makes "--revs-only" imply "--no-flags".

I was taking a look at this once again after noticing that I haven't taking any action on it. But now I am a bit confused reading the above. The first two paragraphs tells me "--revs-only implied --no-flags and we used to depend on it, but that is not a right thing so get rid of that assumption" (which I agree is a good change", and the last sentense says opposite...

And the code makes --revs-only imply --no-flags.
Here is my thinking, requesting for a sanity check.
* git-whatchanged wants to use it to tell rev-list arguments
  from rev-tree arguments.  You _do_ want to pick --max-count=10
  or --merge-order in this case, and --revs-only implying
  --no-flags would make this impossible.
* git-log-script uses it once to make sure it has one commit to
  start at, and lacks --no-flags by mistake.
* git-bisect uses it to validate the parameter is a valid ref,
  but does not use --verify.
This trivial patch fixes the latter two.
---
diff --git a/git-log-script b/git-log-script
--- a/git-log-script
+++ b/git-log-script
@@ -1,4 +1,4 @@
 #!/bin/sh
-revs=$(git-rev-parse --revs-only --default HEAD "$@") || exit
+revs=$(git-rev-parse --revs-only --no-flags --default HEAD "$@") || exit
 [ "$revs" ] || die "No HEAD ref"
 git-rev-list --pretty $(git-rev-parse --default HEAD "$@") | LESS=-S ${PAGER:-less}

diff --git a/git-bisect-script b/git-bisect-script
--- a/git-bisect-script
+++ b/git-bisect-script
@@ -67,7 +67,7 @@ bisect_good() {
 	bisect_autostart
         case "$#" in
 	0)    revs=$(git-rev-parse --verify HEAD) || exit ;;
-	*)    revs=$(git-rev-parse --revs-only "$@") || exit ;;
+	*)    revs=$(git-rev-parse --revs-only --verify "$@") || exit ;;
 	esac
 	for rev in $revs
 	do
Previous: Junio C HamanoNext: Linus Torvalds
Message 3 of 6 in “Fix git-rev-parse breakage”
  1. Linus TorvaldsAug 24, 2005
  2. Junio C HamanoAug 24, 2005
  3. Junio C HamanoAug 24, 2005
  4. Linus TorvaldsAug 24, 2005
  5. Audit rev-parse users again.Junio C Hamano, Aug 24, 2005
  6. Rationalize output selection in rev-parse.Junio C Hamano, Aug 24, 2005

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.