Code

Merge branch 'jc/stream-to-pack'
[git.git] / pack-write.c
index cadc3e1adf5748020d7fec23b657cb9c36728258..de2bd01414f07cb2d3fb9d212895ad0f1ea1ba26 100644 (file)
@@ -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) {