diff options
| author | Junio C Hamano <gitster@pobox.com> | 2011-12-05 15:13:42 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2011-12-05 15:13:42 -0800 |
| commit | 33fba9c64e305c64b4d6f4c31f02c1dd7e8fbfa8 (patch) | |
| tree | 75858cfa2826a36fc8904dccae081df569b8477d /pack-write.c | |
| parent | cd17abdf75207e01bb716c2c7c9f62e56f2f0fdb (diff) | |
| parent | 68be2fea50e7a34c0e5f9fdf6adb9040c8df197f (diff) | |
| download | git-33fba9c64e305c64b4d6f4c31f02c1dd7e8fbfa8.tar.xz | |
Merge branch 'jc/index-pack-reject-dups'
* jc/index-pack-reject-dups:
receive-pack, fetch-pack: reject bogus pack that records objects twice
Diffstat (limited to 'pack-write.c')
| -rw-r--r-- | pack-write.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/pack-write.c b/pack-write.c index 9cd3bfbb4b..f84adde3eb 100644 --- a/pack-write.c +++ b/pack-write.c @@ -129,6 +129,10 @@ const char *write_idx_file(const char *index_name, struct pack_idx_entry **objec } sha1write(f, obj->sha1, 20); git_SHA1_Update(&ctx, obj->sha1, 20); + if ((opts->flags & WRITE_IDX_STRICT) && + (i && !hashcmp(list[-2]->sha1, obj->sha1))) + die("The same object %s appears twice in the pack", + sha1_to_hex(obj->sha1)); } if (index_version >= 2) { |
