config: improve some flags

This commit is contained in:
xeruf 2021-11-11 12:15:41 +01:00
parent d0b361c748
commit 9d36a94b1a
4 changed files with 8 additions and 2 deletions

View File

@ -16,7 +16,7 @@ gcn() {
root="$(git rev-parse --show-toplevel)"
if test "$root" = "$DATA"
then
if test $# -eq 0 || test -e $1
if test $# -eq 0 || test -e "$1"
then
fulldir="$(realpath ${1:-$PWD})"
dir="${fulldir#$root/*/}"

View File

@ -9,5 +9,6 @@ while test $# -gt 1; do
while ! test -e "$dir"
do dir="$(dirname "$dir")"
done
test $flag "$dir"
test -L "$dir" ||
test $flag "$dir"
done

5
.local/bin/scripts/git-moves Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
# Stage moved files fitting the already staged ones
git diff --name-only --cached >/tmp/staged
git add $(git rev-parse --show-toplevel)
git status -s | tail +2 | grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | xargs git restore --staged