aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2018-02-14 20:34:03 +0100
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-02-19 20:24:07 +0900
commit3214171decf596f003c154685638b01faba31ff3 (patch)
tree3fafe82a7714f4aee9319d3a75d52a320e4b4b9e /org.eclipse.jgit/src/org
parent446a7096ef01c0e3bb56736403d91b125b2ee6ba (diff)
downloadjgit-3214171decf596f003c154685638b01faba31ff3.tar.gz
jgit-3214171decf596f003c154685638b01faba31ff3.zip
RepoCommand: don't record new commit if tree did not change
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Change-Id: Ib6509e816684256d723558d5e8f3c37de58a2ff8
Diffstat (limited to 'org.eclipse.jgit/src/org')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/gitrepo/RepoCommand.java5
1 files changed, 5 insertions, 0 deletions
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<RevCommit> {
// 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)