{"thread":{"id":"43561","subject":"[PATCH] Teach bash the new features of 'git show'.","startedAt":"2006-12-15T07:20:03Z","lastAt":"2006-12-15T07:20:03Z","messageCount":1,"participants":["Shawn O. Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"295530","messageId":"20061215072003.GA28031@spearce.org","threadId":"43561","inReplyTo":null,"subject":"[PATCH] Teach bash the new features of 'git show'.","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-12-15T07:20:03Z","receivedAt":"2006-12-15T07:20:03Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Now that 'git show' accepts ref:path as an argument to specify a\ntree or blob we should use the same completion logic as we support\nfor cat-file's object identifier.\n\nSigned-off-by: Shawn O. Pearce <spearce@spearce.org>\n---\n contrib/completion/git-completion.bash |   24 +++++++++++++++++++++---\n 1 files changed, 21 insertions(+), 3 deletions(-)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 9c4d23a..234cd09 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -752,6 +752,24 @@ _git_reset ()\n \tCOMPREPLY=($(compgen -W \"$opt $(__git_refs)\" -- \"$cur\"))\n }\n \n+_git_show ()\n+{\n+\tlocal cur=\"${COMP_WORDS[COMP_CWORD]}\"\n+\tcase \"$cur\" in\n+\t--pretty=*)\n+\t\tCOMPREPLY=($(compgen -W \"\n+\t\t\toneline short medium full fuller email raw\n+\t\t\t\" -- \"${cur##--pretty=}\"))\n+\t\treturn\n+\t\t;;\n+\t--*)\n+\t\tCOMPREPLY=($(compgen -W \"--pretty=\" -- \"$cur\"))\n+\t\treturn\n+\t\t;;\n+\tesac\n+\t__git_complete_file\n+}\n+\n _git ()\n {\n \tlocal i c=1 command __git_dir\n@@ -802,7 +820,7 @@ _git ()\n \trebase)      _git_rebase ;;\n \trepo-config) _git_repo_config ;;\n \treset)       _git_reset ;;\n-\tshow)        _git_log ;;\n+\tshow)        _git_show ;;\n \tshow-branch) _git_log ;;\n \twhatchanged) _git_log ;;\n \t*)           COMPREPLY=() ;;\n@@ -839,7 +857,7 @@ complete -o default -o nospace -F _git_push git-push\n complete -o default            -F _git_rebase git-rebase\n complete -o default            -F _git_repo_config git-repo-config\n complete -o default            -F _git_reset git-reset\n-complete -o default            -F _git_log git-show\n+complete -o default -o nospace -F _git_show git-show\n complete -o default -o nospace -F _git_log git-show-branch\n complete -o default -o nospace -F _git_log git-whatchanged\n \n@@ -861,7 +879,7 @@ complete -o default            -F _git_merge_base git-merge-base.exe\n complete -o default            -F _git_name_rev git-name-rev.exe\n complete -o default -o nospace -F _git_push git-push.exe\n complete -o default            -F _git_repo_config git-repo-config\n-complete -o default -o nospace -F _git_log git-show.exe\n+complete -o default -o nospace -F _git_show git-show.exe\n complete -o default -o nospace -F _git_log git-show-branch.exe\n complete -o default -o nospace -F _git_log git-whatchanged.exe\n fi\n-- \n"}]}