From: Matthias Lederhofer <matled@gmx.net>
To: git@vger.kernel.org
Subject: git repack -a -d is not safe
Date: Thu, 1 Feb 2007 12:25:45 +0100 [thread overview]
Message-ID: <20070201112545.GA19855@moooo.ath.cx> (raw)
First the object is unpacked, start something using read_sha1_file.
read_sha1_file: try packed object (fails)
run git repack -a -d
read_sha1_file: try to read the loose object (fails)
read_sha1_file: reread list of packs
run git repack -a -d so it will create a new pack
read_sha1_file: tries to open the old packs, not the new one, and
fails
Anyway this is quite improbable because normally a read_sha1_file is
much faster than git repack -a -d.
gdb commands to do that:
shell git init
shell seq 1 10 > a
shell git add a
shell git commit -m first
file git-cat-file
break read_sha1_file
run -p HEAD:a
next
next
shell git repack -a -d
next
next
next
shell seq 11 20 >> a
shell git add a
shell git commit -m second
shell git repack -a -d
continue
gdb session running the commands:
GNU gdb 6.4.90-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu".
$ shell git init
Initialized empty Git repository in .git/
$ shell seq 1 10 > a
$ shell git add a
$ shell git commit -m first
Created initial commit c520a6d82591b2c6654abe65418a2223302f927b
1 files changed, 10 insertions(+), 0 deletions(-)
create mode 100644 a
$ file git-cat-file
Reading symbols from /home/matled/local/bin/git-cat-file...done.
Using host libthread_db library "/lib/tls/i686/cmov/libthread_db.so.1".
$ break read_sha1_file
Breakpoint 1 at 0x8098959: file sha1_file.c, line 1483.
$ run -p HEAD:a
Starting program: /home/matled/local/bin/git-cat-file -p HEAD:a
warning: Lowest section in system-supplied DSO at 0xffffe000 is .hash at ffffe0b4
Breakpoint 1, read_sha1_file (sha1=0xffcc0db8 "Å ¦Ø%\221²ÆeJ¾eA\212\"#0/\222{", type=0xffcc0dd0 "ÿÿÿÿ", size=0xffcc0dcc)
at sha1_file.c:1483
1483 buf = read_packed_sha1(sha1, type, size);
$ next
1484 if (buf)
$ next
1486 map = map_sha1_file(sha1, &mapsize);
$ shell git repack -a -d
Generating pack...
Done counting 3 objects.
Deltifying 3 objects.
100% (3/3) done
Writing 3 objects.
100% (3/3) done
Total 3 (delta 0), reused 0 (delta 0)
Pack pack-fcbc60879b35995a9b532543a3b072b83a50b510 created.
Removing unused objects 100%...
Done.
$ next
1487 if (map) {
$ next
1492 reprepare_packed_git();
$ next
1493 return read_packed_sha1(sha1, type, size);
$ shell seq 11 20 >> a
$ shell git add a
$ shell git commit -m second
Created commit 0bc9af2dfb8538abf9247ae282d0a2bd0cfc7b0d
1 files changed, 10 insertions(+), 0 deletions(-)
$ shell git repack -a -d
Generating pack...
Done counting 6 objects.
Deltifying 6 objects.
100% (6/6) done
Writing 6 objects.
100% (6/6) done
Total 6 (delta 0), reused 3 (delta 0)
Pack pack-ad55ad59fa078c3261550ebd9adf0035cf89fa63 created.
Removing unused objects 100%...
Done.
$ continue
Continuing.
fatal: packfile .git/objects/pack/pack-fcbc60879b35995a9b532543a3b072b83a50b510.pack cannot be opened
Program exited with code 0200.
$
next reply other threads:[~2007-02-01 11:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-01 11:25 Matthias Lederhofer [this message]
2007-02-01 20:59 ` git repack -a -d is not safe Shawn O. Pearce
2007-02-01 23:26 ` Johannes Schindelin
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=20070201112545.GA19855@moooo.ath.cx \
--to=matled@gmx.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).