git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] repack: find -> /usr/bin/find, as for cygwin

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Mar 19, 2011, 15:50 UTC
Message-ID
<4D84D0C0.7080808@lsrfire.ath.cx>
In-Reply-To
<AANLkTimPbz2s=Maafhqg-7wOk_TT4fFSh7AQ-3rWY0A3@mail.gmail.com>
Am 19.03.2011 13:18, schrieb Nguyen Thai Ngoc Duy:
Show 11 quoted lines
> On Sat, Mar 19, 2011 at 7:08 PM, ryenus ◇<ryenus@gmail.com>  wrote:
>> -               for e in `cd "$PACKDIR"&&  find . -type f -name '*.pack' \
>> +               for e in `cd "$PACKDIR"&&  /usr/bin/find . -type f
> 
> I'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
Previous: Nguyen Thai Ngoc DuyNext: Nguyen Thai Ngoc Duy
Message 3 of 14 in “repack: find -> /usr/bin/find, as for cygwin”
  1. repack: find -> /usr/bin/find, as for cygwinryenus ◇, Mar 19, 2011
  2. Nguyen Thai Ngoc DuyMar 19, 2011
  3. René ScharfeMar 19, 2011
  4. Nguyen Thai Ngoc DuyMar 19, 2011
  5. Nguyen Thai Ngoc DuyMar 19, 2011
  6. ryenus ◇Mar 19, 2011
  7. ryenus ◇Mar 19, 2011
  8. Nguyen Thai Ngoc DuyMar 19, 2011
  9. Junio C HamanoMar 19, 2011
  10. ryenus ◇Mar 20, 2011
  11. ryenus ◇Mar 20, 2011
  12. Matthieu MoyMar 20, 2011
  13. ryenus ◇Mar 20, 2011
  14. Erik Faye-LundMar 21, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.