aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-09-15 03:39:50 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-09-15 03:39:50 +0200
commit257029ab098eccb41e26d2291ac99ee48f40d058 (patch)
tree24f25cf3c247148ce3150572b680f5a2680ee99f
parenta0ae430f01bb8ab0a98cce2203435a286dd89ff7 (diff)
Detect no changes situation in add script
-rwxr-xr-xadd4
1 files changed, 4 insertions, 0 deletions
diff --git a/add b/add
index b99da32..3ff0270 100755
--- a/add
+++ b/add
@@ -38,6 +38,10 @@ modified="$(git status --porcelain | sed -n -e 's/^ M \(.*\)/\1/p')"
uc="$(echo "$untracked" | wc -w)"
mc="$(echo "$modified" | wc -w)"
+if [ "$uc" -eq 0 -a "$mc" -eq 0 ]; then
+ error "error: nothing untracked/modified"
+fi
+
if [ "$uc" -gt 0 -a "$mc" -gt 0 ]; then
error "error: multiple untracked/modified files"
fi