summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-07-16 18:17:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-07-16 18:17:08 (GMT)
commit5a3db94539acbf66b9fcf466b5ea7fd53295dc89 (patch)
treea9ce37821d811e0b4c718ad87aa2457d5dfc97c4 /sha1_file.c
parent5c18fde0d96cfcbc321caad8f809028b0c63aaeb (diff)
parent80b47854ca84abec991f6fff42dbeb6626588b87 (diff)
downloadgit-5a3db94539acbf66b9fcf466b5ea7fd53295dc89.zip
git-5a3db94539acbf66b9fcf466b5ea7fd53295dc89.tar.gz
git-5a3db94539acbf66b9fcf466b5ea7fd53295dc89.tar.bz2
Merge branch 'rs/fix-alt-odb-path-comparison' into maint
Code to avoid adding the same alternate object store twice was subtly broken for a long time, but nobody seems to have noticed. * rs/fix-alt-odb-path-comparison: sha1_file: avoid overrunning alternate object base string
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 34d527f..a38854c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -315,7 +315,8 @@ static int link_alt_odb_entry(const char *entry, const char *relative_base, int
* thing twice, or object directory itself.
*/
for (alt = alt_odb_list; alt; alt = alt->next) {
- if (!memcmp(ent->base, alt->base, pfxlen)) {
+ if (pfxlen == alt->name - alt->base - 1 &&
+ !memcmp(ent->base, alt->base, pfxlen)) {
free(ent);
return -1;
}