Guest User

Untitled

a guest
Apr 26th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!/usr/bin/env ruby -wKU
  2. # Usage:
  3. # $ git mark [character] [branch]
  4. #
  5. # Marks a branch with an arbitrary character
  6. #
  7. # Examples:
  8. # $ git mark # removes any mark on the current branch
  9. # $ git mark r # marks the current branch with "r"
  10. # $ git mark r topic-1 # marks the "topic-1" branch with "r"
  11. #
  12.  
  13. case ARGV.size
  14. when 0 then mark = nil
  15. when 1 then mark, branch, _ = ARGV
  16. else branch, mark, _ = ARGV
  17. end
  18.  
  19. branch ||= `git name-rev HEAD`.chomp.sub('HEAD ', '') # current branch
  20.  
  21. if mark
  22. `git config branch.#{branch}.peer-review #{mark}`
  23. puts "Marked '#{branch}' with '#{mark}'."
  24. else
  25. `git config --unset branch.#{branch}.peer-review`
  26. puts "Removed mark on '#{branch}'."
  27. end
Add Comment
Please, Sign In to add comment