diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-03-11 14:55:43 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-03-11 17:49:31 -0700 |
commit | 809a6e784c61364b2f2078cdd1acf452da7550a1 (patch) | |
tree | a8dfda21d68c6eca1745db1181d6990c366ba003 /save-git.c | |
parent | 4af254776eca760b75ad0bce7da0cc20c9b1963b (diff) | |
download | subsurface-809a6e784c61364b2f2078cdd1acf452da7550a1.tar.gz |
git-save: don't create a redundant new commits with no changes
If the newly created save tree is identical to the parent commit tree,
don't bother creating a new commit. We are already fully up-to-date.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'save-git.c')
-rw-r--r-- | save-git.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/save-git.c b/save-git.c index ef6ce2755..04ff87467 100644 --- a/save-git.c +++ b/save-git.c @@ -774,6 +774,11 @@ static int create_new_commit(git_repository *repo, const char *branch, git_oid * case 0: if (git_reference_peel(&parent, ref, GIT_OBJ_COMMIT)) return report_error("Unable to look up parent in branch '%s'", branch); + + /* If the parent commit has the same tree ID, do nothing */ + if (git_oid_equal(tree_id, git_commit_tree_id((const git_commit *) parent))) + return 0; + /* all good */ break; } |