Permalink
Browse files

Allow colons in branch names

At least one Git manpage does this (though perhaps accidentally).
  • Loading branch information...
aroben committed Mar 29, 2012
1 parent e9534e3 commit 6c348ae6738978bb142ddf23fc82980f1ce27ab3
Showing with 13 additions and 1 deletion.
  1. +1 −1 lib/asciidag.rb
  2. +12 −0 test/parser_test.rb
View
@@ -123,7 +123,7 @@ def self.find_parents(position, nodes_by_position, lines)
end
NODE_REGEXP = /[^\s\-\/\\|]+/
- ARROWED_BRANCH_LABEL_REGEXP = /\s+(<--) ([\w\s]+)$/
+ ARROWED_BRANCH_LABEL_REGEXP = /\s+(<--) ([\w\s:]+)$/
PIXELS_PER_CHARACTER_X = 25
PIXELS_PER_CHARACTER_Y = 40
end
View
@@ -43,6 +43,12 @@
\\
o--o--o <-- Branch B
EOF
+
+ @graph7 = AsciiDag.parse <<-EOF
+ o--o--O--o--o--o <-- origin
+ \\ \\
+ t--t--t--m <-- their branch:
+EOF
end
test 'parses nodes' do
@@ -136,5 +142,11 @@
branch_b = find_branch_label @graph6, 'Branch B'
assert_not_nil branch_b
assert_equal [17, 0], branch_b.position
+
+ assert_nil find_node(@graph7, '<')
+
+ their_branch = find_branch_label @graph7, 'their branch:'
+ assert_not_nil their_branch
+ assert_equal [20, 0], their_branch.position
end
end

0 comments on commit 6c348ae

Please sign in to comment.