Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #151 from pauxus/jgit-references
[JENKINS-25387] Allow reference repositories for JGit as well.
- Loading branch information
Showing
5 changed files
with
341 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
package hudson.plugins.git; | ||
|
||
import org.eclipse.jgit.lib.Constants; | ||
import org.eclipse.jgit.lib.ObjectId; | ||
import org.eclipse.jgit.lib.Ref; | ||
|
||
public class Branch extends GitObject { | ||
private static final long serialVersionUID = 1L; | ||
|
||
public Branch(String name, ObjectId sha1) { | ||
super(name, sha1); | ||
} | ||
|
||
public Branch(Ref candidate) { | ||
super(strip(candidate.getName()), candidate.getObjectId()); | ||
} | ||
|
||
private static String strip(String name) { | ||
return name.substring(name.indexOf('/', 5) + 1); | ||
} | ||
|
||
public @Override String toString() { | ||
return "Branch " + name + "(" + sha1 + ")"; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.