Re: [PATCH] repack: find -> /usr/bin/find, as for cygwin
From: René Scharfe <hidden>
Date: 2016-06-15 22:50:49
Subsystem:
the rest · Maintainer:
Linus Torvalds
Am 19.03.2011 13:18, schrieb Nguyen Thai Ngoc Duy:
On Sat, Mar 19, 2011 at 7:08 PM, ryenus ◇[off-list ref] wrote:quoted
- for e in `cd "$PACKDIR"&& find . -type f -name '*.pack' \ + for e in `cd "$PACKDIR"&& /usr/bin/find . -type fI'd rather have something like in test-lib.sh (with conditions) find() { /usr/bin/find "$@" } Even better, rewrite this script to C.
That's a good idea, but it's a lot more involved than the original patch. Do we need to support pack files in subdirectories of $PACKDIR? If not -- and I don't immediately see why, except that the current code does with its find call -- then the following patch might be a quick bandaid. Untested, please be careful. René git-repack.sh | 19 ++++++++++--------- 1 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/git-repack.sh b/git-repack.sh
index 624feec..4e49079 100755
--- a/git-repack.sh
+++ b/git-repack.sh@@ -64,15 +64,16 @@ case ",$all_into_one," in ,t,) args= existing= if [ -d "$PACKDIR" ]; then - for e in `cd "$PACKDIR" && find . -type f -name '*.pack' \ - | sed -e 's/^\.\///' -e 's/\.pack$//'` - do - if [ -e "$PACKDIR/$e.keep" ]; then - : keep - else - existing="$existing $e" - fi - done + existing=$( + cd "$PACKDIR" && + for e in *.pack + do + if test -f "$e" -a ! -e "${e%.pack}.keep" + then + echo "${e%.pack}" + fi + done + ) if test -n "$existing" -a -n "$unpack_unreachable" -a \ -n "$remove_redundant" then