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

Re: [PATCH] git-blame, take 2

From
Linus Torvalds <torvalds@osdl.org>
Date
Mar 2, 2006, 21:45 UTC
Message-ID
<Pine.LNX.4.64.0603021338130.22647@g5.osdl.org>
In-Reply-To
<20060302212816.GA11015@c165.ib.student.liu.se>
On Thu, 2 Mar 2006, Fredrik Kuivinen wrote:
Show 5 quoted lines
> 
> Here is an updated version of git-blame. The main changes compared to
> the first version are:
> 
> * Use the new revision.h interface to do the revision walking
...
Show 11 quoted lines
> +
> +	num_args = 0;
> +	args[num_args++] = NULL;
> +	args[num_args++] = "--topo-order";
> +	args[num_args++] = "--remove-empty";
> +	args[num_args++] = argv[1];
> +	args[num_args++] = "--";
> +	args[num_args++] = filename;
> +	args[num_args] = NULL;
> +	
> +	setup_revisions(num_args, args, &rev, "HEAD");
Ok, that wasn't really supposed to be necessary.

I guess the above works fine, but it should be perfectly fine to also just do a nicer helper function that just initializes rev_info with something like

	memset(revs, 0, sizeof(*revs));
	revs->max_count = -1;
	revs->min_date = -1;
	revs->max_date = -1;
	revs->dense = 1;

and then you can just fill in the things you want to directly. Just add the commits you want to populate things with to the "revs->commits" list, the paths to "revs->paths", set "revs->limited" to 1, and then do the "prepare_revision_walk()" and start walking.

But hey, the above "fake the arguments" thing also works. It makes me wince a bit, though.

		Linus
Previous: Fredrik Kuivinen
Message 2 of 2 in “git-blame, take 2”
  1. git-blame, take 2Fredrik Kuivinen, Mar 2, 2006
  2. Linus TorvaldsMar 2, 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.