From: Linus Torvalds Date: Thu, 02 Mar 2006 21:45:18 GMT Subject: Re: [PATCH] git-blame, take 2 Message-ID: In-Reply-To: <20060302212816.GA11015@c165.ib.student.liu.se> 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