diff --git a/.local/bin/scripts/git-moves b/.local/bin/scripts/git-moves index 101a383..77130c1 100755 --- a/.local/bin/scripts/git-moves +++ b/.local/bin/scripts/git-moves @@ -1,5 +1,8 @@ #!/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 +root=$(git rev-parse --show-toplevel) +git add "$root" +git status --porcelain --find-renames=.3 | + grep -vf /tmp/staged | cut -c4- | sed 's/ -> /\n/' | + xargs git -C "$root" restore --staged diff --git a/.local/bin/scripts/roam b/.local/bin/scripts/roam index cdd7677..bd8b4dd 100755 --- a/.local/bin/scripts/roam +++ b/.local/bin/scripts/roam @@ -1,4 +1,8 @@ #!/bin/sh -e # Move roam files into subfolders cd $DATA/2-standards/notes -find . -mindepth 1 -type d -printf '%f\n' | while read dir; do grep -l --directories=skip "#+filetags: :$dir" * | xargs --verbose --no-run-if-empty mv -t "$dir"; done +find . -mindepth 1 -type d -printf '%f\n' | + while read dir; do + grep -l --directories=skip "#+filetags: :$dir" * | + xargs --verbose --no-run-if-empty mv -t "$dir" + done