about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-07-23 08:39:44 -0700
committerKartik Agaram <vc@akkartik.com>2018-07-23 08:39:44 -0700
commit0864900cfd5201924f00b20c479a89f94d824d41 (patch)
tree4045fd1e3ddf96f5cbd72066decbe50e84dac0bd
parent026ed1af761c592933997e2192da598af3306040 (diff)
downloadmu-0864900cfd5201924f00b20c479a89f94d824d41.tar.gz
4388
Abort relayout if we exit with `:cquit`.
-rwxr-xr-xrelayout7
1 files changed, 6 insertions, 1 deletions
diff --git a/relayout b/relayout
index 921fda9c..8ea48920 100755
--- a/relayout
+++ b/relayout
@@ -5,6 +5,8 @@
 # Assumes there's only ever one file with any numeric prefix. If you move
 # 003trace.test.cc you might need to do some manual patch-up.
 
+set -e
+
 if [[ $# -eq 0 && `git diff HEAD |wc -l` -gt 0 ]]
 then
   echo "Uncommitted changes"
@@ -24,7 +26,6 @@ index=0
 ls [0-9]* |grep -v "trace.test" |sort -n |
   while read file
   do
-    echo $file >&2
     while [[ $file != `printf "%03d" $index`* ]]
     do
       echo
@@ -51,6 +52,7 @@ cat .layout |
       newfile=`printf "%03d" $index``root $file`
       if [[ $newfile != $file ]]
       then
+        echo git mv $file $newfile
         git mv $file $newfile
       fi
     fi
@@ -58,3 +60,6 @@ cat .layout |
   done
 
 rm .layout
+
+# Scenarios considered:
+#   Don't redo the layout if Vim exits with error.