Bug 343801 - Add LsRemoteCommand to API
Summary: Add LsRemoteCommand to API
Status: RESOLVED FIXED
Alias: None
Product: JGit
Classification: Technology
Component: JGit (show other bugs)
Version: 0.10.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 1.0.0   Edit
Assignee: Christoph Brill CLA
QA Contact:
URL:
Whiteboard:
Keywords: api, noteworthy
Depends on:
Blocks:
 
Reported: 2011-04-26 04:44 EDT by Christoph Brill CLA
Modified: 2011-05-19 15:47 EDT (History)
1 user (show)

See Also:


Attachments
LsRemoteCommand.java (5.14 KB, text/plain)
2011-04-26 05:41 EDT, Christoph Brill CLA
no flags Details
LsRemoteCommand.java (5.44 KB, text/plain)
2011-05-04 08:10 EDT, Christoph Brill CLA
no flags Details
LsRemoteResult.java (275 bytes, text/plain)
2011-05-04 08:12 EDT, Christoph Brill CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Brill CLA 2011-04-26 04:44:29 EDT
From what I understood jgit currently does not support support ls-remote[1]. It would be really helpfull if jgit would support this command.

[1] http://www.kernel.org/pub/software/scm/git/docs/git-ls-remote.html
Comment 1 Christoph Brill CLA 2011-04-26 05:41:33 EDT
Created attachment 194039 [details]
LsRemoteCommand.java

Initial attempt at implementing ls-remote.

It seems to work but filtering for tags does not work. It seems like a bug in FetchProcess where the "Set<Ref> matched" is filled but never used. Or maybe I'm doing it wrong?

My simple test program is:

Repository repo = new FileRepository("jgit/.git");
LsRemoteCommand lsRemoteCommand = new LsRemoteCommand(repo);
lsRemoteCommand.setTags(true);
FetchResult call = lsRemoteCommand.call();
for (Ref s : call.getAdvertisedRefs()) {
	System.out.println(s);
}
Comment 2 Christoph Brill CLA 2011-05-04 08:10:33 EDT
Created attachment 194699 [details]
LsRemoteCommand.java

Working implementation
Comment 3 Christoph Brill CLA 2011-05-04 08:12:07 EDT
Created attachment 194700 [details]
LsRemoteResult.java

Necessary return object
Comment 4 Chris Aniszczyk CLA 2011-05-04 08:12:52 EDT
Can you contribute these two patches via Gerrit?

http://wiki.eclipse.org/EGit/Contributor_Guide#Contributing_Patches
Comment 5 Chris Aniszczyk CLA 2011-05-04 08:13:21 EDT
Generally tests are helpful too.
Comment 6 Chris Aniszczyk CLA 2011-05-05 16:14:44 EDT
I pushed a patch here:

http://egit.eclipse.org/r/3346

Please review it if it meets your needs.
Comment 7 Chris Aniszczyk CLA 2011-05-19 15:47:09 EDT
merged into master as e170c314fb96977650d69f7af206d84a362126be.

Also added a LsRemoteCommandTest.

Thanks for your contribution Christoph!