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

[PATCH 3/8] repack -A -d: use --keep-unreachable when repacking

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 17, 2007, 08:27 UTC
Message-ID
<11900176341630-git-send-email-gitster@pobox.com>
In-Reply-To
<1190017633436-git-send-email-gitster@pobox.com>

This is a safer variant of "repack -a -d" that does not drop unreachable objects that are in packs.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-repack.sh |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/git-repack.sh b/git-repack.sh
index 156c5e8..204084e 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -3,17 +3,19 @@
 # Copyright (c) 2005 Linus Torvalds
 #
 
-USAGE='[-a] [-d] [-f] [-l] [-n] [-q] [--max-pack-size=N] [--window=N] [--window-memory=N] [--depth=N]'
+USAGE='[-a|-A] [-d] [-f] [-l] [-n] [-q] [--max-pack-size=N] [--window=N] [--window-memory=N] [--depth=N]'
 SUBDIRECTORY_OK='Yes'
 . git-sh-setup
 
-no_update_info= all_into_one= remove_redundant=
+no_update_info= all_into_one= remove_redundant= keep_unreachable=
 local= quiet= no_reuse= extra=
 while case "$#" in 0) break ;; esac
 do
 	case "$1" in
 	-n)	no_update_info=t ;;
 	-a)	all_into_one=t ;;
+	-A)	all_into_one=t
+		keep_unreachable=t ;;
 	-d)	remove_redundant=t ;;
 	-q)	quiet=-q ;;
 	-f)	no_reuse=--no-reuse-object ;;
@@ -59,7 +61,13 @@ case ",$all_into_one," in
 			fi
 		done
 	fi
-	[ -z "$args" ] && args='--unpacked --incremental'
+	if test -z "$args"
+	then
+		args='--unpacked --incremental'
+	elif test -n "$keep_unreachable"
+	then
+		args="$args --keep-unreachable"
+	fi
 	;;
 esac
 
-- 
1.5.3.1.967.g6bb01
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 9 in “Updated git-gc --auto series.”
  1. 0/8 Updated git-gc --auto series.Junio C Hamano, Sep 17, 2007
  2. 1/8 Export matches_pack_name() and fix its return valueJunio C Hamano, Sep 17, 2007
  3. 2/8 pack-objects --keep-unreachableJunio C Hamano, Sep 17, 2007
  4. 3/8 repack -A -d: use --keep-unreachable when repackingJunio C Hamano, Sep 17, 2007
  5. 4/8 git-gc --auto: move threshold check to need_to_gc() function.Junio C Hamano, Sep 17, 2007
  6. 5/8 git-gc --auto: add documentation.Junio C Hamano, Sep 17, 2007
  7. 6/8 git-gc --auto: protect ourselves from accumulated cruftJunio C Hamano, Sep 17, 2007
  8. 7/8 git-gc --auto: restructure the way "repack" command line is built.Junio C Hamano, Sep 17, 2007
  9. 8/8 git-gc --auto: run "repack -A -d -l" as necessary.Junio C Hamano, Sep 17, 2007

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.