From: Robin Rosenberg <robin.rosenberg.lists@dewire.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
git@vger.kernel.org, spearce@spearce.org
Subject: Re: [PATCH] Make repack less likely to corrupt repository
Date: Thu, 19 Feb 2009 23:21:17 +0100 [thread overview]
Message-ID: <200902192321.17802.robin.rosenberg.lists@dewire.com> (raw)
In-Reply-To: <7vvdrbjwbt.fsf@gitster.siamese.dyndns.org>
Here is a new version on my ammendments to Junios patch.
-- robin
>From 67347a63ce5ba324a750eb2c1ed7b9b0260d966a Mon Sep 17 00:00:00 2001
From: Robin Rosenberg <robin.rosenberg@dewire.com>
Date: Thu, 19 Feb 2009 23:18:59 +0100
Subject: [PATCH] Recover from some known repack failure situations
For the know problems that we can recover from we exit
with code 2 instead of 1.
Also removed the old packs when repack succeeds
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
Documentation/git-repack.txt | 6 ++++++
git-repack.sh | 18 +++++++++++++++++-
2 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-repack.txt b/Documentation/git-repack.txt
index aaa8852..e5ecd66 100644
--- a/Documentation/git-repack.txt
+++ b/Documentation/git-repack.txt
@@ -24,6 +24,12 @@ associated index file.
Packs are used to reduce the load on mirror systems, backup
engines, disk storage, etc.
+On Windows repacking may fail because packs that should be replaced
+are locked by other programs. In this case the program will recover
+from the situation with an exit code of 2. The user does not have
+to take any action to recover. For repacking to succeed the user
+mustc stop the offending program or wait for it to close the packs.
+
OPTIONS
-------
diff --git a/git-repack.sh b/git-repack.sh
index 0f13043..519c83a 100755
--- a/git-repack.sh
+++ b/git-repack.sh
@@ -136,8 +136,15 @@ then
do
echo >&2 "WARNING: old-$file -> $file"
done
+ exit 1
fi
- exit 1
+ echo >&2 "INFO: We recovered from the repack error, but your repo"
+ echo >&2 "INFO: is probably suboptimally packed. You may try to repack"
+ echo >&2 "INFO: later. A common reason for repacking failure is that"
+ echo >&2 "INFO: a Windows program was locking one of the old pack files."
+ echo >&2 "INFO: To repack successfully you may have to close that program"
+ echo >&2 "INFO: before repacking."
+ exit 2
fi
# Now the ones with the same name are out of the way...
@@ -152,6 +159,15 @@ do
exit
done
+# Remove the "old-" files
+for name in $names
+do
+ rm -f "$PACKDIR/old-pack-$name.idx"
+ rm -f "$PACKDIR/old-pack-$name.pack"
+done
+
+# End of pack replacement.
+
if test "$remove_redundant" = t
then
# We know $existing are all redundant.
--
1.6.1.285.g35d8b
next prev parent reply other threads:[~2009-02-19 22:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-09 0:44 [PATCH] Make repack less likely to corrupt repository Robin Rosenberg
2009-02-09 6:04 ` Junio C Hamano
2009-02-10 7:07 ` Robin Rosenberg
2009-02-10 15:59 ` Junio C Hamano
2009-02-10 16:57 ` Robin Rosenberg
2009-02-10 20:16 ` Junio C Hamano
2009-02-10 23:51 ` Robin Rosenberg
2009-02-10 23:56 ` Junio C Hamano
2009-02-11 0:27 ` Robin Rosenberg
2009-02-11 0:31 ` Junio C Hamano
2009-02-11 17:08 ` Robin Rosenberg
2009-02-15 16:15 ` Robin Rosenberg
2009-02-15 16:46 ` Johannes Schindelin
2009-02-15 18:42 ` Robin Rosenberg
2009-02-15 20:09 ` Junio C Hamano
2009-02-16 5:17 ` Robin Rosenberg
2009-02-19 22:21 ` Robin Rosenberg [this message]
2009-02-19 22:44 ` Johannes Schindelin
2009-02-20 0:09 ` Junio C Hamano
2009-02-20 0:09 ` 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=200902192321.17802.robin.rosenberg.lists@dewire.com \
--to=robin.rosenberg.lists@dewire.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.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).