Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] git tag --contains <commit>

On Tue, Feb 22, 2011 at 15:56, Chris Aniszczyk <caniszczyk@xxxxxxxxx> wrote:
> Any idea how to use JGit to perform 'git tag --contains <commit>'

Well, for starters `git tag --contains` is probably just a wrapper
around `git name-rev`, which we haven't actually implemented yet in
JGit. But your brute force approach can try to approximate it... more

> I created a test to get what I want but not sure why
> RevWalk.isMergedInto(...) isn't working like I want it...

Why are you setting these on the RevWalk?


This shouldn't be necessary... but is also unsupported. Asking for
differences between a commit and its parent when you are also looking
for a merge base isn't something we ever planned to do.

                walk.sort(RevSort.TOPO, true);
                walk.sort(RevSort.COMMIT_TIME_DESC, true);

These sorts are unnecessary, the merge base code ignores them and
should process the graph itself without these.

That said, your test is looking for a merge base of a commit with
itself, which is itself. Looking over MergeBaseGenerator, this should
be working. :-(


Back to the top