Class: Jigit::PostCheckoutHook

Inherits:
GitHook
  • Object
show all
Defined in:
lib/jigit/git/post_checkout_hook.rb

Class Method Summary collapse

Class Method Details

.hook_linesObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/jigit/git/post_checkout_hook.rb', line 5

def self.hook_lines
  ["#!/usr/bin/env bash",
   "checkoutType=$3",
   "[[ $checkoutType == 1 ]] && checkoutType='branch' || checkoutType='file'",
   "if [ $checkoutType == 'branch' ]; then",
   "  newBranchName=`git symbolic-ref --short HEAD`",
   "  oldBranchName=`git rev-parse --abbrev-ref @{-1}`",
   "  if [ $newBranchName != $oldBranchName ]; then",
   "    jigit issue start --name=$newBranchName",
   "    jigit issue stop --name=$oldBranchName",
   "  fi",
   "fi"]
end

.nameObject



19
20
21
# File 'lib/jigit/git/post_checkout_hook.rb', line 19

def self.name
  "post-checkout"
end