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

Re: linking libgit.a in C++ projects

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Aug 1, 2008, 01:54 UTC
Message-ID
<alpine.LFD.1.10.0807311840240.3277@nehalem.linux-foundation.org>
In-Reply-To
<ac9f0f090807311817n551f53a5mb1270e6f4b2a058e@mail.gmail.com>
On Thu, 31 Jul 2008, cte wrote:
>
> Instead, git-log had to be altered to address gitk's needs, and an 
> option was added that users don't typically use.
Actually, no. 

I ended up doing a hack to add "git log --early-output", and some quick hacks to make git use it. But I'm happy to say that gitk doesn't use it any more. Gitk just parses the normal git log output, although obviously it ends up needing enough data to be able to fill in the gaps (ie it uses the "--parents" flag to get the rewritten parenthood info and the merges to keep it together).

So yeah, we have some options that enable output that simply doesn't make _sense_ to humans, but does when you are post-processing it (git has always had those, since it very much was about scripting from day one), but no, at least gitk doesn't use any really odd ones.

It literally does
	git log --no-color -z --pretty=raw --parents --boundary

(plus the args the user gave it). The --no-color turns off color if it's enabled by default.

The -z makes it the git log output a bit easier to parse by using a NUL character between commits.

The --pretty=raw is just to give the full/raw commit info - like giving the timestamps in the native raw format that is much easier to parse than any human-readable format.

The --parents I already mentioned - it is what makes you able to stitch the commits together (and it's useful for other things too: any scripts that look for merges will tend to use it, for example)

And the --boundary is to show the commits that aren't part of the actual selected set in gray.

It's all pretty generic, in other words. The -z option is purely for machine parsing, the others _can_ actually be useful even for humans (eg, --boundary together with --left-right and --pretty=oneline actually is very readable if you are used to that format).

So it's very true that git in general is geared towards scripting (and we've often added things to make it even more so), but no, your particular complaint isn't true. gitk doesn't do anything really strange.

		Linus
Previous: cteNext: cte
Message 14 of 26 in “linking libgit.a in C++ projects”
  1. cteJul 31, 2008
  2. Dmitry PotapovJul 31, 2008
  3. cteJul 31, 2008
  4. Pedro MeloJul 31, 2008
  5. Petr BaudisJul 31, 2008
  6. cteJul 31, 2008
  7. Sverre RabbelierJul 31, 2008
  8. cteJul 31, 2008
  9. Sverre RabbelierJul 31, 2008
  10. Shawn O. PearceJul 31, 2008
  11. Sverre RabbelierJul 31, 2008
  12. Steve FrécinauxAug 4, 2008
  13. cteAug 1, 2008
  14. Linus TorvaldsAug 1, 2008
  15. cteAug 1, 2008
  16. Dmitry PotapovJul 31, 2008
  17. Petr BaudisJul 31, 2008
  18. cteJul 31, 2008
  19. Dmitry PotapovJul 31, 2008
  20. Boaz HarroshJul 31, 2008
  21. Dmitry PotapovJul 31, 2008
  22. Alex RiesenJul 31, 2008
  23. Avery PennarunJul 31, 2008
  24. Alex RiesenAug 3, 2008
  25. Boaz HarroshAug 4, 2008
  26. cteJul 31, 2008

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.