summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-04-10 13:38:06 -0700
committerMichael Forney <mforney@mforney.org>2016-04-15 02:10:08 -0700
commitc6317771d2759338f715ee776744610044c1e3a3 (patch)
treee5af441d5461184aa2a1ac65f6933bedb675d44c /scripts
parentcbc30a0b326784e17bb0cdfd8bb82102886dfc08 (diff)
scripts: Check status of commands with captured output
Diffstat (limited to 'scripts')
-rw-r--r--scripts/hash.rc6
-rw-r--r--scripts/tree.rc7
2 files changed, 12 insertions, 1 deletions
diff --git a/scripts/hash.rc b/scripts/hash.rc
index 9b715308..3d7235d7 100644
--- a/scripts/hash.rc
+++ b/scripts/hash.rc
@@ -8,6 +8,11 @@ mode=$3
name=$4
shift 4
+fn checkstatus {
+ s=$status if(! ~ $s '' '|') exit $s
+ status=()
+}
+
hash=`{
switch($mode) {
case 120???
@@ -16,6 +21,7 @@ hash=`{
git -C $repo hash-object -w --stdin <$1
}
}
+checkstatus
printf '%s %s\t%s\n' $mode $hash $name >$out.tmp
mv $out.tmp $out
diff --git a/scripts/tree.rc b/scripts/tree.rc
index ed7a81bb..1ace9935 100644
--- a/scripts/tree.rc
+++ b/scripts/tree.rc
@@ -6,10 +6,15 @@ repo=$1
tag=$2
shift 2
+fn checkstatus {
+ s=$status if(! ~ $s '' '|') exit $s
+ status=()
+}
+
ifs=() { oldpwd=`{pwd | head -c -1} }
cd $repo
git read-tree --empty
cat $oldpwd/$* | git update-index --index-info
-tree=`{git write-tree}
+tree=`{git write-tree} ; checkstatus
git update-ref refs/tags/$tag $tree