]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
vcs/gitconfig: support older gits without `stash push`
authorSimon Ruderich <simon@ruderich.org>
Sat, 7 Jul 2018 06:19:44 +0000 (08:19 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sat, 7 Jul 2018 06:19:44 +0000 (08:19 +0200)
Broken in 4fc2ad6 ("vcs/gitconfig: replace "stash save" with "stash
push" in aliases", 2018-06-13).

vcs/setup.sh

index 8ea39ac39c5b1f81a1f266203a70dbf1e0038d51..3c04f595a54012dc696e50268aa19a2106384e31 100755 (executable)
@@ -42,6 +42,12 @@ if installed git; then
         sed_i 's/log --patch/log -p/' gitconfig
     fi
 
+    if git stash push -- doesnt-exist 2>&1 \
+            | grep 'usage: git stash list' > /dev/null; then
+        echo 'gitconfig: replacing "stash push" with "stash save"'
+        sed_i 's/stash push/stash save/g' gitconfig
+    fi
+
     # If coloredstderr is used to color stderr then remove the workaround for
     # missing output to stderr.
     if test -n "${LD_PRELOAD:+set}" \