summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-13 19:41:40 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-13 19:41:40 +0100
commit7c63a33ffe1198b77b481974cd0e74e9ace1745c (patch)
treea5eee6adeaf62b74273a7b996d302d96e6a57dc7 /src
parentdccf59ad385489eef31a2521440bc07e7cc98a5b (diff)
downloadlibgit2-7c63a33ffe1198b77b481974cd0e74e9ace1745c.tar.gz
indexer: bring back the error message on duplcate commits
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.
Diffstat (limited to 'src')
-rw-r--r--src/indexer.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/indexer.c b/src/indexer.c
index 68e903e05..4fb33b6f1 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -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);