On Sun, Sep 30, 2007 at 07:46:25PM +0200, Romain Francoise wrote:
> zsh doesn't know about git-mergetool. If you add it, having completion
> for unmerged files would be nice (but it's probably a bit tricky to
> implement because git-ls-files --unmerged implies --stage).
Maybe someone has an idea about that.
Index: Completion/Unix/Command/_git
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_git,v
retrieving revision 1.32
diff -u -r1.32 _git
--- Completion/Unix/Command/_git 30 Sep 2007 11:29:36 -0000 1.32
+++ Completion/Unix/Command/_git 30 Sep 2007 18:15:07 -0000
@@ -1,4 +1,4 @@
-#compdef git git-add git-am git-annotate git-apply git-applymbox
git-applypatch git-archimport git-archive git-bisect git-blame git-branch
git-cat-file git-check-attr git-check-ref-format git-checkout
git-checkout-index git-cherry git-cherry-pick git-clean git-clone
git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects
git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe
git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree
git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref
git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object
git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb
git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree
git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file
git-merge-index git-merge-one-file git-merge-tree git-mktag git-mktree git-mv
git-name-rev git-octopus git-pack-objects git-pack-redundant git-pack-refs
git-patch-id git-peek-remote git-prune git-prune-packed git-pull git-push
git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog git-relink
git-remote git-repack gut-runstatus git-config git-request-pull git-rerere
git-reset git-rev-list git-rev-parse git-revert git-rm git-send-email
git-send-pack git-sh-setup git-shell git-shortlog git-show git-show-branch
git-show-index git-show-ref git-ssh-fetch git-ssh-upload git-status
git-stripspace git-svn git-svnimport git-symbolic-ref git-tag git-tar-tree
git-unpack-file git-unpack-objects git-update-index git-update-ref
git-update-server-info git-upload-archive git-upload-pack git-var
git-verify-pack git-verify-tag git-whatchanged git-write-tree
+#compdef git git-add git-am git-annotate git-apply git-applymbox
git-applypatch git-archimport git-archive git-bisect git-blame git-branch
git-cat-file git-check-attr git-check-ref-format git-checkout
git-checkout-index git-cherry git-cherry-pick git-clean git-clone
git-clone-pack git-commit git-commit-tree git-convert-objects git-count-objects
git-cvsexportcommit git-cvsimport git-cvsserver git-daemon git-describe
git-diff git-diff-files git-diff-index git-diff-stages git-diff-tree
git-fast-import git-fetch git-fetch-pack git-fmt-merge-msg git-for-each-ref
git-format-patch git-fsck git-gc git-get-tar-commit-id git-grep git-hash-object
git-http-fetch git-http-push git-imap-send git-index-pack git-init git-instaweb
git-local-fetch git-log git-lost-found git-ls-files git-ls-remote git-ls-tree
git-mailinfo git-mailsplit git-merge git-merge-base git-merge-file
git-merge-index git-merge-one-file git-merge-tree git-mergetool git-mktag
git-mktree git-mv git-name-rev git-octopus git-pack-objects git-pack-redundant
git-pack-refs git-patch-id git-peek-remote git-prune git-prune-packed git-pull
git-push git-quiltimport git-read-tree git-rebase git-receive-pack git-reflog
git-relink git-remote git-repack gut-runstatus git-config git-request-pull
git-rerere git-reset git-rev-list git-rev-parse git-revert git-rm
git-send-email git-send-pack git-sh-setup git-shell git-shortlog git-show
git-show-branch git-show-index git-show-ref git-ssh-fetch git-ssh-upload
git-status git-stripspace git-svn git-svnimport git-symbolic-ref git-tag
git-tar-tree git-unpack-file git-unpack-objects git-update-index git-update-ref
git-update-server-info git-upload-archive git-upload-pack git-var
git-verify-pack git-verify-tag git-whatchanged git-write-tree
# TODO: All if (( words[(I)-option] )) should be turned into
# if (( words[(I)-option] > 0 && words[(I)-option] < CURRENT )), as the user
@@ -260,7 +260,8 @@
'hash-object:compute object ID from a file'
'patch-id:compute unique ID for a patch'
'fsck:verify the connectivity and validity of the objects in the database'
- 'lost-found:recover lost references that luckily have not yet been pruned')
+ 'lost-found:recover lost references that luckily have not yet been pruned'
+ 'mergetool:run merge conflict resolution tools to resolve merge conflicts')
local -a internal_commands
internal_commands=(
@@ -2491,6 +2492,16 @@
_message 'no arguments allowed; accepts input file on standard input'
}
+(( $+functions[_git-mergetool] )) ||
+_git-mergetool () {
+ local curcontext=$curcontext state line
+ typeset -A opt_args
+
+ _arguments -C \
+ '(-t --tool)'{-t,--tool=}':merge resolution tool:(kdiff3 tkdiff meld
xxdiff emerge vimdiff gvimdiff opendiff)' \
+ '*:conflicted file:_files' && ret=0
+}
+
# ---
(( $+functions[__git_guard] )) ||