[PATCH v3 06/22] checkout: check_linked_checkout: improve "already checked out" aesthetic
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Jul 17, 2015, 23:00 UTC
- Message-ID
- <1437174017-81687-7-git-send-email-sunshine@sunshineco.com>
- In-Reply-To
- <1437174017-81687-1-git-send-email-sunshine@sunshineco.com>
When check_linked_checkout() discovers that the branch is already checked out elsewhere, it emits the diagnostic:
'blorp' is already checked out at '/some/path/.git'
which is misleading since "checked out at" implies the working tree, but ".git" is the location of the repository administrative files. Fix by dropping ".git" from the message.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> ---
Changes since v2: strip only trailing ".git" rather than "/.git" from "already checked" diagnostic[1]; reword commit message to better emphasize that trailing ".git" is more than a mere cosmetic issue[1]
[1]: http://article.gmane.org/gmane.comp.version-control.git/274035
builtin/checkout.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/builtin/checkout.c b/builtin/checkout.c index 177ad6a..de6619f 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -909,6 +909,7 @@ static void check_linked_checkout(const char *branch, const char *id) } else strbuf_addstr(&gitdir, get_git_common_dir()); skip_prefix(branch, "refs/heads/", &branch); + strbuf_strip_suffix(&gitdir, ".git"); die(_("'%s' is already checked out at '%s'"), branch, gitdir.buf); done: strbuf_release(&path);
-- 2.5.0.rc2.378.g0af52e8