summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2017-10-01 09:29:03 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-10-01 17:27:14 +0900
commitefbd4fdfc9978bf3872ca8cf390da4ffa3480188 (patch)
treeb3e8b62af87e612724c2b4a95dc2cbf1c94f6e90 /builtin
parentrefs: pass NULL to refs_resolve_refdup() if hash is not needed (diff)
downloadtgif-efbd4fdfc9978bf3872ca8cf390da4ffa3480188.tar.xz
refs: pass NULL to resolve_refdup() if hash is not needed
This allows us to get rid of several write-only variables. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c3
-rw-r--r--builtin/receive-pack.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 5c202b7af5..531f7720f3 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -1116,9 +1116,8 @@ static int checkout_branch(struct checkout_opts *opts,
if (new->path && !opts->force_detach && !opts->new_branch &&
!opts->ignore_other_worktrees) {
- struct object_id oid;
int flag;
- char *head_ref = resolve_refdup("HEAD", 0, oid.hash, &flag);
+ char *head_ref = resolve_refdup("HEAD", 0, NULL, &flag);
if (head_ref &&
(!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
die_if_checked_out(new->path, 1);
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 65d89078ab..65e38a7277 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1458,7 +1458,6 @@ static void execute_commands(struct command *commands,
{
struct check_connected_options opt = CHECK_CONNECTED_INIT;
struct command *cmd;
- struct object_id oid;
struct iterate_data data;
struct async muxer;
int err_fd = 0;
@@ -1515,7 +1514,7 @@ static void execute_commands(struct command *commands,
check_aliased_updates(commands);
free(head_name_to_free);
- head_name = head_name_to_free = resolve_refdup("HEAD", 0, oid.hash, NULL);
+ head_name = head_name_to_free = resolve_refdup("HEAD", 0, NULL, NULL);
if (use_atomic)
execute_commands_atomic(commands, si);