Nguyễn Thái Ngọc Duy wrote: > Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> > --- > In the spirit of status' in-progress info. I think showing this is > more useful than "(no branch)". I tend to do "git br" more often than > "git st" and this catches my eyes. Very nice idea. This would also have been a nice way to avoid confusion when my officemate used bisect for the first time. Any particular reason the above explanation is after the triple-dash instead of before it? [...] > --- a/builtin/branch.c > +++ b/builtin/branch.c > @@ -557,7 +557,15 @@ static void show_detached(struct ref_list *ref_list) > > if (head_commit && is_descendant_of(head_commit, ref_list->with_commit)) { > struct ref_item item; > - item.name = xstrdup(_("(no branch)")); > + struct stat st; > + if ((!stat(git_path("rebase-apply"), &st) && > + stat(git_path("rebase-apply/applying"), &st)) || > + !stat(git_path("rebase-merge"), &st)) Here's a straight translation of contrib/completion/prompt.sh for comparison, skipping the cases that don't involve automatically detaching HEAD: if (!stat(git_path("rebase-merge"), &st) && S_ISDIR(st.st_mode)) item.name = xstrdup(_("(rebasing)")); else if (!access(git_path("rebase-apply/rebasing"), F_OK)) item.name = xstrdup(_("(rebasing)")); else if (!access(git_path("BISECT_LOG"), F_OK)) item.name = xstrdup(_("(bisecting)")); else item.name = xstrdup(_("(no branch)")); That would mean: * using access() instead of stat() to avoid unnecessary work * relying on rebase--am to write .git/rebase-apply/rebasing when appropriate instead of guessing Not important, though. :) Jonathan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html