From 9d36a94b1ad7c64606a9dc2ed82a48827b29efaf Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Thu, 11 Nov 2021 12:15:41 +0100 Subject: [PATCH] config: improve some flags --- .../{kitty.desktop => kitty.desktop##hostname.elephant-arch} | 0 .config/shell/git | 2 +- .local/bin/scripts/checkaccess | 3 ++- .local/bin/scripts/git-moves | 5 +++++ 4 files changed, 8 insertions(+), 2 deletions(-) rename .config/autostart/{kitty.desktop => kitty.desktop##hostname.elephant-arch} (100%) create mode 100755 .local/bin/scripts/git-moves diff --git a/.config/autostart/kitty.desktop b/.config/autostart/kitty.desktop##hostname.elephant-arch similarity index 100% rename from .config/autostart/kitty.desktop rename to .config/autostart/kitty.desktop##hostname.elephant-arch diff --git a/.config/shell/git b/.config/shell/git index 1bfd973..570bbcd 100644 --- a/.config/shell/git +++ b/.config/shell/git @@ -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/*/}" diff --git a/.local/bin/scripts/checkaccess b/.local/bin/scripts/checkaccess index 6a2fad4..bc2ede4 100755 --- a/.local/bin/scripts/checkaccess +++ b/.local/bin/scripts/checkaccess @@ -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 diff --git a/.local/bin/scripts/git-moves b/.local/bin/scripts/git-moves new file mode 100755 index 0000000..101a383 --- /dev/null +++ b/.local/bin/scripts/git-moves @@ -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