lib/git_topic/naming.rb in git-topic-0.2.2 vs lib/git_topic/naming.rb in git-topic-0.2.3
- old
+ new
@@ -8,12 +8,15 @@
def backup_branch( topic )
"backup/#{user}/#{strip_namespace topic}"
end
- def wip_branch( topic )
- "wip/#{user}/#{strip_namespace topic}"
+ def wip_branch( ref )
+ parts = topic_parts( ref )
+ wip_user = parts[:user] || user
+ topic = parts[:topic]
+ "wip/#{wip_user}/#{topic}"
end
def rejected_branch( topic )
"rejected/#{user}/#{strip_namespace topic}"
end
@@ -60,12 +63,13 @@
def topic_parts( ref )
p = {}
parts = ref.split( '/' )
case parts.size
when 3
- _, p[:user], p[:topic] = parts
+ p[:namespace], p[:user], p[:topic] = parts
when 2
- p[:user], p[:topic] = parts
+ first_part = (parts.first =~ /(wip|review|rejected)/) ? :namespace : :user
+ p[ first_part ], p[:topic] = parts
when 1
p[:topic] = parts.first
else
raise "Unexpected topic: #{ref}"
end