summaryrefslogtreecommitdiff
path: root/builtin-receive-pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-receive-pack.c')
-rw-r--r--builtin-receive-pack.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/builtin-receive-pack.c b/builtin-receive-pack.c
index 45e3cd90fd..9f60f31c2b 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))