summarylogtreecommitdiffstats
path: root/0004-aurfetch-specify-git-work-tree-git-dir-274.patch
blob: 3cb51799f8d323d659a68648b377f9d3b9e649f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From ecc173230584327d74ea2d8899fec30d6ce6340c Mon Sep 17 00:00:00 2001
From: Alad Wenter <AladW@users.noreply.github.com>
Date: Mon, 22 Jan 2018 16:16:16 +0100
Subject: [PATCH 4/7] 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.11.0