summaryrefslogtreecommitdiff
path: root/builtin/receive-pack.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-12-13 14:17:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-12-13 17:26:52 (GMT)
commit96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db (patch)
tree6957ce802074c55c0973c8533dbd399a314ecc55 /builtin/receive-pack.c
parente4776bd936aa162b7f00cb26260dc4a6ca444abb (diff)
downloadgit-96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db.zip
git-96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db.tar.gz
git-96ec7b1e708863d0cd6b8e72a986d6f0a1bb64db.tar.bz2
Convert resolve_ref+xstrdup to new resolve_refdup function
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/receive-pack.c')
-rw-r--r--builtin/receive-pack.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index b6d957c..62afac3 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -37,6 +37,7 @@ static int prefer_ofs_delta = 1;
static int auto_update_server_info;
static int auto_gc = 1;
static const char *head_name;
+static void *head_name_to_free;
static int sent_capabilities;
static enum deny_action parse_deny_action(const char *var, const char *value)
@@ -695,10 +696,8 @@ static void execute_commands(struct command *commands, const char *unpacker_erro
check_aliased_updates(commands);
- free((char *)head_name);
- head_name = resolve_ref("HEAD", sha1, 0, NULL);
- if (head_name)
- head_name = xstrdup(head_name);
+ free(head_name_to_free);
+ head_name = head_name_to_free = resolve_refdup("HEAD", sha1, 0, NULL);
for (cmd = commands; cmd; cmd = cmd->next)
if (!cmd->skip_update)