Re: [PATCH v2 2/6] checkout: describe_detached_head: remove ellipsis after committish
- From
Ann T Ropea <bedhanger@gmx.de>
- Date
- Nov 13, 2017, 22:36 UTC
- Message-ID
- <20171113223654.27732-2-bedhanger@gmx.de>
- In-Reply-To
- <20171113223654.27732-1-bedhanger@gmx.de>
We do not want an ellipsis displayed following an (abbreviated) SHA-1 value.
The days when this was necessary to indicate the truncation to lower-level Git commands and/or the user are bygone.
However, to ease the transition, the ellipsis will still be printed if the user (actively!) sets the config option core.printsha1ellipsis to true.
Signed-off-by: Ann T Ropea <bedhanger@gmx.de> --- v2: rename patch series & focus on removal of ellipses builtin/checkout.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c index 6c2b4cd419a4..101a16a14a76 100644 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@ -402,8 +402,13 @@ static void describe_detached_head(const char *msg, struct commit *commit) struct strbuf sb = STRBUF_INIT; if (!parse_commit(commit)) pp_commit_easy(CMIT_FMT_ONELINE, commit, &sb); - fprintf(stderr, "%s %s... %s\n", msg, - find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf); + if (print_sha1_ellipsis) { + fprintf(stderr, "%s %s... %s\n", msg, + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf); + } else { + fprintf(stderr, "%s %s %s\n", msg, + find_unique_abbrev(commit->object.oid.hash, DEFAULT_ABBREV), sb.buf); + } strbuf_release(&sb); }
-- 2.13.6