implement branch option for git log command

This commit is contained in:
Sebastian Sdorra
2012-07-27 11:09:32 +02:00
parent b1b6f5e4d1
commit f50e3d912b
2 changed files with 14 additions and 1 deletions

View File

@@ -250,6 +250,10 @@ public class GitUtil
throws IOException
{
ObjectId branchId = null;
if ( ! branchName.startsWith(REF_HEAD) ){
branchName = PREFIX_HEADS.concat(branchName);
}
Ref ref = repo.getRef(branchName);
if (ref != null)

View File

@@ -217,7 +217,16 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
PathFilter.create(request.getPath()), TreeFilter.ANY_DIFF));
}
ObjectId head = GitUtil.getRepositoryHead(gr);
ObjectId head = null;
if (!Strings.isNullOrEmpty(request.getBranch()))
{
head = GitUtil.getBranchId(gr, request.getBranch());
}
else
{
head = GitUtil.getRepositoryHead(gr);
}
if (head != null)
{