Re: [PATCH 5/5] branch: show more information when HEAD is detached
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 3, 2013, 22:28 UTC
- Message-ID
- <7vtxos9kzr.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <1362303681-6585-6-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:
Show 28 quoted lines
> This prints more helpful info when HEAD is detached: is it detached
> because of bisect or rebase? What is the original branch name in those
> cases? Is it detached because the user checks out a remote ref or a
> tag (and which one)?
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
> builtin/branch.c | 25 ++++++++++++++++++++++++-
> t/t6030-bisect-porcelain.sh | 2 +-
> 2 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/builtin/branch.c b/builtin/branch.c
> index 6371bf9..02dee0d 100644
> --- a/builtin/branch.c
> +++ b/builtin/branch.c
> @@ -18,6 +18,7 @@
> #include "string-list.h"
> #include "column.h"
> #include "utf8.h"
> +#include "wt-status.h"
>
> static const char * const builtin_branch_usage[] = {
> N_("git branch [options] [-r | -a] [--merged | --no-merged]"),
> @@ -550,6 +551,28 @@ static int calc_maxwidth(struct ref_list *refs)
> return w;
> }
>
> +static char *get_head_description()s/()/(void)/;
I think the series is much easier to read than the previous round (except for some nits, which I'll send separately). We would want to add tests to protect the "where did we detach from" feature done by [PATCH 4/5], which does not seem to have any.