From 3214171decf596f003c154685638b01faba31ff3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Wed, 14 Feb 2018 20:34:03 +0100 Subject: RepoCommand: don't record new commit if tree did not change Signed-off-by: Han-Wen Nienhuys Change-Id: Ib6509e816684256d723558d5e8f3c37de58a2ff8 --- org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'org.eclipse.jgit/src/org') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java index 24651b9b6b..377fdf0199 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java @@ -643,6 +643,11 @@ public class RepoCommand extends GitCommand { // Create a Commit object, populate it and write it ObjectId headId = repo.resolve(targetBranch + "^{commit}"); //$NON-NLS-1$ + if (headId != null && rw.parseCommit(headId).getTree().getId().equals(treeId)) { + // No change. Do nothing. + return rw.parseCommit(headId); + } + CommitBuilder commit = new CommitBuilder(); commit.setTreeId(treeId); if (headId != null) -- cgit v1.2.3