Skip to content

Commit

Permalink
git-repack: Properly abort in corrupt repository
Browse files Browse the repository at this point in the history
In a corrupt repository, git-repack produces a pack that does not
contain needed objects without complaining, and the result of this
combined with -d flag can be very painful -- e.g. a lossage of one
tree object can lead to lossage of blobs reachable only through that
tree.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Linus Torvalds authored and Junio C Hamano committed Nov 21, 2005
1 parent b17e659 commit ef07618
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion git-repack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ esac
if [ "$local" ]; then
pack_objects="$pack_objects --local"
fi
name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) |
name=$(git-rev-list --objects $rev_list $(git-rev-parse $rev_parse) 2>&1 |
git-pack-objects --non-empty $pack_objects .tmp-pack) ||
exit 1
if [ -z "$name" ]; then
Expand Down
2 changes: 1 addition & 1 deletion pack-objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ int main(int argc, char **argv)
unsigned char sha1[20];

if (get_sha1_hex(line, sha1))
die("expected sha1, got garbage");
die("expected sha1, got garbage:\n %s", line);
hash = 0;
p = line+40;
while (*p) {
Expand Down

0 comments on commit ef07618

Please sign in to comment.