mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
4af254776e
commit
809a6e784c
1 changed files with 5 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue