Merge branch 'rs/resolve-ref-optional-result'

Code clean-up.

* rs/resolve-ref-optional-result:
  refs: pass NULL to resolve_refdup() if hash is not needed
  refs: pass NULL to refs_resolve_refdup() if hash is not needed
This commit is contained in:
Junio C Hamano
2017-10-05 13:48:19 +09:00
7 changed files with 9 additions and 20 deletions

View File

@ -1124,9 +1124,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);