{"thread":{"id":"43671","subject":"[PATCH] Show [xxxx] suffix after non-\"heads\" branches in git-branch output","startedAt":"2006-10-26T08:18:05Z","lastAt":"2006-10-26T08:18:05Z","messageCount":1,"participants":["Andy Parkins"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"296555","messageId":"200610260918.05952.andyparkins@gmail.com","threadId":"43671","inReplyTo":null,"subject":"[PATCH] Show [xxxx] suffix after non-\"heads\" branches in git-branch output","fromName":"Andy Parkins","fromEmail":"andyparkins@gmail.com","sentAt":"2006-10-26T08:18:05Z","receivedAt":"2006-10-26T08:18:05Z","isPatch":true,"sender":{"key":"andyparkins@gmail.com","avatar":null},"body":"This patch changes from showing only those refs in \"heads/\" to all non-\"tags/\"\nrefs.\n\nFor any ref that isn't a \"heads/\" ref (like \"remotes/\") a suffix of \"[xxx]\" is\nadded to the line.\nSigned-off-by: Andy Parkins <andyparkins@gmail.com>\n---\nThis patch is in preference to my earlier \"Use \"up/\" prefix for all the \nupstream branches\" patch.  Junio pointed out that that patch wasn't necessary \nbecause git already supports the \"--use-separate-remote\" option.  This patch \nmakes git-branch always show all the branches that are useable as references \nin tree-ish, but highlights the remote branches.\n\n git-branch.sh |   17 ++++++++++++++---\n 1 files changed, 14 insertions(+), 3 deletions(-)\n\ndiff --git a/git-branch.sh b/git-branch.sh\nindex f823c78..bddd189 100755\n--- a/git-branch.sh\n+++ b/git-branch.sh\n@@ -87,17 +87,28 @@ done\n \n case \"$#\" in\n 0)\n-\tgit-rev-parse --symbolic --branches |\n+\tgit-rev-parse --symbolic --all |\n \tsort |\n-\twhile read ref\n+\tgrep -v \"^refs/tags\" |\n+\tsed -ne 's|^refs/\\([^/]*\\)/\\(.*\\)|\\1 \\2|p' |\n+\twhile read type ref\n \tdo\n+\t\tcase \"$type\" in\n+\t\theads)\n+\t\t\ttype=\"\"\n+\t\t\t;;\n+\t\t*)\n+\t\t\ttype=\" [$type]\"\n+\t\t\t;;\n+\t\tesac\n+\n \t\tif test \"$headref\" = \"$ref\"\n \t\tthen\n \t\t\tpfx='*'\n \t\telse\n \t\t\tpfx=' '\n \t\tfi\n-\t\techo \"$pfx $ref\"\n+\t\techo \"$pfx $ref$type\"\n \tdone\n \texit 0 ;;\n 1)\n-- \n1.4.2.3\n"}]}