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

Re: [PATCH 2/2] git-log (internal): more options.

From
Linus Torvalds <torvalds@osdl.org>
Date
Mar 1, 2006, 15:43 UTC
Message-ID
<Pine.LNX.4.64.0603010730520.22647@g5.osdl.org>
In-Reply-To
<7vbqwqgxo8.fsf@assigned-by-dhcp.cox.net>
On Wed, 1 Mar 2006, Junio C Hamano wrote:
Show 15 quoted lines
>
> This ports the following options from rev-list based git-log
> implementation:
> 
>  * -<n>, -n<n>, and -n <n>.  I am still wondering if we want
>     this natively supported by setup_revisions(), which already
>     takes --max-count.  We may want to move them in the next
>     round.  Also I am not sure if we can get away with not
>     setting revs->limited when we set max-count.  The latest
>     rev-list.c and revision.c in this series do not, so I left
>     them as they are.
> 
>  * --pretty and --pretty=<fmt>.
> 
>  * --abbrev=<n> and --no-abbrev.
Looks good.

I _suspect_ that we want to handle them all in setup_revision(), but I wasn't sure, so I left them in rev-list.c originally.

Most helpers that want a list of commits probably want the printing options too, and the ones that do not probably simply don't care (ie if they silently pass a "--pretty=raw" without it affecting anything, who really cares?)

Show 15 quoted lines
> The previous commit already handles time-based limiters
> (--since, --until and friends).  The remaining things that
> rev-list based git-log happens to do are not useful in a pure
> log-viewing purposes, and not ported:
> 
>  * --bisect (obviously).
> 
>  * --header.  I am actually in favor of doing the NUL
>    terminated record format, but rev-list based one always
>    passed --pretty, which defeated this option.  Maybe next
>    round.
> 
>  * --parents.  I do not think of a reason a log viewer wants
>    this.  The flag is primarily for feeding squashed history
>    via pipe to downstream tools.

I can actually imagine using "--parents" as a way of parsing both the commit log and the history. Of course, any such use is likely in a script, at which point the script probably doesn't actually want "git log", but just a raw "git-rev-list".

After all, the only _real_ difference between "git log" and "git-rev-list" is the purely syntactic one (things like defaulting to HEAD in "git log" and requiring revisions in git-rev-list), and the use of PAGER.

To me, the question whether a flag would be parsed in the "revision.c" library or in the "rev-list.c" binary was more a question of whether that flag makes sense for other things than just "git log".

For example, "git whatchanged" and "git diff" could both use setup_revision(), although "git diff" wouldn't actually _walk_ the revisions (it would just look at the "revs->commits" list to see what was passed in).

"git whatchanged" would obviously take all the same flags "git log" does, and "git diff" could take them and just test the values for sanity (ie error out if min/max_date is not -1, for example).

"git show" is like a "git-whatchanged" except it wouldn't walk the diffs (I considered adding a "--nowalk" option to setup_revisions(), which would just suppress the "add_parents_to_list()" entirely)

			Linus
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 13 in “git-rev-list libification effort: the next stage”
  1. 0/3 git-rev-list libification effort: the next stageLinus Torvalds, Feb 28, 2006
  2. 1/3 git-rev-list libification: rev-list walkingLinus Torvalds, Feb 28, 2006
  3. 2/3 Introduce trivial new pager.c helper infrastructureLinus Torvalds, Feb 28, 2006
  4. 3/3 Tie it all together: "git log"Linus Torvalds, Feb 28, 2006
  5. Linus TorvaldsFeb 28, 2006
  6. Junio C HamanoFeb 28, 2006
  7. Linus TorvaldsFeb 28, 2006
  8. 1/2 git-log (internal): add approxidate.Junio C Hamano, Mar 1, 2006
  9. 2/2 git-log (internal): more options.Junio C Hamano, Mar 1, 2006
  10. Linus TorvaldsMar 1, 2006
  11. Junio C HamanoMar 1, 2006
  12. Martin LanghoffFeb 28, 2006
  13. Junio C HamanoMar 1, 2006

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.