diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2019-03-25 01:35:45 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2019-03-27 22:24:37 -0400 |
commit | e681d7cd9679244fe7f43ce9e66b8cf83f706d8a (patch) | |
tree | fcf1667f92152ede4a0b66b01626ad1ecc8ab92f /libs | |
parent | 2b351b2fc33cf6e5642fbd1f47984189374fe0e4 (diff) | |
download | librebootfr-e681d7cd9679244fe7f43ce9e66b8cf83f706d8a.tar.gz librebootfr-e681d7cd9679244fe7f43ce9e66b8cf83f706d8a.zip |
libs/git: Commit only if any blobs were removed
git_diff_check() was added for future use since it's complementary to
git_diff_staged_check(). It could be used to check for a dirty
worktree, for example.
Diffstat (limited to 'libs')
-rwxr-xr-x | libs/git | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -141,6 +141,26 @@ git_remove() { ) } +git_diff_staged_check() { + local repository_path=$1 + + ( + cd "$repository_path" + + git diff --staged --quiet + ) +} + +git_diff_check() { + local repository_path=$1 + + ( + cd "$repository_path" + + git diff --quiet + ) +} + git_commit() { local repository_path=$1 local message=$2 @@ -340,7 +360,10 @@ git_project_prepare_blobs() { git_remove "$repository_path" "$blob" done < "$blobs_path" - git_commit "$repository_path" "Removed blobs" + if ! git_diff_staged_check "$repository_path" + then + git_commit "$repository_path" "Removed blobs" + fi } git_project_prepare_patch() { |