aboutsummaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAndrew Robbins <contact@andrewrobbins.info>2019-03-25 01:35:45 -0400
committerAndrew Robbins <contact@andrewrobbins.info>2019-03-27 22:24:37 -0400
commite681d7cd9679244fe7f43ce9e66b8cf83f706d8a (patch)
treefcf1667f92152ede4a0b66b01626ad1ecc8ab92f /libs
parent2b351b2fc33cf6e5642fbd1f47984189374fe0e4 (diff)
downloadlibrebootfr-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-xlibs/git25
1 files changed, 24 insertions, 1 deletions
diff --git a/libs/git b/libs/git
index a83f2246..6fbd2302 100755
--- a/libs/git
+++ b/libs/git
@@ -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() {