@Test public void getBranchHeadCommitTest() throws IOException { AnyObjectId firstCommit = initRepository(); assertEquals(firstCommit, BranchUtils.getHeadCommit(Constants.MASTER, repo)); writeToCache("a.txt"); String branchName = "second"; AnyObjectId branchCommit = commitToBranch(branchName, firstCommit); assertEquals(branchCommit, BranchUtils.getHeadCommit(branchName, repo)); }
@Nonnull public static RevCommit getHeadCommit(String name, Repository repo) throws IOException { Ref ref = RefUtils.getBranchRef(name, repo); return getCommit(ref.getObjectId(), repo); }
BranchUtils { @Nonnull public static RevCommit getHeadCommit(String name, Repository repo) throws IOException { Ref ref = RefUtils.getBranchRef(name, repo); return getCommit(ref.getObjectId(), repo); } }
BranchUtils { @Nonnull public static RevCommit getHeadCommit(String name, Repository repo) throws IOException { Ref ref = RefUtils.getBranchRef(name, repo); return getCommit(ref.getObjectId(), repo); }  }
BranchUtils { @Nonnull public static RevCommit getHeadCommit(String name, Repository repo) throws IOException { Ref ref = RefUtils.getBranchRef(name, repo); return getCommit(ref.getObjectId(), repo); }  @Nonnull static List<RevCommit> getHistory(String name, Repository repo); @Nonnull static Map<String, Ref> getBranches(Repository repo); static boolean branchExists(String name, Repository repo); @Nonnull static RevCommit getHeadCommit(String name, Repository repo); static void createBranch(String name, RevTag startPoint, Repository repo); static void createBranch(String name, RevCommit startPoint, Repository repo); static void createBranch(String name, AnyObjectId startPoint, Repository repo); static void createBranch(String name, Ref startPoint, Repository repo); static void createBranch(String name, String startPoint, Repository repo); static void resetBranchHead(String name, AnyObjectId commitId, Repository repo); static void newCommit(String name, AnyObjectId commitId, Repository repo); static void amendCommit(String name, AnyObjectId commitId, Repository repo); static void mergeCommit(String name, AnyObjectId commitId, Repository repo); static void initBranch(String name, AnyObjectId commitId, Repository repo); static void cherryPick(String name, AnyObjectId commitId, Repository repo); static void merge(String name, AnyObjectId commitId, Ref sourceRef, String details, Repository repo); static void deleteBranch(String name, Repository repo); @Nonnull static List<ReflogEntry> getLogs(String name, int max, Repository repository); @Nonnull static List<ReflogEntry> getLogs(String name, Repository repository); @Nullable static ReflogEntry getLastLog(String name, Repository repository); }
BranchUtils { @Nonnull public static RevCommit getHeadCommit(String name, Repository repo) throws IOException { Ref ref = RefUtils.getBranchRef(name, repo); return getCommit(ref.getObjectId(), repo); }  @Nonnull static List<RevCommit> getHistory(String name, Repository repo); @Nonnull static Map<String, Ref> getBranches(Repository repo); static boolean branchExists(String name, Repository repo); @Nonnull static RevCommit getHeadCommit(String name, Repository repo); static void createBranch(String name, RevTag startPoint, Repository repo); static void createBranch(String name, RevCommit startPoint, Repository repo); static void createBranch(String name, AnyObjectId startPoint, Repository repo); static void createBranch(String name, Ref startPoint, Repository repo); static void createBranch(String name, String startPoint, Repository repo); static void resetBranchHead(String name, AnyObjectId commitId, Repository repo); static void newCommit(String name, AnyObjectId commitId, Repository repo); static void amendCommit(String name, AnyObjectId commitId, Repository repo); static void mergeCommit(String name, AnyObjectId commitId, Repository repo); static void initBranch(String name, AnyObjectId commitId, Repository repo); static void cherryPick(String name, AnyObjectId commitId, Repository repo); static void merge(String name, AnyObjectId commitId, Ref sourceRef, String details, Repository repo); static void deleteBranch(String name, Repository repo); @Nonnull static List<ReflogEntry> getLogs(String name, int max, Repository repository); @Nonnull static List<ReflogEntry> getLogs(String name, Repository repository); @Nullable static ReflogEntry getLastLog(String name, Repository repository);  }