[PATCH 4/4] Show the branch type after the branch name for remotes

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

 



Instead of prefixing the remote branches with "remotes/" suffix them with
"[read only]"

Signed-off-by: Andy Parkins <andyparkins@xxxxxxxxx>
---
 builtin-branch.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/builtin-branch.c b/builtin-branch.c
index b88413a..6736882 100644
--- a/builtin-branch.c
+++ b/builtin-branch.c
@@ -105,6 +105,7 @@ static void print_ref_list(int display_m
 	int i;
 	char c;
 	char *p;
+	const char *suffix;
 
 	switch (display_mode) {
 		case 0:
@@ -122,6 +123,7 @@ static void print_ref_list(int display_m
 
 	for (i = 0; i < ref_index; i++) {
 		p = ref_list[i];
+		suffix = "";
 		if (display_mode == 2) {
 			if (!strncmp( p, "refs/", 5 ))
 				p += 5;
@@ -129,13 +131,17 @@ static void print_ref_list(int display_m
 				continue;
 			if (!strncmp( p, "heads/", 6 ))
 				p += 6;
+			if (!strncmp( p, "remotes/", 8 )) {
+				suffix = " [read only]";
+				p += 8;
+			}
 		}
 
 		c = ' ';
 		if (!strcmp(p, head))
 			c = '*';
 
-		printf("%c %s\n", c, p);
+		printf("%c %s%s\n", c, p, suffix);
 	}
 }
 
-- 
1.4.3.2

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