contrib/diffall: eliminate use of tar
authorTim Henigan <tim.henigan@gmail.com>
Wed, 14 Mar 2012 16:38:04 +0000 (12:38 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Mar 2012 22:20:25 +0000 (15:20 -0700)
The 'tar' utility is not available on all platforms (some only support
'gnutar').  An earlier commit created a work-around for this problem,
but a better solution is to eliminate the use of 'tar' completely.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/diffall/git-diffall

index 443f646a773a89041d8255d29a829fa710af03e0..f981ac1bd373ac12f0f66f4ec41b30a5e85f689f 100755 (executable)
@@ -202,10 +202,14 @@ then
                fi
        done < "$tmp/filelist"
 else
-       # Mac users have gnutar rather than tar
-       (tar --ignore-failed-read -c -T "$tmp/filelist" | (cd "$tmp/$right_dir" && tar -x)) || {
-               gnutar --ignore-failed-read -c -T "$tmp/filelist" | (cd "$tmp/$right_dir" && gnutar -x)
-       }
+       while read name
+       do
+               if test -e "$name"
+               then
+                       mkdir -p "$tmp/$right_dir/$(dirname "$name")"
+                       cp "$name" "$tmp/$right_dir/$name"
+               fi
+       done < "$tmp/filelist"
 fi
 
 # Populate the tmp/left_dir directory with the files to be compared