]> git.proxmox.com Git - libgit2.git/commitdiff
indexer: bring back the error message on duplcate commits
authorCarlos Martín Nieto <cmn@dwim.me>
Fri, 13 Mar 2015 18:41:40 +0000 (19:41 +0100)
committerCarlos Martín Nieto <cmn@dwim.me>
Fri, 13 Mar 2015 18:41:40 +0000 (19:41 +0100)
It turns out that erroring out on duplicate commits is the right thing
to do, but git was not hitting the bug on the server-side.

Bring back a descriptive error message in case of duplicate entries and
error out.

src/indexer.c

index 68e903e05716932d8f80e913d5ff9b88614c7023..4fb33b6f169f46a6915da1e7c77b834c009385c5 100644 (file)
@@ -293,6 +293,13 @@ static int store_object(git_indexer *idx)
                goto on_error;
        }
 
+       if (error == 0) {
+               giterr_set(GITERR_INDEXER, "duplicate object %s found in pack", git_oid_tostr_s(&pentry->sha1));
+               git__free(pentry);
+               goto on_error;
+       }
+
+
        kh_value(idx->pack->idx_cache, k) = pentry;
 
        git_oid_cpy(&entry->oid, &oid);