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

[PATCH 0/3] git-rev-list libification effort: the next stage

From
Linus Torvalds <torvalds@osdl.org>
Date
Feb 28, 2006, 19:19 UTC
Message-ID
<Pine.LNX.4.64.0602281115110.22647@g5.osdl.org>

Ok, the following three patches that I'll send out are still pretty rough, but they actually get us to the first real point of this whole exercise: writing one of the trivial git helper scripts in C.

In particular, at the end, we have "git log" being implemented as this trivial C function:

	#define LOGSIZE (65536)
	static int cmd_log(int argc, char **argv, char **envp)
	{
		struct rev_info rev;
		struct commit *commit;
		char *buf = xmalloc(LOGSIZE);
		argc = setup_revisions(argc, argv, &rev, "HEAD");
		prepare_revision_walk(&rev);
		setup_pager();
		while ((commit = get_revision(&rev)) != NULL) {
			pretty_print_commit(CMIT_FMT_DEFAULT, commit, ~0, buf, LOGSIZE, 18);
			printf("%s\n", buf);
		}
		free(buf);
		return 0;
	}

which is actually a pretty good example of what I wanted to do. It's not perfect yet (it doesn't parse the "--pretty=xxx" option yet, nor the "--since" and "--until" dates, for example), but I think this is all going in the right direction.

			Linus
Next: Linus Torvalds
Message 1 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.