Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
discard revindex data when pack list changes
author
Nicolas Pitre
<nico@cam.org>
Fri, 22 Aug 2008 19:45:53 +0000
(15:45 -0400)
committer
Junio C Hamano
<gitster@pobox.com>
Sat, 23 Aug 2008 05:00:22 +0000
(22:00 -0700)
This is needed to fix verify-pack -v with multiple pack arguments.
Also, in theory, revindex data (if any) must be discarded whenever
reprepare_packed_git() is called. In practice this is hard to trigger
though.
Signed-off-by: Nicolas Pitre <nico@cam.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-verify-pack.c
patch
|
blob
|
history
pack-revindex.c
patch
|
blob
|
history
pack-revindex.h
patch
|
blob
|
history
sha1_file.c
patch
|
blob
|
history
t/t5300-pack-object.sh
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
a81892d
)
diff --git
a/builtin-verify-pack.c
b/builtin-verify-pack.c
index f4ac595695b1fff1317ff7d14ea9427780327aea..25a29f11a4b9642c1bd367b81779d8f09ae04604 100644
(file)
--- a/
builtin-verify-pack.c
+++ b/
builtin-verify-pack.c
@@
-1,7
+1,7
@@
#include "builtin.h"
#include "cache.h"
#include "pack.h"
#include "builtin.h"
#include "cache.h"
#include "pack.h"
-
+#include "pack-revindex.h"
#define MAX_CHAIN 50
#define MAX_CHAIN 50
@@
-129,6
+129,7
@@
int cmd_verify_pack(int argc, const char **argv, const char *prefix)
else {
if (verify_one_pack(argv[1], verbose))
err = 1;
else {
if (verify_one_pack(argv[1], verbose))
err = 1;
+ discard_revindex();
nothing_done = 0;
}
argc--; argv++;
nothing_done = 0;
}
argc--; argv++;
diff --git
a/pack-revindex.c
b/pack-revindex.c
index cd300bdff5b524a4d509ba5276e9ef21f443013d..6096b6224ad551086afa346617eb714c15a51f78 100644
(file)
--- a/
pack-revindex.c
+++ b/
pack-revindex.c
@@
-142,3
+142,15
@@
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs)
} while (lo < hi);
die("internal error: pack revindex corrupt");
}
} while (lo < hi);
die("internal error: pack revindex corrupt");
}
+
+void discard_revindex(void)
+{
+ if (pack_revindex_hashsz) {
+ int i;
+ for (i = 0; i < pack_revindex_hashsz; i++)
+ if (pack_revindex[i].revindex)
+ free(pack_revindex[i].revindex);
+ free(pack_revindex);
+ pack_revindex_hashsz = 0;
+ }
+}
diff --git
a/pack-revindex.h
b/pack-revindex.h
index 36a514a6cf600e7e77794e50998a9d160e30c8e9..8d5027ad917224f689e786e9a0b4e9a387e59dfe 100644
(file)
--- a/
pack-revindex.h
+++ b/
pack-revindex.h
@@
-7,5
+7,6
@@
struct revindex_entry {
};
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs);
};
struct revindex_entry *find_pack_revindex(struct packed_git *p, off_t ofs);
+void discard_revindex(void);
#endif
#endif
diff --git
a/sha1_file.c
b/sha1_file.c
index 32e4664b1b52542bbd77218a4b88cef610f49649..477d3fb4b06bcbcdd3f75a9e48d5945f91e1f3e6 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-990,6
+990,7
@@
void prepare_packed_git(void)
void reprepare_packed_git(void)
{
void reprepare_packed_git(void)
{
+ discard_revindex();
prepare_packed_git_run_once = 0;
prepare_packed_git();
}
prepare_packed_git_run_once = 0;
prepare_packed_git();
}
diff --git
a/t/t5300-pack-object.sh
b/t/t5300-pack-object.sh
index 645583f9d729cb04ea7bd9638b0c49c48128822e..83abe5f25eb4eb0627d47c233be27f1dd77d4455 100755
(executable)
--- a/
t/t5300-pack-object.sh
+++ b/
t/t5300-pack-object.sh
@@
-186,6
+186,12
@@
test_expect_success \
test-2-${packname_2}.idx \
test-3-${packname_3}.idx'
test-2-${packname_2}.idx \
test-3-${packname_3}.idx'
+test_expect_success \
+ 'verify pack -v' \
+ 'git verify-pack -v test-1-${packname_1}.idx \
+ test-2-${packname_2}.idx \
+ test-3-${packname_3}.idx'
+
test_expect_success \
'verify-pack catches mismatched .idx and .pack files' \
'cat test-1-${packname_1}.idx >test-3.idx &&
test_expect_success \
'verify-pack catches mismatched .idx and .pack files' \
'cat test-1-${packname_1}.idx >test-3.idx &&