mirror of
https://github.com/git/git.git
synced 2026-03-13 10:23:30 +01:00
Cpio emulator: do not copy files repeatedly in pass-through mode.
Files were stored each time when they were mentioned in the file list as well as for each of its directories and parent directories. Now we filter out directory names because they are implied for the files that they contain, but we do list empty directories. The only case where this is relevant is the pass-through mode that git clone of a local directory uses.
This commit is contained in:
17
cpio.sh
17
cpio.sh
@@ -24,12 +24,27 @@ while test $# -gt 0; do
|
||||
shift
|
||||
done
|
||||
|
||||
filterdirs() {
|
||||
while read f; do
|
||||
if test -d "$f"; then
|
||||
# list only empty directories
|
||||
if test -z "$(ls -A "$f")"; then
|
||||
echo "$f"
|
||||
fi
|
||||
else
|
||||
echo "$f"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
case $mode in
|
||||
o)
|
||||
tar --create --file=- $null --files-from=-
|
||||
;;
|
||||
p)
|
||||
tar --create --file=- $null --files-from=- |
|
||||
test -z "$null" || die "cpio: cannot use -0 in pass-through mode"
|
||||
filterdirs |
|
||||
tar --create --file=- --files-from=- |
|
||||
tar --extract --directory="$dir" --file=-
|
||||
;;
|
||||
*)
|
||||
|
||||
Reference in New Issue
Block a user