Re: [PATCH] git-blame, take 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Thu, 2 Mar 2006, Fredrik Kuivinen wrote:
> 
> 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
...
> +
> +	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
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]