All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] branch: show (rebasing) or (bisecting) instead of (no branch) when possible
@ 2013-01-29 12:12 Nguyễn Thái Ngọc Duy
  2013-01-29 19:13 ` Jonathan Nieder
  2013-02-03  5:48 ` [PATCH v2] branch: show rebase/bisect info when possible instead of "(no branch)" Nguyễn Thái Ngọc Duy
  0 siblings, 2 replies; 14+ messages in thread
From: Nguyễn Thái Ngọc Duy @ 2013-01-29 12:12 UTC (permalink / raw)
  To: git; +Cc: Nguyễn Thái Ngọc Duy


Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 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.

 builtin/branch.c            | 10 +++++++++-
 t/t6030-bisect-porcelain.sh |  2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/builtin/branch.c b/builtin/branch.c
index 873f624..b0c5a20 100644
--- 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))
+			item.name = xstrdup(_("(rebasing)"));
+		else if (!stat(git_path("BISECT_LOG"), &st))
+			item.name = xstrdup(_("(bisecting)"));
+		else
+			item.name = xstrdup(_("(no branch)"));
 		item.width = utf8_strwidth(item.name);
 		item.kind = REF_LOCAL_BRANCH;
 		item.dest = NULL;
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 3e0e15f..bc21bc9 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -164,7 +164,7 @@ test_expect_success 'bisect start: existing ".git/BISECT_START" not modified if
 	cp .git/BISECT_START saved &&
 	test_must_fail git bisect start $HASH4 foo -- &&
 	git branch > branch.output &&
-	test_i18ngrep "* (no branch)" branch.output > /dev/null &&
+	test_i18ngrep "* (bisecting)" branch.output > /dev/null &&
 	test_cmp saved .git/BISECT_START
 '
 test_expect_success 'bisect start: no ".git/BISECT_START" if mistaken rev' '
-- 
1.8.1.1.459.g5970e58

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-14  9:47 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 12:12 [PATCH] branch: show (rebasing) or (bisecting) instead of (no branch) when possible Nguyễn Thái Ngọc Duy
2013-01-29 19:13 ` Jonathan Nieder
2013-02-03  5:48 ` [PATCH v2] branch: show rebase/bisect info when possible instead of "(no branch)" Nguyễn Thái Ngọc Duy
2013-02-03 21:23   ` Matthieu Moy
2013-02-03 21:58     ` Junio C Hamano
2013-02-03 22:00       ` Junio C Hamano
2013-02-04 13:13       ` Matthieu Moy
2013-02-04 16:18         ` Junio C Hamano
2013-02-04  7:14     ` Duy Nguyen
2013-02-04  7:17       ` Duy Nguyen
2013-02-08 10:09   ` [PATCH v3] " Nguyễn Thái Ngọc Duy
2013-02-08 18:35     ` Junio C Hamano
2013-02-14  9:46       ` Duy Nguyen
2013-02-11 19:13     ` Junio C Hamano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.