From c57c6b90bf62510d774215abd9f4f816c4d8b789 Mon Sep 17 00:00:00 2001 From: Alad Wenter Date: Mon, 22 Jan 2018 16:16:16 +0100 Subject: [PATCH 4/4] aurfetch: specify git work-tree/git-dir (#274) Avoid "Stopping at filesystem boundary" issues with different file systems. --- bin/aurfetch | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bin/aurfetch b/bin/aurfetch index 95c49c3..0a79287 100755 --- a/bin/aurfetch +++ b/bin/aurfetch @@ -8,24 +8,25 @@ declare -i aurball=0 declare logdir=/dev/null clone() { - declare -r logdir=$1 startdir=$PWD + declare -r logdir=$1 while IFS= read -r; do + # Avoid issues with exotic file system layouts (#274) + git_wrap() { git --work-tree="$REPLY" --git-dir="$REPLY"/.git "$@"; } + if [[ -d $REPLY/.git ]]; then - cd_safe "$REPLY" + # returns 0 even if nothing was fetched + git_wrap fetch -v - git fetch -v # returns 0 even if nothing was fetched - - if [[ $(git rev-parse HEAD) != $(git rev-parse '@{upstream}') ]]; then + if [[ $(git_wrap rev-parse HEAD) != $(git_wrap rev-parse '@{upstream}') ]]; then if [[ -d $logdir ]]; then - git --no-pager log --patch --stat '..@{upstream}' >> "$logdir/$REPLY".patch + git_wrap --no-pager log --patch --stat '..@{upstream}' \ + >> "$logdir/$REPLY".patch fi - git reset --hard HEAD - git merge + git_wrap reset --hard HEAD + git_wrap merge fi - - cd_safe "$startdir" else git clone "$aurweb/$REPLY".git fi -- 2.16.1