summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:37:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-08-30 16:37:11 +0200
commit8899a8271338ba19f32bae1b30e0df0392afe1bc (patch)
tree6644c5b51a302da9c6f1e35e5478707aa6cc321f
parent7da455da65d4c6ca7c58cf915f158349184373f0 (diff)
Add error handling to git scripts
-rwxr-xr-xgit/branch.sh6
-rwxr-xr-xgit/checkout.sh6
-rwxr-xr-xgit/commit.sh12
-rwxr-xr-xgit/diff.sh13
-rwxr-xr-xgit/fetch.sh6
-rwxr-xr-xgit/pull.sh6
-rwxr-xr-xgit/push.sh5
-rwxr-xr-xgit/rebase.sh6
-rwxr-xr-xgit/remote.sh6
-rwxr-xr-xgit/stash.sh6
-rwxr-xr-xgit/stat.sh6
-rwxr-xr-xgit/tag.sh6
12 files changed, 84 insertions, 0 deletions
diff --git a/git/branch.sh b/git/branch.sh
index 4362fb4..14d72dd 100755
--- a/git/branch.sh
+++ b/git/branch.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "branch $i" 1>&2
cd $i
git branch $*
+
+ if [ $? -ne 0 ]; then
+ echo "branch FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/checkout.sh b/git/checkout.sh
index 2cf5717..11643c4 100755
--- a/git/checkout.sh
+++ b/git/checkout.sh
@@ -16,5 +16,11 @@ for i in $modules; do
echo "checkout $i" 1>&2
cd $i
git checkout $*
+
+ if [ $? -ne 0 ]; then
+ echo "checkout FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/commit.sh b/git/commit.sh
index 16a8076..cc05cf5 100755
--- a/git/commit.sh
+++ b/git/commit.sh
@@ -38,8 +38,20 @@ for i in $modules; do
cd $i
if [ "$add" = "y" ]; then
git add .
+
+ if [ $? -ne 0 ]; then
+ echo "add FAILED" 1>&2
+ exit 1
+ fi
+
fi
git commit -F $msg_file
+
+ if [ $? -ne 0 ]; then
+ echo "commit FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/diff.sh b/git/diff.sh
index 19737e9..bd4639e 100755
--- a/git/diff.sh
+++ b/git/diff.sh
@@ -10,7 +10,20 @@ wd=`pwd`
for i in $modules; do
echo "diff $i" 1>&2
cd $i
+
git --no-pager diff
+
+ if [ $? -ne 0 ]; then
+ echo "diff FAILED" 1>&2
+ exit 1
+ fi
+
git --no-pager diff --check
+
+ if [ $? -ne 0 ]; then
+ echo "diff --check FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/fetch.sh b/git/fetch.sh
index a18be15..185d531 100755
--- a/git/fetch.sh
+++ b/git/fetch.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "fetch $i" 1>&2
cd $i
git fetch $*
+
+ if [ $? -ne 0 ]; then
+ echo "fetch FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/pull.sh b/git/pull.sh
index cf94cf0..07684da 100755
--- a/git/pull.sh
+++ b/git/pull.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "pull $i" 1>&2
cd $i
git pull $*
+
+ if [ $? -ne 0 ]; then
+ echo "pull FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/push.sh b/git/push.sh
index cd1c1b8..d288f3a 100755
--- a/git/push.sh
+++ b/git/push.sh
@@ -25,5 +25,10 @@ for i in $modules; do
git push $ops origin $1
fi
+ if [ $? -ne 0 ]; then
+ echo "push FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/rebase.sh b/git/rebase.sh
index 67313b1..4248048 100755
--- a/git/rebase.sh
+++ b/git/rebase.sh
@@ -16,5 +16,11 @@ for i in $modules; do
echo "rebase $i" 1>&2
cd $i
git rebase $*
+
+ if [ $? -ne 0 ]; then
+ echo "rebase FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/remote.sh b/git/remote.sh
index 8d67450..acc1e4a 100755
--- a/git/remote.sh
+++ b/git/remote.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "remote $i" 1>&2
cd $i
git remote $*
+
+ if [ $? -ne 0 ]; then
+ echo "remote FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/stash.sh b/git/stash.sh
index 63a6022..139f294 100755
--- a/git/stash.sh
+++ b/git/stash.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "stash $i" 1>&2
cd $i
git stash $*
+
+ if [ $? -ne 0 ]; then
+ echo "stash FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/stat.sh b/git/stat.sh
index 39eb081..5b9ea45 100755
--- a/git/stat.sh
+++ b/git/stat.sh
@@ -11,5 +11,11 @@ for i in $modules; do
echo "stat $i" 1>&2
cd $i
git status
+
+ if [ $? -ne 0 ]; then
+ echo "stat FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done
diff --git a/git/tag.sh b/git/tag.sh
index 99ba938..935934f 100755
--- a/git/tag.sh
+++ b/git/tag.sh
@@ -16,5 +16,11 @@ for i in $modules; do
echo "tag $i" 1>&2
cd $i
git tag -a $1 -m "Tag version $1"
+
+ if [ $? -ne 0 ]; then
+ echo "tag FAILED" 1>&2
+ exit 1
+ fi
+
cd $wd
done