Re: [PATCH 3/6] git-gnu-progs-Makefile: git Makefile update
- From
Junio C Hamano <junkio@cox.net>
- Date
- Jul 11, 2005, 20:14 UTC
- Message-ID
- <7virzhrtfy.fsf@assigned-by-dhcp.cox.net>
- In-Reply-To
- <42D2CBA2.8060705@yahoo.com>
Bryan Larsen <bryanlarsen@yahoo.com> writes:
> Last night, I couldn't think of alternatives to these, but I obviously > didn't try very hard. xargs -r can probably happen via a temporary > file and cp -u can probably be simulated using rsync.
The only user of "xargs -r" in the Linus GIT is git-prune-script which tries not to run "rm -f" with an empty argument list, like this:
git-fsck-cache --cache --unreachable "$@" |
sed -ne '/unreachable /{
s/unreachable [^ ][^ ]* //
s|\(..\)|\1/|p
}' | {
cd "$GIT_OBJECT_DIRECTORY" || exit
xargs -r $dryrun rm -f
}Not tested on a BSD, and it is probably as ugly as it can get, but we could:
{
echo 'unreachable nosuch/file';
git-fsck-cache --cache --unreachable "$@"
} |
sed -ne '/unreachable /{
s/unreachable [^ ][^ ]* //
s|\(..\)|\1/|p
}' | {
cd "$GIT_OBJECT_DIRECTORY" || exit
xargs $dryrun rm -f
}The only user of "cp -l" in the Linus GIT is git-clone-script local optimization. I could revert it to the version that I originally sent to the list, which uses cpio -pld, if your cpio groks that flag.
I do not speak for Pasky, but to me "cp -u" sounds just like an optimization, so maybe defining CP_U='cp -u' and detect missing support at config time and falling back on the simple "cp" would be an option?
GNU "cp -a" states that is the same as "-dpR" (never follow symlinks, preserve link, mode, ownership, and timestamps), so that can be rewritten as a shell function in cg-Xlib that is called say cg_copy_tree, whose implementation runs two tar processes piped together when "cp -a" is not available. Using a tarpipe unconditionally is also fine.