[PATCH 1/3] git-show-branch: allow for multiple branch head columns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If multiple refs point to the current branch head, each of them
should show a '*' in the corresponding column. This commit changes
this information about columns from an absolute index to a bitmask.
---
 builtin-show-branch.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 306b850..df83491 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -604,7 +604,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 	int sha1_name = 0;
 	int shown_merge_point = 0;
 	int with_current_branch = 0;
-	int head_at = -1;
+	unsigned int head_at = 0;
 	int topics = 0;
 	int dense = 1;
 	int reflog = 0;
@@ -855,8 +855,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 			else
 				puts(reflog_msg[i]);
 
-			if (is_head)
-				head_at = i;
+			if (is_head) {
+				assert(MAX_REVS <= (sizeof(head_at) * 8));
+				head_at |= (1UL << i);
+			}
 		}
 		if (0 <= extra) {
 			for (i = 0; i < num_rev; i++)
@@ -900,7 +902,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
 					mark = ' ';
 				else if (is_merge)
 					mark = '-';
-				else if (i == head_at)
+				else if (head_at & (1UL << i))
 					mark = '*';
 				else
 					mark = '+';
-- 
1.6.1

--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux