summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Eric Sunshine <sunshine@sunshineco.com>2015-07-17 18:59:57 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-07-20 11:29:24 -0700
commite13d37094e3b2ceb51dab362b8e2e1ad9e4bb758 (patch)
tree303b513fed860c9066092b3178ad0419e713c274
parentcheckout: avoid resolving HEAD unnecessarily (diff)
downloadtgif-e13d37094e3b2ceb51dab362b8e2e1ad9e4bb758.tar.xz
checkout: name check_linked_checkouts() more meaningfully
check_linked_checkouts() doesn't just "check" linked checkouts for "something"; specifically, it aborts the operation if the branch about to be checked out is already checked out elsewhere. Therefore, rename it to die_if_checked_out() to give a better indication of its function. The more meaningful name will be particularly important when this function is later published for use by other callers. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/checkout.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 75f90a9d1e..e75fb5e50f 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -910,7 +910,7 @@ done:
strbuf_release(&gitdir);
}
-static void check_linked_checkouts(struct branch_info *new)
+static void die_if_checked_out(struct branch_info *new)
{
struct strbuf path = STRBUF_INIT;
DIR *dir;
@@ -1152,7 +1152,7 @@ static int checkout_branch(struct checkout_opts *opts,
char *head_ref = resolve_refdup("HEAD", 0, sha1, &flag);
if (head_ref &&
(!(flag & REF_ISSYMREF) || strcmp(head_ref, new->path)))
- check_linked_checkouts(new);
+ die_if_checked_out(new);
free(head_ref);
}