-
-
Save cgarnier/7847451c0873987e63c31365cfa05a79 to your computer and use it in GitHub Desktop.
Revisions
-
cgarnier revised this gist
Jul 27, 2016 . 1 changed file with 7 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,21 @@ #!/bin/bash # Adds reference to GitHub issue if available in branch name. # The issue number should be at the end of the branch name, following # a hyphen. # Only proceed if no second parameter is given to the script. if [ x = x${2} ]; then branch=$(git symbolic-ref --short HEAD) if [[ $branch =~ ^([^/]+)/([A-Z]+\-[0-9]+) ]]; then issue_number=${BASH_REMATCH[2]} issue_type=${BASH_REMATCH[1]} # sed on osx doesn't treat \n in replacement pattern as a new line. # If it did we could do this: # # sed -i.bak -e "1s/^/\n\nSee #$issue_number./" "$1" # # Instead we have do lots of weird quoting. sed -i.bak -e '1s/^/\'$'\n'"\\"$'\n'"$issue_type\n""$issue_number/" "$1" fi fi -
cgarnier revised this gist
Jul 27, 2016 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,6 +13,6 @@ if [ x = x${2} ]; then # sed -i.bak -e "1s/^/\n\nSee #$issue_number./" "$1" # # Instead we have do lots of weird quoting. sed -i.bak -e '1s/^/\'$'\n'"\\"$'\n'"$issue_number/" "$1" fi fi -
cgarnier revised this gist
Jul 27, 2016 . 1 changed file with 3 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,18 @@ #!/bin/bash # Adds reference to Jira issue if available in branch name. # Only proceed if no second parameter is given to the script. if [ x = x${2} ]; then branch=$(git symbolic-ref --short HEAD) if [[ $branch =~ ^[^/]+/([A-Z]+\-[0-9]+) ]]; then issue_number=${BASH_REMATCH[1]} # sed on osx doesn't treat \n in replacement pattern as a new line. # If it did we could do this: # # sed -i.bak -e "1s/^/\n\nSee #$issue_number./" "$1" # # Instead we have do lots of weird quoting. sed -i.bak -e '1s/^/\'$'\n'"\\"$'\n'"$issue_number./" "$1" fi fi -
airblade created this gist
Nov 3, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ #!/bin/bash # Adds reference to GitHub issue if available in branch name. # The issue number should be at the end of the branch name, following # a hyphen. # Only proceed if no second parameter is given to the script. if [ x = x${2} ]; then branch=$(git symbolic-ref --short HEAD) if [[ $branch =~ .*-([0-9]+)$ ]]; then issue_number=${BASH_REMATCH[1]} # sed on osx doesn't treat \n in replacement pattern as a new line. # If it did we could do this: # # sed -i.bak -e "1s/^/\n\nSee #$issue_number./" "$1" # # Instead we have do lots of weird quoting. sed -i.bak -e '1s/^/\'$'\n'"\\"$'\n'"See #$issue_number./" "$1" fi fi