public RevCommit tryFastForward(RevCommit newCommit) throws IOException,GitAPIException {Ref head = getHead();ObjectId headId = head.getObjectId();if (headId == null)throw new RefNotFoundException(MessageFormat.format(JGitText.get().refNotResolved, Constants.HEAD));RevCommit headCommit = walk.lookupCommit(headId);if (walk.isMergedInto(newCommit, headCommit))return newCommit;String headName = getHeadName(head);return tryFastForward(headName, headCommit, newCommit);}

public virtual RevCommit TryFastForward(RevCommit newCommit){Ref head = repo.GetRef(Constants.HEAD);if (head == null || head.GetObjectId() == null){throw new RefNotFoundException(MessageFormat.Format(JGitText.Get().refNotResolved, Constants.HEAD));}ObjectId headId = head.GetObjectId();if (headId == null){throw new RefNotFoundException(MessageFormat.Format(JGitText.Get().refNotResolved, Constants.HEAD));}RevCommit headCommit = walk.LookupCommit(headId);if (walk.IsMergedInto(newCommit, headCommit)){return newCommit;}string headName;if (head.IsSymbolic()){headName = head.GetTarget().GetName();}else{headName = "detached HEAD";}return TryFastForward(headName, headCommit, newCommit);}
