From: Sam Vilain <sam@vilain.net>
To: git@vger.kernel.org
Subject: [PATCH] repack: allow simultaneous packing and pruning
Date: Tue, 10 Oct 2006 23:14:53 +1300 [thread overview]
Message-ID: <20061010102210.568341380D6@magnus.utsl.gen.nz> (raw)
If using git-repack -a, unreferenced objects are kept behind in the
pack. This might be the best default, but there are no good ways
to clean up the packfiles if a lot of rebasing is happening, or
branches have been deleted.
---
see also http://colabti.de/irclogger/irclogger_log/git?date=2006-10-10,Tue&sel=27#l75
Documentation/git-repack.txt | 7 ++++++-
git-repack.sh | 14 +++++++++++++-
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index 9516227..63ee7cb 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -9,7 +9,7 @@ objects into pack files.
SYNOPSIS
--------
-'git-repack' [-a] [-d] [-f] [-l] [-n] [-q]
+'git-repack' [-a] [-d] [-f] [-l] [-n] [-q] [-p]
DESCRIPTION
-----------
@@ -40,6 +40,11 @@ OPTIONS
existing packs redundant, remove the redundant packs.
Also runs gitlink:git-prune-packed[1].
+-p::
+ Before packing, remove any unreferenced objects with
+ gitlink:git-prune[1]. When used with '-a', unreferenced
+ objects in the old packs are not taken across.
+
-l::
Pass the `--local` option to `git pack-objects`, see
gitlink:git-pack-objects[1].
diff --git a/git-repack.sh b/git-repack.sh
index 640ad8d..a2ad955 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -7,13 +7,14 @@ USAGE='[-a] [-d] [-f] [-l] [-n] [-q]'
. git-sh-setup
no_update_info= all_into_one= remove_redundant=
-local= quiet= no_reuse_delta= extra=
+local= quiet= no_reuse_delta= extra= prune=
while case "$#" in 0) break ;; esac
do
case "$1" in
-n) no_update_info=t ;;
-a) all_into_one=t ;;
-d) remove_redundant=t ;;
+ -p) prune=t ;;
-q) quiet=-q ;;
-f) no_reuse_delta=--no-reuse-delta ;;
-l) local=--local ;;
@@ -32,6 +33,11 @@ case ",$all_into_one," in
,,)
rev_list='--unpacked'
pack_objects='--incremental'
+ if [ -n "$prune" ]
+ then
+ # prune junk first
+ git-prune
+ fi
;;
,t,)
rev_list=
@@ -40,8 +46,14 @@ case ",$all_into_one," in
# Redundancy check in all-into-one case is trivial.
existing=`cd "$PACKDIR" && \
find . -type f \( -name '*.pack' -o -name '*.idx' \) -print`
+
+ if [ -n "$prune" ]
+ then
+ rev_list=`cd "$GIT_DIR" && find refs -type f -print`
+ fi
;;
esac
+
pack_objects="$pack_objects $local $quiet $no_reuse_delta$extra"
name=$(git-rev-list --objects --all $rev_list 2>&1 |
git-pack-objects --non-empty $pack_objects .tmp-pack) ||
--
1.4.2.g0ea2
next reply other threads:[~2006-10-10 10:22 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-10 10:14 Sam Vilain [this message]
2006-10-10 11:04 ` [PATCH] repack: allow simultaneous packing and pruning Sam Vilain
2006-10-10 15:03 ` Linus Torvalds
2006-10-10 19:46 ` Eran Tromer
2006-10-10 21:25 ` Linus Torvalds
2006-10-10 22:09 ` Eran Tromer
2006-10-10 22:27 ` Linus Torvalds
2006-10-10 23:45 ` Eran Tromer
2006-10-10 20:24 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061010102210.568341380D6@magnus.utsl.gen.nz \
--to=sam@vilain.net \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).