From 257029ab098eccb41e26d2291ac99ee48f40d058 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 15 Sep 2016 03:39:50 +0200 Subject: Detect no changes situation in add script --- add | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'add') 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 -- cgit v1.1