Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 24 lines (19 sloc) 0.609 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
#!/bin/bash

function _ptid_git_complete_()
{
  local line="${COMP_LINE}" # the entire line that is being completed

  # check that the commit option was passed to git
  if [[ "$line" == "git commit " ]]; then
    # get the PivotalTracker Id from the branch name
    ptid=`git branch | grep -e "^\*" | sed 's/^\* //g' | sed 's/\-/ /g' | awk '{ print $(NF) }'`
    nodigits=$(echo $ptid | sed 's/[[:digit:]]//g')

    if [ ! -z $nodigits ]; then
      : # do nothing
    else
COMPREPLY=("commit -m \"[#$ptid]")
    fi
else
__git_main
  fi
}

complete -F _ptid_git_complete_ git
Something went wrong with that request. Please try again.