Changeset 258

Show
Ignore:
Timestamp:
11/20/08 10:39:09 (7 weeks ago)
Author:
docwhat
Message:

Added Git Hooks.

Location:
trunk/packages/git-support
Files:
2 added
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/packages/git-support/.homedir.control

    r240 r258  
    77 
    88dirs: 
     9 .git_hooks 
    910 .zsh 
    1011 .zsh/functions 
  • trunk/packages/git-support/.zsh/functions/_git

    r240 r258  
    151151    'diff:show changes between commits, commit and working tree, etc.' 
    152152    'fetch:download objects and a head from another repository' 
    153     'gc:cleanup unnecessary files and optimize the local repository' 
     153    'gc:cleanup unnecessary files and optimize thee local repository' 
    154154    'grep:print lines matching a pattern' 
    155155    'init:create empty git object database' 
     
    165165    'rm:remove files from the working tree and from the index' 
    166166    'show-branch:show branches and their commits' 
    167     'status:show working-tree'\''s status' 
     167    "status:show working-tree's status" 
    168168    'tag:create tag object signed with GPG' 
    169169    'verify-tag:check GPG signature of a tag') 
     
    226226    'symbolic-ref:read and modify symbolic references' 
    227227    'tar-tree:create tar archive of the files in the named tree' 
    228     'unpack-file:create temporary file with blob'\''s contents' 
     228    "unpack-file:create temporary file with blob's contents" 
    229229    'unpack-objects:unpack objects out of packed archive' 
    230230    'update-ref:update object name stored in a reference safely' 
     
    239239    'format-patch:prepare patches for e-mail submission' 
    240240    'ls-files:information about files in the index/working directory' 
     241    'config:get and set options in "$GIT_DIR/config"' 
    241242    'instaweb:instantly browse your working repository in gitweb' 
    242243    'remote:manage set of tracked repositories' 
     
    666667          _arguments \ 
    667668            '*'{--track,-t}'[track given branch instead of default glob refspec]:branch:__git_branch_names' \ 
    668             '(--master -m)'{--master,-m}'[set the remote'\''s HEAD to point to given master branch]:branch:__git_branch_names' \ 
     669            '(--master -m)'{--master,-m}"[set the remote's HEAD to point to given master branch]:branch:__git_branch_names" \ 
    669670            '(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \ 
    670671            ':branch name:__git_remotes' \ 
     
    826827        #   ... 
    827828        _alternative \ 
    828           "original tree:original tree:__git_tree_files . $line[1]" \ 
    829           "new tree:new tree:__git_tree_files . $line[2]" && ret=0 
     829          "original tree:original tree:__git_tree_files $line[1]" \ 
     830          "new tree:new tree:__git_tree_files $line[2]" && ret=0 
    830831      else 
    831832        _alternative \ 
    832833          ': :__git_tree_ishs' \ 
    833           ": :__git_tree_files . $line[1]" && ret=0 
     834          ": :__git_tree_files $line[1]" && ret=0 
    834835      fi 
    835836      ;; 
     
    924925  case $state in 
    925926    files) 
    926       __git_tree_files . $line[1] && ret=0 
     927      __git_tree_files $line[1] && ret=0 
    927928      ;; 
    928929  esac 
     
    937938_git-quiltimport () { 
    938939  _arguments \ 
    939     '--dry-run[check patches and warn if they can'\''t be imported]' \ 
     940    "--dry-run[check patches and warn if they can't be imported]" \ 
    940941    '--author[default author name and email address to use for patches]' \ 
    941942    '--patches[set directory containing patches]:patch directory:_directories' && ret=0 
     
    10161017  _arguments -S \ 
    10171018    $revision_arguments \ 
    1018     '*:object:__git_objects' && ret=0 
     1019    '*:object:->object' && ret=0 
     1020 
     1021  case $state in 
     1022    (object) 
     1023      compset -P '*:' 
     1024      if [[ -n $IPREFIX ]]; then 
     1025        __git_tree_files ${IPREFIX%:} 
     1026      else 
     1027        _alternative \ 
     1028          'revisions:revision:__git_revisions' \ 
     1029          'files:file:__git_files' 
     1030      fi 
     1031      ;; 
     1032  esac 
    10191033} 
    10201034 
     
    10521066    '*:index file:_files -g "*.idx"' && ret=0 
    10531067} 
    1054  
     1068  
    10551069(( $+functions[_git-clone-pack] )) || 
    10561070_git-clone-pack () { 
     
    13661380  case $state in 
    13671381    (files) 
    1368       __git_tree_files . $line[1] && ret=0 
     1382      __git_tree_files $line[1] && ret=0 
    13691383      ;; 
    13701384  esac 
     
    14571471      $my_abbrev_arg \ 
    14581472    - create \ 
    1459       '-l[create the branch'\''s reflog]' \ 
     1473      "-l[create the branch's reflog]" \ 
    14601474      '-f[force the creation of a new branch]' \ 
    14611475      ':branch-name:__git_branch_names' \ 
     
    14831497 
    14841498  if (( words[(I)-b] > 0 )); then 
    1485     new_branch_reflog_arg='-l[create the new branch'\''s reflog]' 
     1499    new_branch_reflog_arg="-l[create the new branch's reflog]" 
    14861500  fi 
    14871501 
     
    15041518    (files) 
    15051519      if [[ -n $line[1] ]]; then 
    1506         __git_tree_files . $line[1] && ret=0 
     1520        __git_tree_files $line[1] && ret=0 
    15071521      else 
    15081522        __git_cached_files && ret=0 
     
    16641678    ':pattern:' \ 
    16651679    '*::tree-or-file:->files' && ret=0 
    1666  
     1680   
    16671681  case $state in 
    16681682    (files) 
     
    16901704          _alternative \ 
    16911705            'tree:tree:__git_trees' \ 
    1692             "tree file:tree-files:__git_tree_files $line[first_tree,last_tree]" && ret=0 
     1706            "tree file:tree-files:__git_tree_files $line[first_tree,last_tree]" && ret=0 
    16931707        fi 
    16941708      else 
     
    16961710          __git_cached_files 
    16971711        else 
    1698           __git_tree_files . $line[first_tree,last_tree] 
     1712          __git_tree_files $line[first_tree,last_tree] 
    16991713        fi 
    17001714      fi 
     
    18361850  if [[ $words[2] == --mixed ]]; then 
    18371851    commit_arg=':commit:__git_revisions' 
    1838     path_arg="*:file:__git_tree_files . $words[3]" 
     1852    path_arg="*:file:__git_tree_files $words[3]" 
    18391853  else 
    18401854    commit_arg='::commit:__git_revisions' 
     
    20312045  _arguments \ 
    20322046    '--all[pack all refs]' \ 
    2033     '(        --no-prune)--prune[remove loose refs after packing them]' \ 
    2034     '(--prune           )--no-prune[don'\''t remove loose refs after packing them]' && ret=0 
     2047    "(        --no-prune)--prune[remove loose refs after packing them]" \ 
     2048    "(--prune           )--no-prune[don't remove loose refs after packing them]" && ret=0 
    20352049} 
    20362050 
     
    22602274    {--after=-,--since=-}'[show "--max-age=" parameter corresponding given date string]:datestring' \ 
    22612275    {--berore=-,--until=-}'[show "--min-age=" parameter corresponding given date string]:datestring' \ 
    2262     '*:objects:__git_objects' && ret=0 
     2276    '*:args' && ret=0 
    22632277} 
    22642278 
     
    22772291  _arguments -S -A '-*' \ 
    22782292    '-f[override the up-to-date check]' \ 
    2279     '-n[don'\''t actually remove the files, just show if they exist in the index]' \ 
     2293    "-n[don't actually remove the files, just show if they exist in the index]" \ 
    22802294    '-r[allow recursive removal when a leading directory-name is given]' \ 
    22812295    '--cached[only remove files from the index]' \ 
     
    23432357        'dcommit:commit diffs from given head onto SVN repository' 
    23442358        'log:output SVN log-messages' 
    2345         'find-rev:output git commit corresponding to the given SVN revision'\''s hash' 
     2359        "find-rev:output git commit corresponding to the given SVN revision's hash" 
    23462360        'set-tree:commit given commit or tree to SVN repository' 
    23472361        'show-ignore:output corresponding .gitignore file of svn:ignore' 
     
    25572571(( $+functions[__git_objects] )) || 
    25582572__git_objects () { 
    2559   compset -P '*:' 
    2560   if [[ -n $IPREFIX ]]; then 
    2561     __git_tree_files "$PREFIX" "${IPREFIX%:}" 
    2562   else 
    2563     _alternative \ 
    2564       'revisions:revision:__git_revisions' \ 
    2565       'files:file:__git_files' 
    2566   fi 
     2573  __git_guard $* "[[:xdigit:]]#" "object" 
    25672574} 
    25682575 
    25692576(( $+functions[__git_trees] )) || 
    25702577__git_trees () { 
    2571   __git_objects 
     2578  __git_guard $* "[[:xdigit:]]#" "tree" 
    25722579} 
    25732580 
    25742581(( $+functions[__git_tree_ishs] )) || 
    25752582__git_tree_ishs () { 
    2576   __git_commits 
     2583  __git_commits  
    25772584} 
    25782585 
    25792586(( $+functions[__git_blobs] )) || 
    25802587__git_blobs () { 
    2581   __git_objects 
     2588  __git_guard $* "[[:xdigit:]]#" 'blob id' 
    25822589} 
    25832590 
     
    26522659  zparseopts -D -E -a multi_parts_opts M: J: V: 1 2 n F: X: 
    26532660 
    2654   local tree Path 
     2661  local tree 
    26552662  integer at_least_one_tree_added 
    26562663  local -a tree_files 
    26572664 
    2658   [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" 
    2659   shift 
    26602665  (( at_least_one_tree_added = 0 )) 
    26612666  for tree in $*; do 
    2662     tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z $tree $Path 2>/dev/null)"}) 
     2667    tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z -r $tree 2>/dev/null)"}) 
    26632668    __git_command_successful && (( at_least_one_tree_added = 1 )) 
    26642669  done 
     
    26692674 
    26702675  local expl 
    2671   _wanted files expl 'tree file' compadd $multi_parts_opts -f -a tree_files 
     2676 
     2677  # FIXME: Why doesn’t -f to compadd work here? 
     2678  _wanted files expl 'tree file' _multi_parts $multi_parts_opts - / tree_files 
    26722679} 
    26732680 
     
    27272734      while _next_label files expl ${suf:-remote directory}; do 
    27282735#        [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ 
    2729 #       ${(q)remdispf%[*=@|]} && ret=0 
     2736#       ${(q)remdispf%[*=@|]} && ret=0  
    27302737    compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ 
    27312738        ${(q)remdispd%/} && ret=0 
     
    28012808      __git_heads 
    28022809    else 
    2803       _alternative \ 
    2804        'tags:tag:__git_tags' \ 
    2805        'heads:head:__git_heads -qS :' 
     2810      __git_heads -S ':' 
    28062811    fi 
    28072812  fi 
     
    29352940 
    29362941    __git_remote-groups 
    2937     return 
     2942    return  
    29382943  elif [[ -prefix gitcvs.* ]]; then 
    29392944    names=( 
     
    29832988    names=( 
    29842989      'core.fileMode:whether differences in the executable bit is relevant' 
    2985       'core.autocrlf:what type of conversion of CRLF'\''s git should do' 
     2990      "core.autocrlf:what type of conversion of CRLF's git should do" 
    29862991      'core.symlinks:whether symlinks are treated as special files or not' 
    29872992      'core.gitProxy:command to execute to establish a connection to remote server' 
     
    32453250      booleans=( 
    32463251        {true,yes}':create ref files for branch heads' 
    3247         {false,no}':don'\''t automatically create ref files') 
     3252        {false,no}":don't automatically create ref files") 
    32483253 
    32493254      _describe -t boolean 'boolean' booleans 
     
    32613266        {true,yes}':warn if a ref name matches multiple refs' 
    32623267        {false,no}':ignore ambiguous ref names') 
    3263  
     3268       
    32643269      _describe -t boolean 'boolean' booleans 
    32653270      ;; 
     
    33543359      settings=( 
    33553360        {true,yes}':enable basic rename detection' 
    3356         {false,no}':don'\''t try to detect renames' 
     3361        {false,no}":don't try to detect renames" 
    33573362        {copies,copy}':detect file renames and copies') 
    33583363 
     
    33883393      booleans=( 
    33893394        {true,yes}':enable the cvs server interface' 
    3390         {false,no}':don'\''t enable the cvs server interface') 
     3395        {false,no}":don't enable the cvs server interface") 
    33913396 
    33923397      _describe -t booleans 'boolean' booleans 
     
    34733478 
    34743479      booleans=( 
    3475         {true,yes}':don'\''t use EPSV mode over FTP (for stupid servers)' 
     3480        {true,yes}":don't use EPSV mode over FTP (for stupid servers)" 
    34763481        {false,no}':use EPSV mode over FTP') 
    34773482 
     
    34963501      booleans=( 
    34973502        {true,yes}':include summaries in merge commit messages' 
    3498         {false,no}':don'\''t add summaries to merge commit messages (default)') 
     3503        {false,no}":don't add summaries to merge commit messages (default)") 
    34993504 
    35003505      _describe -t booleans 'boolean' booleans 
     
    35523557 
    35533558      opts=( 
    3554         '--no-tags:don'\''t fetch tags automatically' 
     3559        "--no-tags:don't fetch tags automatically" 
    35553560        '"":fetch tags as usual') 
    35563561 
     
    35763581      booleas=( 
    35773582        {true,yes}':allow creation of delta-base-offset packs' 
    3578         {false,no}':don'\''t create delta-base-offset packs') 
     3583        {false,no}":don't create delta-base-offset packs") 
    35793584 
    35803585      _describe -t booleans 'boolean' booleans 
     
    35903595      _alternative \ 
    35913596        'number: :_guard "[0-7]#" "numeric mode"' \ 
    3592         'values:special value:((user:"use user'\''s current umask"))' 
     3597        "values:special value:((user:\"use user's current umask\"))" 
    35933598      ;; 
    35943599    ((#i)user.email) 
     
    36093614 
    36103615      booleans=( 
    3611         {true,yes}':git-receive-pack will deny a ref update that isn'\''t a fast forward' 
    3612         {false,no}':allow a ref update that isn'\''t a fast forward') 
     3616        {true,yes}":git-receive-pack will deny a ref update that isn't a fast forward" 
     3617        {false,no}":allow a ref update that isn't a fast forward") 
    36133618 
    36143619      _describe -t booleans 'boolean' booleans 
     
    36383643      booleans=( 
    36393644        {true,yes}':bind the HTTP daemon to 127.0.0.1' 
    3640         {false,no}':don'\''t bind the HTTP daemon to a specific address') 
     3645        {false,no}":don't bind the HTTP daemon to a specific address") 
    36413646 
    36423647      _describe -t booleans 'boolean' booleans 
     
    36713676      booleans=( 
    36723677        {true,yes}':remap URLs and UUIDs for mirrors' 
    3673         {false,no}':don'\''t remap URLs and UUIDs for mirrors') 
     3678        {false,no}":don't remap URLs and UUIDs for mirrors") 
    36743679 
    36753680      _describe -t booleans 'boolean' booleans 
     
    37433748      ;; 
    37443749    ((#i)svn.merge) 
    3745       __git_boolean_settings false 'use merging strategies' 'don'\''t try to merge' 
     3750      __git_boolean_settings false 'use merging strategies' "don't try to merge" 
    37463751      ;; 
    37473752    ((#i)svn.fetch-all) 
     
    37493754      ;; 
    37503755    ((#i)svn.stdin) 
    3751       __git_boolean_settings false 'read list of commits to commit from stdin' 'don'\''t necessarily read list of commits to commit from stdin' 
     3756      __git_boolean_settings false 'read list of commits to commit from stdin' "don't necessarily read list of commits to commit from stdin" 
    37523757      ;; 
    37533758    ((#i)svn.strategy) 
     
    37703775      ;; 
    37713776    ((#i)svn.showcommit) 
    3772       __git_boolean_settings false 'output git commit SHA-1, as well' 'don'\''t output git commit SHA-1' 
     3777      __git_boolean_settings false 'output git commit SHA-1, as well' "don't output git commit SHA-1" 
    37733778      ;; 
    37743779    ((#i)svn.online) 
     
    38063811# -t can be used to specify a tag to use (default: booleans). 
    38073812# -l can be used to specify a label to use (default: 'boolean'). 
    3808 # 
     3813#  
    38093814# The first argument is the default value, so that the description of the 
    38103815# default value can be suffixed with " (default)".  The second argument 
     
    38153820(( $+functions[__git_boolean_settings] )) || 
    38163821__git_boolean_settings () { 
    3817   local tag label garbage 
     3822  local tag label garbage  
    38183823 
    38193824  zparseopts -D -E -a garba S: M: J: V: 1 2 n F: X: -t=tag -l=label 
     
    38213826  declare -A descriptions 
    38223827 
    3823   descriptions=(true $2 false 'don'\''t '"$2") 
     3828  descriptions=(true $2 false "don't $2") 
    38243829 
    38253830  if (( $# > 2 )); then 
     
    40864091    '--full-history[undocumented]' 
    40874092    '--relative-date[show dates relative to the current time]' 
    4088     '--date=-[format of date output]:date format:((relative\:"show dates relative to the current time" 
    4089                                                    local\:"show timestamps in user'\''s local timezone" 
    4090                                                    default\:"show timestamp in the original timezone"))' 
     4093    "--date=-[format of date output]:date format:((relative\:'show dates relative to the current time' 
     4094                                                   local\:\"show timestamps in user's local timezone\" 
     4095                                                   default\:'show timestamp in the original timezone\"" 
    40914096    '--author=-[limit commits to those by the given author]:author' 
    40924097    '--committer=-[limit commits to those by the given committer]:committer' 
     
    41094114 
    41104115  local curcontext=$curcontext ret=1 
    4111  
    4112   # fun with $words[] and $CURRENT to enable completion for args 
    4113   # to git aliases (eg. git co <TAB>) 
    4114   local -A git_aliases 
    4115   # TODO: filling git_aliases like this is ugly. I didn't get it working elegantly. 
    4116   local oifs=$IFS 
    4117   IFS=$'\0' 
    4118   git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}}) 
    4119   IFS=$oifs ; unset oifs 
    4120  
    4121   if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then 
    4122     local -a tmpwords 
    4123     tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]}) 
    4124     if [[ -z "${words[3,-1]}" ]] ; then 
    4125         tmpwords[$(( ${#tmpwords} + 1 ))]="" 
    4126     else 
    4127         tmpwords+=("${words[3,-1]}") 
    4128     fi 
    4129     words=("${tmpwords[@]}") 
    4130     (( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 )) 
    4131     unset tmpwords 
    4132   fi 
    41334116 
    41344117  if [[ $words[1] == git ]]; then