X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-receive-pack.c;h=9f60f31c2bb7da7095de8d692d215c485ab5da0c;hb=20f7a39825e30891056ab00ea620eaffda6aa451;hp=45e3cd90fd476cdb0a32e5de27739b18e060e031;hpb=35d2f73b999636c93049b2d7bed1458bcf2f9648;p=git.git diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c index 45e3cd90f..9f60f31c2 100644 --- a/builtin-receive-pack.c +++ b/builtin-receive-pack.c @@ -466,12 +466,17 @@ static int delete_only(struct command *cmd) static int add_refs_from_alternate(struct alternate_object_database *e, void *unused) { - char *other = xstrdup(make_absolute_path(e->base)); - size_t len = strlen(other); + char *other; + size_t len; struct remote *remote; struct transport *transport; const struct ref *extra; + e->name[-1] = '\0'; + other = xstrdup(make_absolute_path(e->base)); + e->name[-1] = '/'; + len = strlen(other); + while (other[len-1] == '/') other[--len] = '\0'; if (len < 8 || memcmp(other + len - 8, "/objects", 8))