Changeset 258
- Timestamp:
- 11/20/08 10:39:09 (7 weeks ago)
- Location:
- trunk/packages/git-support
- Files:
-
- 2 added
- 2 modified
-
.git_hooks (added)
-
.git_hooks/pre-commit (added)
-
.homedir.control (modified) (1 diff)
-
.zsh/functions/_git (modified) (49 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/git-support/.homedir.control
r240 r258 7 7 8 8 dirs: 9 .git_hooks 9 10 .zsh 10 11 .zsh/functions -
trunk/packages/git-support/.zsh/functions/_git
r240 r258 151 151 'diff:show changes between commits, commit and working tree, etc.' 152 152 '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' 154 154 'grep:print lines matching a pattern' 155 155 'init:create empty git object database' … … 165 165 'rm:remove files from the working tree and from the index' 166 166 'show-branch:show branches and their commits' 167 'status:show working-tree'\''s status'167 "status:show working-tree's status" 168 168 'tag:create tag object signed with GPG' 169 169 'verify-tag:check GPG signature of a tag') … … 226 226 'symbolic-ref:read and modify symbolic references' 227 227 '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" 229 229 'unpack-objects:unpack objects out of packed archive' 230 230 'update-ref:update object name stored in a reference safely' … … 239 239 'format-patch:prepare patches for e-mail submission' 240 240 'ls-files:information about files in the index/working directory' 241 'config:get and set options in "$GIT_DIR/config"' 241 242 'instaweb:instantly browse your working repository in gitweb' 242 243 'remote:manage set of tracked repositories' … … 666 667 _arguments \ 667 668 '*'{--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" \ 669 670 '(--fetch -f)'{--fetch,-f}'[run git-fetch on the new remote after it has been created]' \ 670 671 ':branch name:__git_remotes' \ … … 826 827 # ... 827 828 _alternative \ 828 "original tree:original tree:__git_tree_files .$line[1]" \829 "new tree:new tree:__git_tree_files .$line[2]" && ret=0829 "original tree:original tree:__git_tree_files $line[1]" \ 830 "new tree:new tree:__git_tree_files $line[2]" && ret=0 830 831 else 831 832 _alternative \ 832 833 ': :__git_tree_ishs' \ 833 ": :__git_tree_files .$line[1]" && ret=0834 ": :__git_tree_files $line[1]" && ret=0 834 835 fi 835 836 ;; … … 924 925 case $state in 925 926 files) 926 __git_tree_files .$line[1] && ret=0927 __git_tree_files $line[1] && ret=0 927 928 ;; 928 929 esac … … 937 938 _git-quiltimport () { 938 939 _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]" \ 940 941 '--author[default author name and email address to use for patches]' \ 941 942 '--patches[set directory containing patches]:patch directory:_directories' && ret=0 … … 1016 1017 _arguments -S \ 1017 1018 $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 1019 1033 } 1020 1034 … … 1052 1066 '*:index file:_files -g "*.idx"' && ret=0 1053 1067 } 1054 1068 1055 1069 (( $+functions[_git-clone-pack] )) || 1056 1070 _git-clone-pack () { … … 1366 1380 case $state in 1367 1381 (files) 1368 __git_tree_files .$line[1] && ret=01382 __git_tree_files $line[1] && ret=0 1369 1383 ;; 1370 1384 esac … … 1457 1471 $my_abbrev_arg \ 1458 1472 - create \ 1459 '-l[create the branch'\''s reflog]'\1473 "-l[create the branch's reflog]" \ 1460 1474 '-f[force the creation of a new branch]' \ 1461 1475 ':branch-name:__git_branch_names' \ … … 1483 1497 1484 1498 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]" 1486 1500 fi 1487 1501 … … 1504 1518 (files) 1505 1519 if [[ -n $line[1] ]]; then 1506 __git_tree_files .$line[1] && ret=01520 __git_tree_files $line[1] && ret=0 1507 1521 else 1508 1522 __git_cached_files && ret=0 … … 1664 1678 ':pattern:' \ 1665 1679 '*::tree-or-file:->files' && ret=0 1666 1680 1667 1681 case $state in 1668 1682 (files) … … 1690 1704 _alternative \ 1691 1705 'tree:tree:__git_trees' \ 1692 "tree file:tree-files:__git_tree_files .$line[first_tree,last_tree]" && ret=01706 "tree file:tree-files:__git_tree_files $line[first_tree,last_tree]" && ret=0 1693 1707 fi 1694 1708 else … … 1696 1710 __git_cached_files 1697 1711 else 1698 __git_tree_files .$line[first_tree,last_tree]1712 __git_tree_files $line[first_tree,last_tree] 1699 1713 fi 1700 1714 fi … … 1836 1850 if [[ $words[2] == --mixed ]]; then 1837 1851 commit_arg=':commit:__git_revisions' 1838 path_arg="*:file:__git_tree_files .$words[3]"1852 path_arg="*:file:__git_tree_files $words[3]" 1839 1853 else 1840 1854 commit_arg='::commit:__git_revisions' … … 2031 2045 _arguments \ 2032 2046 '--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=02047 "( --no-prune)--prune[remove loose refs after packing them]" \ 2048 "(--prune )--no-prune[don't remove loose refs after packing them]" && ret=0 2035 2049 } 2036 2050 … … 2260 2274 {--after=-,--since=-}'[show "--max-age=" parameter corresponding given date string]:datestring' \ 2261 2275 {--berore=-,--until=-}'[show "--min-age=" parameter corresponding given date string]:datestring' \ 2262 '*: objects:__git_objects' && ret=02276 '*:args' && ret=0 2263 2277 } 2264 2278 … … 2277 2291 _arguments -S -A '-*' \ 2278 2292 '-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]" \ 2280 2294 '-r[allow recursive removal when a leading directory-name is given]' \ 2281 2295 '--cached[only remove files from the index]' \ … … 2343 2357 'dcommit:commit diffs from given head onto SVN repository' 2344 2358 '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" 2346 2360 'set-tree:commit given commit or tree to SVN repository' 2347 2361 'show-ignore:output corresponding .gitignore file of svn:ignore' … … 2557 2571 (( $+functions[__git_objects] )) || 2558 2572 __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" 2567 2574 } 2568 2575 2569 2576 (( $+functions[__git_trees] )) || 2570 2577 __git_trees () { 2571 __git_ objects2578 __git_guard $* "[[:xdigit:]]#" "tree" 2572 2579 } 2573 2580 2574 2581 (( $+functions[__git_tree_ishs] )) || 2575 2582 __git_tree_ishs () { 2576 __git_commits 2583 __git_commits 2577 2584 } 2578 2585 2579 2586 (( $+functions[__git_blobs] )) || 2580 2587 __git_blobs () { 2581 __git_ objects2588 __git_guard $* "[[:xdigit:]]#" 'blob id' 2582 2589 } 2583 2590 … … 2652 2659 zparseopts -D -E -a multi_parts_opts M: J: V: 1 2 n F: X: 2653 2660 2654 local tree Path2661 local tree 2655 2662 integer at_least_one_tree_added 2656 2663 local -a tree_files 2657 2664 2658 [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/"2659 shift2660 2665 (( at_least_one_tree_added = 0 )) 2661 2666 for tree in $*; do 2662 tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z $tree $Path2>/dev/null)"})2667 tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree --name-only -z -r $tree 2>/dev/null)"}) 2663 2668 __git_command_successful && (( at_least_one_tree_added = 1 )) 2664 2669 done … … 2669 2674 2670 2675 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 2672 2679 } 2673 2680 … … 2727 2734 while _next_label files expl ${suf:-remote directory}; do 2728 2735 # [[ -n $suf ]] && compadd "$@" "$expl[@]" -d remdispf \ 2729 # ${(q)remdispf%[*=@|]} && ret=0 2736 # ${(q)remdispf%[*=@|]} && ret=0 2730 2737 compadd ${suf:+-S/} "$@" "$expl[@]" -d remdispd \ 2731 2738 ${(q)remdispd%/} && ret=0 … … 2801 2808 __git_heads 2802 2809 else 2803 _alternative \ 2804 'tags:tag:__git_tags' \ 2805 'heads:head:__git_heads -qS :' 2810 __git_heads -S ':' 2806 2811 fi 2807 2812 fi … … 2935 2940 2936 2941 __git_remote-groups 2937 return 2942 return 2938 2943 elif [[ -prefix gitcvs.* ]]; then 2939 2944 names=( … … 2983 2988 names=( 2984 2989 '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" 2986 2991 'core.symlinks:whether symlinks are treated as special files or not' 2987 2992 'core.gitProxy:command to execute to establish a connection to remote server' … … 3245 3250 booleans=( 3246 3251 {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") 3248 3253 3249 3254 _describe -t boolean 'boolean' booleans … … 3261 3266 {true,yes}':warn if a ref name matches multiple refs' 3262 3267 {false,no}':ignore ambiguous ref names') 3263 3268 3264 3269 _describe -t boolean 'boolean' booleans 3265 3270 ;; … … 3354 3359 settings=( 3355 3360 {true,yes}':enable basic rename detection' 3356 {false,no} ':don'\''t try to detect renames'3361 {false,no}":don't try to detect renames" 3357 3362 {copies,copy}':detect file renames and copies') 3358 3363 … … 3388 3393 booleans=( 3389 3394 {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") 3391 3396 3392 3397 _describe -t booleans 'boolean' booleans … … 3473 3478 3474 3479 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)" 3476 3481 {false,no}':use EPSV mode over FTP') 3477 3482 … … 3496 3501 booleans=( 3497 3502 {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)") 3499 3504 3500 3505 _describe -t booleans 'boolean' booleans … … 3552 3557 3553 3558 opts=( 3554 '--no-tags:don'\''t fetch tags automatically'3559 "--no-tags:don't fetch tags automatically" 3555 3560 '"":fetch tags as usual') 3556 3561 … … 3576 3581 booleas=( 3577 3582 {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") 3579 3584 3580 3585 _describe -t booleans 'boolean' booleans … … 3590 3595 _alternative \ 3591 3596 '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\"))" 3593 3598 ;; 3594 3599 ((#i)user.email) … … 3609 3614 3610 3615 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") 3613 3618 3614 3619 _describe -t booleans 'boolean' booleans … … 3638 3643 booleans=( 3639 3644 {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") 3641 3646 3642 3647 _describe -t booleans 'boolean' booleans … … 3671 3676 booleans=( 3672 3677 {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") 3674 3679 3675 3680 _describe -t booleans 'boolean' booleans … … 3743 3748 ;; 3744 3749 ((#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" 3746 3751 ;; 3747 3752 ((#i)svn.fetch-all) … … 3749 3754 ;; 3750 3755 ((#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" 3752 3757 ;; 3753 3758 ((#i)svn.strategy) … … 3770 3775 ;; 3771 3776 ((#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" 3773 3778 ;; 3774 3779 ((#i)svn.online) … … 3806 3811 # -t can be used to specify a tag to use (default: booleans). 3807 3812 # -l can be used to specify a label to use (default: 'boolean'). 3808 # 3813 # 3809 3814 # The first argument is the default value, so that the description of the 3810 3815 # default value can be suffixed with " (default)". The second argument … … 3815 3820 (( $+functions[__git_boolean_settings] )) || 3816 3821 __git_boolean_settings () { 3817 local tag label garbage 3822 local tag label garbage 3818 3823 3819 3824 zparseopts -D -E -a garba S: M: J: V: 1 2 n F: X: -t=tag -l=label … … 3821 3826 declare -A descriptions 3822 3827 3823 descriptions=(true $2 false 'don'\''t '"$2")3828 descriptions=(true $2 false "don't $2") 3824 3829 3825 3830 if (( $# > 2 )); then … … 4086 4091 '--full-history[undocumented]' 4087 4092 '--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\"" 4091 4096 '--author=-[limit commits to those by the given author]:author' 4092 4097 '--committer=-[limit commits to those by the given committer]:committer' … … 4109 4114 4110 4115 local curcontext=$curcontext ret=1 4111 4112 # fun with $words[] and $CURRENT to enable completion for args4113 # to git aliases (eg. git co <TAB>)4114 local -A git_aliases4115 # TODO: filling git_aliases like this is ugly. I didn't get it working elegantly.4116 local oifs=$IFS4117 IFS=$'\0'4118 git_aliases=(${=${(0)${(@)${${${(f)"$(git config --get-regexp alias.\*)"}/(#s)alias./}/ /$'\0'}}}})4119 IFS=$oifs ; unset oifs4120 4121 if (( CURRENT >= 3 )) && [[ -n ${git_aliases[$words[2]]} ]] ; then4122 local -a tmpwords4123 tmpwords=(${words[1]} ${(z)git_aliases[$words[2]]})4124 if [[ -z "${words[3,-1]}" ]] ; then4125 tmpwords[$(( ${#tmpwords} + 1 ))]=""4126 else4127 tmpwords+=("${words[3,-1]}")4128 fi4129 words=("${tmpwords[@]}")4130 (( CURRENT += ${#${(z)git_aliases[$words[2]]}} - 1 ))4131 unset tmpwords4132 fi4133 4116 4134 4117 if [[ $words[1] == git ]]; then
