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