From 6123d7196fdd9ac9aed24b4aeed854813fe9a6b1 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Sat, 25 Apr 2009 13:46:14 +0200 Subject: bash completion: show-branch color support This implements completion of --color and --no-color for "git show-branch" and color.showbranch for "git config". Signed-off-by: Markus Heidelberg Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1a90cb87f5..b588387262 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1333,7 +1333,8 @@ _git_config () __gitcomp "$(__git_merge_strategies)" return ;; - color.branch|color.diff|color.interactive|color.status|color.ui) + color.branch|color.diff|color.interactive|\ + color.showbranch|color.status|color.ui) __gitcomp "always never auto" return ;; @@ -1415,6 +1416,7 @@ _git_config () color.interactive.help color.interactive.prompt color.pager + color.showbranch color.status color.status.added color.status.changed @@ -1676,6 +1678,7 @@ _git_show_branch () __gitcomp " --all --remotes --topo-order --current --more= --list --independent --merge-base --no-name + --color --no-color --sha1-name --topics --reflog " return -- cgit v1.2.3 From 00652369ff285f84e440f5d41d708283e30825d7 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Fri, 8 May 2009 18:23:32 -0700 Subject: bash completion: complete variable names for "git config" with options This makes it easier for users to get and unset their configuration variables without having to open documentation or dig through their configuration file. __git_config_get_set_variables() retrieves the set configuration variables from the appropriate configuration file. For example, if the user has previously specified --global only the global variables are returned. The same applies for --system, and --file. If no location has been specified, all set variables are returned. Signed-off-by: Stephen Boyd Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1683e6d7b8..ad26b7c5ae 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1322,6 +1322,35 @@ _git_send_email () COMPREPLY=() } +__git_config_get_set_variables () +{ + local prevword word config_file= c=$COMP_CWORD + while [ $c -gt 1 ]; do + word="${COMP_WORDS[c]}" + case "$word" in + --global|--system|--file=*) + config_file="$word" + break + ;; + -f|--file) + config_file="$word $prevword" + break + ;; + esac + prevword=$word + c=$((--c)) + done + + for i in $(git --git-dir="$(__gitdir)" config $config_file --list \ + 2>/dev/null); do + case "$i" in + *.*) + echo "${i/=*/}" + ;; + esac + done +} + _git_config () { local cur="${COMP_WORDS[COMP_CWORD]}" @@ -1388,6 +1417,10 @@ _git_config () __gitcomp "$__git_send_email_suppresscc_options" return ;; + --get|--get-all|--unset|--unset-all) + __gitcomp "$(__git_config_get_set_variables)" + return + ;; *.*) COMPREPLY=() return -- cgit v1.2.3 From 8763dbb1b24c260243f69130c734c13563a16db6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 16 May 2009 11:46:22 -0700 Subject: completion: fix PS1 display during a merge on detached HEAD If your merge stops in a conflict while on a detached HEAD, recent completion code fails to show anything. This was because various cases added to support the operation-in-progress markers (e.g. REBASE, MERGING) forgot that they need to set the variable "b" to something for the result they computed to be displayed at all. Probably not many people make trial merges on a detached HEAD (which is tremendously useful feature of git, by the way), and that may be why this was not noticed for a long time. Acked-By: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1683e6d7b8..c2f8ea3444 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -99,10 +99,10 @@ __git_ps1 () elif [ -d "$g/rebase-merge" ]; then r="|REBASE-m" b="$(cat "$g/rebase-merge/head-name")" - elif [ -f "$g/MERGE_HEAD" ]; then - r="|MERGING" - b="$(git symbolic-ref HEAD 2>/dev/null)" else + if [ -f "$g/MERGE_HEAD" ]; then + r="|MERGING" + fi if [ -f "$g/BISECT_LOG" ]; then r="|BISECTING" fi -- cgit v1.2.3 From ff790b6a4bb7fa3bbccd5ea23cefd89da900aa2e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 10 May 2009 01:53:19 -0700 Subject: completion: simplify "current branch" in __git_ps1() As I very often work on a detached HEAD, I found it pretty confusing when __git_ps1() said 'some-name'. Did I create a branch with that name by mistake, or do I happen to be on a commit with that exact tag? This patch fixes the issue by enclosing non branch names in a pair of parentheses when used to substitute %s token in __git_ps1() argument. It also fixes a small bug where the branch part is left empty when .git/HEAD is unreadable for whatever reason. The output now says "(unknown)". Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c2f8ea3444..be591468db 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -106,13 +106,14 @@ __git_ps1 () if [ -f "$g/BISECT_LOG" ]; then r="|BISECTING" fi - if ! b="$(git symbolic-ref HEAD 2>/dev/null)"; then - if ! b="$(git describe --exact-match HEAD 2>/dev/null)"; then - if [ -r "$g/HEAD" ]; then - b="$(cut -c1-7 "$g/HEAD")..." - fi - fi - fi + + b="$(git symbolic-ref HEAD 2>/dev/null)" || { + b="$(git describe --exact-match HEAD 2>/dev/null)" || + b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || + b="unknown" + + b="($b)" + } fi local w -- cgit v1.2.3 From dd42c2f015102626562da05bb290f47862ea06fb Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sun, 10 May 2009 01:56:21 -0700 Subject: completion: enhance "current branch" display Introduce GIT_PS1_DESCRIBE option you can set to "contains", "branch", or "describe" to tweak the way how a detached HEAD is described. The default behaviour is to describe only exact match with some tag (otherwise use the first 7 hexdigits) as before. Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index be591468db..dd6cd250e3 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -108,10 +108,21 @@ __git_ps1 () fi b="$(git symbolic-ref HEAD 2>/dev/null)" || { - b="$(git describe --exact-match HEAD 2>/dev/null)" || + + b="$( + case "${GIT_PS1_DESCRIBE_STYLE-}" in + (contains) + git describe --contains HEAD ;; + (branch) + git describe --contains --all HEAD ;; + (describe) + git describe HEAD ;; + (* | default) + git describe --exact-match HEAD ;; + esac 2>/dev/null)" || + b="$(cut -c1-7 "$g/HEAD" 2>/dev/null)..." || b="unknown" - b="($b)" } fi -- cgit v1.2.3 From 076c32370d8a6ac2fb57b2a55c674942e106f8ab Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Sat, 16 May 2009 20:42:43 -0700 Subject: completion: add missing options to show-branch and show Add --oneline and --abbrev-commit to show and --sparse to show-branch. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index dd6cd250e3..a0c5794828 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1804,7 +1804,7 @@ _git_show () return ;; --*) - __gitcomp "--pretty= --format= + __gitcomp "--pretty= --format= --abbrev-commit --oneline $__git_diff_common_options " return @@ -1821,7 +1821,7 @@ _git_show_branch () __gitcomp " --all --remotes --topo-order --current --more= --list --independent --merge-base --no-name - --sha1-name --topics --reflog + --sha1-name --sparse --topics --reflog " return ;; -- cgit v1.2.3 From 8dfb17e1fd7dec1d3a1978eb46743964c481cd08 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 18 May 2009 18:24:30 +0200 Subject: completion: use git rev-parse to detect bare repos Its check is more robust than a config check for core.bare Trivially-Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index a0c5794828..f44152c433 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -132,7 +132,7 @@ __git_ps1 () local c if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then - if [ "true" = "$(git config --bool core.bare 2>/dev/null)" ]; then + if [ "true" = "$(git rev-parse --is-bare-repository 2>/dev/null)" ]; then c="BARE:" else b="GIT_DIR!" -- cgit v1.2.3 From b6f0621a462e4ff11999c8e2d8279c0ffd3be201 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sun, 24 May 2009 00:24:41 +0000 Subject: mergetool--lib: add support for araxis merge Araxis merge is now a built-in diff/merge tool. This adds araxis to git-completion and updates the documentation to mention araxis. Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1683e6d7b8..ead530d3a3 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -911,7 +911,7 @@ _git_diff () } __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff - tkdiff vimdiff gvimdiff xxdiff + tkdiff vimdiff gvimdiff xxdiff araxis " _git_difftool () -- cgit v1.2.3 From d7107ca65f79c2d95bc327bee44c09073b4de631 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 25 May 2009 22:56:03 -0700 Subject: completion: fix PS1 display during an AM on detached HEAD This is a companion patch to previous 8763dbb (completion: fix PS1 display during a merge on detached HEAD, 2009-05-16). While rebasing or running am on a detached HEAD, the code failed to set $b (branch description) that enables the whole status display business. Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 0c8bb536c8..c84d765ff9 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -84,26 +84,24 @@ __git_ps1 () if [ -n "$g" ]; then local r local b - if [ -d "$g/rebase-apply" ]; then - if [ -f "$g/rebase-apply/rebasing" ]; then - r="|REBASE" - elif [ -f "$g/rebase-apply/applying" ]; then - r="|AM" - else - r="|AM/REBASE" - fi - b="$(git symbolic-ref HEAD 2>/dev/null)" - elif [ -f "$g/rebase-merge/interactive" ]; then + if [ -f "$g/rebase-merge/interactive" ]; then r="|REBASE-i" b="$(cat "$g/rebase-merge/head-name")" elif [ -d "$g/rebase-merge" ]; then r="|REBASE-m" b="$(cat "$g/rebase-merge/head-name")" else - if [ -f "$g/MERGE_HEAD" ]; then + if [ -d "$g/rebase-apply" ]; then + if [ -f "$g/rebase-apply/rebasing" ]; then + r="|REBASE" + elif [ -f "$g/rebase-apply/applying" ]; then + r="|AM" + else + r="|AM/REBASE" + fi + elif [ -f "$g/MERGE_HEAD" ]; then r="|MERGING" - fi - if [ -f "$g/BISECT_LOG" ]; then + elif [ -f "$g/BISECT_LOG" ]; then r="|BISECTING" fi -- cgit v1.2.3 From ee6b71141f2803bd4d4f6e1a17ef826567dc9644 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Fri, 29 May 2009 14:00:36 +0200 Subject: bash: remove always true if statement from __git_ps1() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The recent commits 8763dbb1 (completion: fix PS1 display during a merge on detached HEAD, 2009-05-16), ff790b6a (completion: simplify "current branch" in __git_ps1(), 2009-05-10), and d7107ca6 (completion: fix PS1 display during an AM on detached HEAD, 2009-05-26) ensure that the branch name in __git_ps1() is always set to something sensible. Therefore, the condition for checking the non-empty branch name is always fulfilled, and can be removed. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c84d765ff9..98b9cbedc2 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -150,12 +150,10 @@ __git_ps1 () fi fi - if [ -n "$b" ]; then - if [ -n "${1-}" ]; then - printf "$1" "$c${b##refs/heads/}$w$i$r" - else - printf " (%s)" "$c${b##refs/heads/}$w$i$r" - fi + if [ -n "${1-}" ]; then + printf "$1" "$c${b##refs/heads/}$w$i$r" + else + printf " (%s)" "$c${b##refs/heads/}$w$i$r" fi fi } -- cgit v1.2.3 From 2414b45ce0c56f7744e00e7fef3682a77375701e Mon Sep 17 00:00:00 2001 From: Daniel Trstenjak Date: Tue, 2 Jun 2009 20:03:22 +0200 Subject: Show presence of stashed changes in bash prompt. Add a '$' in the __git_ps1 output to show stashed changes are present, when GIT_PS1_SHOWSTASHSTATE is set to a nonempty value. The code for checking if the stash has entries is taken from 'git-stash.sh'. Signed-off-by: Daniel Trstenjak Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 98b9cbedc2..80190a6b16 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -40,6 +40,10 @@ # with the bash.showDirtyState variable, which defaults to true # once GIT_PS1_SHOWDIRTYSTATE is enabled. # +# You can also see if currently something is stashed, by setting +# GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed, +# then a '$' will be shown next to the branch name. +# # To submit patches: # # *) Read Documentation/SubmittingPatches @@ -127,6 +131,7 @@ __git_ps1 () local w local i + local s local c if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then @@ -148,12 +153,15 @@ __git_ps1 () fi fi fi + if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then + git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" + fi fi if [ -n "${1-}" ]; then - printf "$1" "$c${b##refs/heads/}$w$i$r" + printf "$1" "$c${b##refs/heads/}$w$i$s$r" else - printf " (%s)" "$c${b##refs/heads/}$w$i$r" + printf " (%s)" "$c${b##refs/heads/}$w$i$s$r" fi fi } -- cgit v1.2.3 From 8513c54b2a4a821336d10fae6e02db70f0876abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 9 Jun 2009 00:57:39 +0200 Subject: bash: add support for 'git stash pop --index' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 80190a6b16..cc94ef44b2 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1881,10 +1881,10 @@ _git_stash () save,--*) __gitcomp "--keep-index" ;; - apply,--*) + apply,--*|pop,--*) __gitcomp "--index" ;; - show,--*|drop,--*|pop,--*|branch,--*) + show,--*|drop,--*|branch,--*) COMPREPLY=() ;; show,*|apply,*|drop,*|pop,*|branch,*) -- cgit v1.2.3 From cb8a9bd518002dd4fb693df6230b4976bafc15e0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 18 Jun 2009 14:31:32 +0200 Subject: Test cccmd in t9001-send-email.sh and fix some bugs For another patch series I'm working on I needed some tests for the cc-cmd feature of git-send-email. This patch adds 3 tests for the feature and for the possibility to specify --suppress-cc multiple times, and fixes two bugs. The first bug is that the --suppress-cc option for `cccmd' was misspelled as `ccmd' in the code. The second bug, which is actually found only with my other series, is that the argument to the cccmd is never quoted, so the cccmd would fail with patch file names containing a space. A third bug I fix (in the docs) is that the bodycc argument was actually spelled ccbody in the documentation and bash completion. Signed-off-by: Paolo Bonzini Cc: Markus Heidelberg Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 80ab4e45eb..b60cb68a8b 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1299,7 +1299,7 @@ _git_rebase () } __git_send_email_confirm_options="always never auto cc compose" -__git_send_email_suppresscc_options="author self cc ccbody sob cccmd body all" +__git_send_email_suppresscc_options="author self cc bodycc sob cccmd body all" _git_send_email () { -- cgit v1.2.3 From 6fac1b83bdb9aee73363f93874ffaffd1bc3ad5c Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Mon, 29 Jun 2009 21:24:24 -0700 Subject: completion: add missing config variables Update to include branch.*.rebase, remote.*.pushurl, and add.ignore-errors Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index b60cb68a8b..ddb71e26fe 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1457,7 +1457,7 @@ _git_config () branch.*.*) local pfx="${cur%.*}." cur="${cur##*.}" - __gitcomp "remote merge mergeoptions" "$pfx" "$cur" + __gitcomp "remote merge mergeoptions rebase" "$pfx" "$cur" return ;; branch.*) @@ -1504,7 +1504,7 @@ _git_config () cur="${cur##*.}" __gitcomp " url proxy fetch push mirror skipDefaultUpdate - receivepack uploadpack tagopt + receivepack uploadpack tagopt pushurl " "$pfx" "$cur" return ;; @@ -1522,6 +1522,7 @@ _git_config () ;; esac __gitcomp " + add.ignore-errors alias. apply.whitespace branch.autosetupmerge -- cgit v1.2.3 From 5d0e634343bf83735b59c611b96c1d0f8ff2b28a Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Wed, 3 Jun 2009 16:20:58 -0400 Subject: completion: Add --full-diff to log options Signed-off-by: Todd Zullinger Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index ddb71e26fe..1f44ec2092 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1165,7 +1165,7 @@ _git_log () $__git_log_shortlog_options $__git_log_gitk_options --root --topo-order --date-order --reverse - --follow + --follow --full-diff --abbrev-commit --abbrev= --relative-date --date= --pretty= --format= --oneline -- cgit v1.2.3 From f581de1b7b9d17c83b188bf8ffe536fb8a9dd2a4 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Mon, 29 Jun 2009 22:08:38 -0700 Subject: completion: __git_config_get_set_variables() handle values with spaces Commit 0065236 (bash completion: complete variable names for "git config" with options 2009-05-08) implemented its config variable search wrong. When a config contains a value with a space and a period (.) in it, completion erroneously thinks that line in the configuration is multiple config variables. For example $ cat .git/config format.cc = Junio C Hamano $ git config --unset format.cc Instead of using a for loop splitting across spaces, pipe each line to a while read loop and beef up the case statement to match only 'config.variable=value'. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1f44ec2092..9c488646d0 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1357,11 +1357,12 @@ __git_config_get_set_variables () c=$((--c)) done - for i in $(git --git-dir="$(__gitdir)" config $config_file --list \ - 2>/dev/null); do - case "$i" in - *.*) - echo "${i/=*/}" + git --git-dir="$(__gitdir)" config $config_file --list 2>/dev/null | + while read line + do + case "$line" in + *.*=*) + echo "${line/=*/}" ;; esac done -- cgit v1.2.3 From 4fe1a61973c82c459ac0a25cb5342d00d347dfd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Mon, 13 Jul 2009 17:11:45 +0200 Subject: bash: add '--merges' to common 'git log' options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so it's available for git log, shortlog and gitk. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 9c488646d0..887731e830 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1114,7 +1114,7 @@ _git_ls_tree () __git_log_common_options=" --not --all --branches --tags --remotes - --first-parent --no-merges + --first-parent --merges --no-merges --max-count= --max-age= --since= --after= --min-age= --until= --before= -- cgit v1.2.3 From a91f453f641ca9966a438bdd3896656b00423407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kiedrowicz?= Date: Wed, 22 Jul 2009 19:52:15 +0200 Subject: grep: Add --max-depth option. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is useful to grep directories non-recursively, e.g. when one wants to look for all files in the toplevel directory, but not in any subdirectory, or in Documentation/, but not in Documentation/technical/. This patch adds support for --max-depth option to git-grep. If it is given, git-grep descends at most levels of directories below paths specified on the command line. Note that if path specified on command line contains wildcards, this option makes no sense, e.g. $ git grep -l --max-depth 0 GNU -- 'contrib/*' (note the quotes) will search all files in contrib/, even in subdirectories, because '*' matches all files. Documentation updates, bash-completion and simple test cases are also provided. Signed-off-by: Michał Kiedrowicz Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 887731e830..fb05c4884c 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1036,6 +1036,7 @@ _git_grep () --extended-regexp --basic-regexp --fixed-strings --files-with-matches --name-only --files-without-match + --max-depth --count --and --or --not --all-match " -- cgit v1.2.3 From 397f7c6371d309aa399bf32b773397f3c068d0c9 Mon Sep 17 00:00:00 2001 From: Daniel Trstenjak Date: Wed, 22 Jul 2009 10:31:34 +0200 Subject: Show the presence of untracked files in the bash prompt. Added the envvar GIT_PS1_SHOWUNTRACKEDFILES to 'git-completion.bash'. When set to a nonempty value, then the char '%' will be shown next to the branch name in the bash prompt. Signed-off-by: Daniel Trstenjak Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 887731e830..745b5fb78b 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -44,6 +44,10 @@ # GIT_PS1_SHOWSTASHSTATE to a nonempty value. If something is stashed, # then a '$' will be shown next to the branch name. # +# If you would like to see if there're untracked files, then you can +# set GIT_PS1_SHOWUNTRACKEDFILES to a nonempty value. If there're +# untracked files, then a '%' will be shown next to the branch name. +# # To submit patches: # # *) Read Documentation/SubmittingPatches @@ -132,6 +136,7 @@ __git_ps1 () local w local i local s + local u local c if [ "true" = "$(git rev-parse --is-inside-git-dir 2>/dev/null)" ]; then @@ -156,12 +161,18 @@ __git_ps1 () if [ -n "${GIT_PS1_SHOWSTASHSTATE-}" ]; then git rev-parse --verify refs/stash >/dev/null 2>&1 && s="$" fi + + if [ -n "${GIT_PS1_SHOWUNTRACKEDFILES-}" ]; then + if [ -n "$(git ls-files --others --exclude-standard)" ]; then + u="%" + fi + fi fi if [ -n "${1-}" ]; then - printf "$1" "$c${b##refs/heads/}$w$i$s$r" + printf "$1" "$c${b##refs/heads/}$w$i$s$u$r" else - printf " (%s)" "$c${b##refs/heads/}$w$i$s$r" + printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r" fi fi } -- cgit v1.2.3 From 86c91f91794cd6af8e19fbe68ab283d567d2b66f Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Tue, 4 Aug 2009 13:16:49 +0200 Subject: git apply: option to ignore whitespace differences Introduce --ignore-whitespace option and corresponding config bool to ignore whitespace differences while applying patches, akin to the 'patch' program. 'git am', 'git rebase' and the bash git completion are made aware of this option. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 3 +++ 1 file changed, 3 insertions(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 745b5fb78b..dd7ec5dd66 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -674,6 +674,7 @@ _git_am () --*) __gitcomp " --3way --committer-date-is-author-date --ignore-date + --ignore-whitespace --ignore-space-change --interactive --keep --no-utf8 --signoff --utf8 --whitespace= " @@ -695,6 +696,7 @@ _git_apply () --stat --numstat --summary --check --index --cached --index-info --reverse --reject --unidiff-zero --apply --no-add --exclude= + --ignore-whitespace --ignore-space-change --whitespace= --inaccurate-eof --verbose " return @@ -1536,6 +1538,7 @@ _git_config () __gitcomp " add.ignore-errors alias. + apply.ignorewhitespace apply.whitespace branch.autosetupmerge branch.autosetuprebase -- cgit v1.2.3 From 1c2eafb89bcaf2ddbf4dfb93df19673c0fadaaeb Mon Sep 17 00:00:00 2001 From: Josh Triplett Date: Mon, 7 Sep 2009 01:56:33 -0700 Subject: Add url..pushInsteadOf: URL rewriting for push only This configuration option allows systematically rewriting fetch-only URLs to push-capable URLs when used with push. For instance: [url "ssh://example.org/"] pushInsteadOf = "git://example.org/" This will allow clones of "git://example.org/path/to/repo" to subsequently push to "ssh://example.org/path/to/repo", without manually configuring pushurl for that remote. Includes documentation for the new option, bash completion updates, and test cases (both that pushInsteadOf applies to push, that it does not apply to fetch, and that it is ignored when pushURL is already defined). Signed-off-by: Josh Triplett Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index bf688e12e6..98592040d1 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1532,7 +1532,7 @@ _git_config () url.*.*) local pfx="${cur%.*}." cur="${cur##*.}" - __gitcomp "insteadof" "$pfx" "$cur" + __gitcomp "insteadOf pushInsteadOf" "$pfx" "$cur" return ;; esac -- cgit v1.2.3 From 518ef8f07f72271dff4040c1e7452ab6de73d199 Mon Sep 17 00:00:00 2001 From: Todd Zullinger Date: Fri, 11 Sep 2009 19:23:45 -0400 Subject: completion: Replace config --list with --get-regexp James Bardin noted that the completion spewed warnings when no git config file is present. This is likely a bug to be fixed in git config, but it's also good to simplify the completion code by using the --get-regexp option as Jeff King pointed out. Signed-off-by: Todd Zullinger Trivially-acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 98592040d1..2d2d5794ad 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -318,13 +318,9 @@ __git_remotes () echo ${i#$d/remotes/} done [ "$ngoff" ] && shopt -u nullglob - for i in $(git --git-dir="$d" config --list); do - case "$i" in - remote.*.url=*) - i="${i#remote.}" - echo "${i/.url=*/}" - ;; - esac + for i in $(git --git-dir="$d" config --get-regexp 'remote\..*\.url' 2>/dev/null); do + i="${i#remote.}" + echo "${i/.url*/}" done } @@ -605,13 +601,9 @@ __git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)" __git_aliases () { local i IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --list); do - case "$i" in - alias.*) - i="${i#alias.}" - echo "${i/=*/}" - ;; - esac + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do + i="${i#alias.}" + echo "${i/ */}" done } @@ -1769,13 +1761,9 @@ _git_remote () ;; update) local i c='' IFS=$'\n' - for i in $(git --git-dir="$(__gitdir)" config --list); do - case "$i" in - remotes.*) - i="${i#remotes.}" - c="$c ${i/=*/}" - ;; - esac + for i in $(git --git-dir="$(__gitdir)" config --get-regexp "remotes\..*" 2>/dev/null); do + i="${i#remotes.}" + c="$c ${i/ */}" done __gitcomp "$c" ;; -- cgit v1.2.3 From 918c03c2a7c8730dcfd413098b3dc05fa0f3166d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 15 Sep 2009 12:21:43 +0200 Subject: bash: rename __git_find_subcommand() to __git_find_on_cmdline() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit __git_find_subcommand() was originally meant to check whether subcommands are already present on the command line. But the code is general enough to be used for checking the presence of command line options as well, and the next commit will use it for that purpose, so let's give it a more general name. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2d2d5794ad..277af5e861 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -620,8 +620,8 @@ __git_aliased_command () done } -# __git_find_subcommand requires 1 argument -__git_find_subcommand () +# __git_find_on_cmdline requires 1 argument +__git_find_on_cmdline () { local word subcommand c=1 @@ -740,7 +740,7 @@ _git_bisect () __git_has_doubledash && return local subcommands="start bad good skip reset visualize replay log run" - local subcommand="$(__git_find_subcommand "$subcommands")" + local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" return @@ -1749,7 +1749,7 @@ _git_config () _git_remote () { local subcommands="add rename rm show prune update set-head" - local subcommand="$(__git_find_subcommand "$subcommands")" + local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" return @@ -1877,7 +1877,7 @@ _git_show_branch () _git_stash () { local subcommands='save list show apply clear drop pop create branch' - local subcommand="$(__git_find_subcommand "$subcommands")" + local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else @@ -1908,7 +1908,7 @@ _git_submodule () __git_has_doubledash && return local subcommands="add status init update summary foreach sync" - if [ -z "$(__git_find_subcommand "$subcommands")" ]; then + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) @@ -1930,7 +1930,7 @@ _git_svn () proplist show-ignore show-externals branch tag blame migrate " - local subcommand="$(__git_find_subcommand "$subcommands")" + local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then __gitcomp "$subcommands" else -- cgit v1.2.3 From 59d5eeee9f7e0cb71c10bde3da0fa01c3b3dbf8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 15 Sep 2009 12:21:44 +0200 Subject: bash: update 'git stash' completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update adds 'git stash (apply|pop) --quiet' and all options known to 'git stash save', and handles the DWIMery from 3c2eb80f (stash: simplify defaulting to "save" and reject unknown options, 2009-08-18). Care is taken to avoid offering subcommands in the DWIM case. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 277af5e861..7ebc61bf11 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1876,18 +1876,30 @@ _git_show_branch () _git_stash () { + local cur="${COMP_WORDS[COMP_CWORD]}" + local save_opts='--keep-index --no-keep-index --quiet --patch' local subcommands='save list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then - __gitcomp "$subcommands" + case "$cur" in + --*) + __gitcomp "$save_opts" + ;; + *) + if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then + __gitcomp "$subcommands" + else + COMPREPLY=() + fi + ;; + esac else - local cur="${COMP_WORDS[COMP_CWORD]}" case "$subcommand,$cur" in save,--*) - __gitcomp "--keep-index" + __gitcomp "$save_opts" ;; apply,--*|pop,--*) - __gitcomp "--index" + __gitcomp "--index --quiet" ;; show,--*|drop,--*|branch,--*) COMPREPLY=() -- cgit v1.2.3 From 9f040e9524c45a2f862b427ec78204625e09f50e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Tue, 15 Sep 2009 12:21:45 +0200 Subject: bash: teach 'git reset --patch' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7ebc61bf11..6fd7e1d329 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1780,7 +1780,7 @@ _git_reset () local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --*) - __gitcomp "--merge --mixed --hard --soft" + __gitcomp "--merge --mixed --hard --soft --patch" return ;; esac -- cgit v1.2.3 From e648f8b6d0dc6fb7e8c8e3ed47eec6b12aaf450a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Thu, 24 Sep 2009 14:23:15 +0200 Subject: bash: teach 'git checkout' options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SZEDER Gábor Signed-off-by: Shawn O. Pearce --- contrib/completion/git-completion.bash | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 6fd7e1d329..2c2a0d4614 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -810,7 +810,21 @@ _git_checkout () { __git_has_doubledash && return - __gitcomp "$(__git_refs)" + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --conflict=*) + __gitcomp "diff3 merge" "" "${cur##--conflict=}" + ;; + --*) + __gitcomp " + --quiet --ours --theirs --track --no-track --merge + --conflict= --patch + " + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac } _git_cherry () -- cgit v1.2.3 From af4e9e8c87d3e73056c4758279c4c8462fe5e573 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Wed, 7 Oct 2009 01:48:50 -0700 Subject: completion: update am, commit, and log git am learned --scissors, git commit learned --dry-run and git log learned --decorate=long|short recently. Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 2c2a0d4614..daccbcc33e 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -668,7 +668,7 @@ _git_am () --3way --committer-date-is-author-date --ignore-date --ignore-whitespace --ignore-space-change --interactive --keep --no-utf8 --signoff --utf8 - --whitespace= + --whitespace= --scissors " return esac @@ -894,6 +894,7 @@ _git_commit () __gitcomp " --all --author= --signoff --verify --no-verify --edit --amend --include --only --interactive + --dry-run " return esac @@ -1179,6 +1180,10 @@ _git_log () __gitcomp "$__git_log_date_formats" "" "${cur##--date=}" return ;; + --decorate=*) + __gitcomp "long short" "" "${cur##--decorate=}" + return + ;; --*) __gitcomp " $__git_log_common_options @@ -1191,7 +1196,7 @@ _git_log () --pretty= --format= --oneline --cherry-pick --graph - --decorate + --decorate --decorate= --walk-reflogs --parents --children $merge -- cgit v1.2.3 From 8fd2cfa7accd6b8f877014bf3e4bf8547b8e0d2a Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Wed, 7 Oct 2009 01:48:51 -0700 Subject: completion: add dirstat and friends to diff options Signed-off-by: Stephen Boyd Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 ++ 1 file changed, 2 insertions(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index daccbcc33e..88b1b3c7a0 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -927,6 +927,8 @@ __git_diff_common_options="--stat --numstat --shortstat --summary --inter-hunk-context= --patience --raw + --dirstat --dirstat= --dirstat-by-file + --dirstat-by-file= --cumulative " _git_diff () -- cgit v1.2.3 From 427e586b197c94961b548c8a25ed721651fc335e Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 8 Oct 2009 23:21:43 -0700 Subject: completion: fix completion of git After commit 511a3fc (wrap git's main usage string., 2009-09-12), the bash completion for git commands includes COMMAND and [ARGS] when it shouldn't. Fix this by grepping more strictly for a line with git commands. It's doubtful whether git will ever have commands starting with anything besides numbers and letters so this should be fine. At least by being stricter we'll know when we break the completion earlier. Signed-off-by: Stephen Boyd Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 88b1b3c7a0..652a47c772 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -496,7 +496,7 @@ __git_all_commands () return fi local i IFS=" "$'\n' - for i in $(git help -a|egrep '^ ') + for i in $(git help -a|egrep '^ [a-zA-Z0-9]') do case $i in *--*) : helper pattern;; -- cgit v1.2.3 From e0d78059540aab2e6ff720e7c940d7244cc12c18 Mon Sep 17 00:00:00 2001 From: Stephen Boyd Date: Thu, 8 Oct 2009 23:21:44 -0700 Subject: completion: fix alias listings with newlines Aliases with newlines have been a problem since commit 56fc25f (Bash completion support for remotes in .git/config., 2006-11-05). The chance of the problem occurring has been slim at best, until commit 518ef8f (completion: Replace config --list with --get-regexp, 2009-09-11) removed the case statement introduced by commit 56fc25f. Before removing the case statement, most aliases with newlines would work unless they were specially crafted as follows [alias] foo = "log -1 --pretty='format:%s\nalias.error=broken'" After removing the case statement, a more benign alias like [alias] whowhat = "log -1 --pretty='format:%an <%ae>\n%s'" wont-complete = ... would cause the completion to break badly. For now, revert the removal of the case statement until someone comes up with a better way to get keys from git-config. Signed-off-by: Stephen Boyd Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 652a47c772..e482c8d076 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -602,8 +602,12 @@ __git_aliases () { local i IFS=$'\n' for i in $(git --git-dir="$(__gitdir)" config --get-regexp "alias\..*" 2>/dev/null); do - i="${i#alias.}" - echo "${i/ */}" + case "$i" in + alias.*) + i="${i#alias.}" + echo "${i/ */}" + ;; + esac done } -- cgit v1.2.3 From e1c1a0674b5848eb3207a29d5513c9112c72d10c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Fri, 9 Oct 2009 22:49:06 +0200 Subject: bash: add support for 'git replace' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Gustavsson Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index e482c8d076..7cf8557468 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1798,6 +1798,11 @@ _git_remote () esac } +_git_replace () +{ + __gitcomp "$(__git_refs)" +} + _git_reset () { __git_has_doubledash && return @@ -2166,6 +2171,7 @@ _git () push) _git_push ;; rebase) _git_rebase ;; remote) _git_remote ;; + replace) _git_replace ;; reset) _git_reset ;; revert) _git_revert ;; rm) _git_rm ;; -- cgit v1.2.3 From 17225c49d501a304a0ae9ff370ca5cc3ae4afe4d Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 12 Oct 2009 11:00:09 +0200 Subject: bash completion: complete refs for git-grep Before the --, always attempt ref completion. This helps with entering the arguments to git-grep. As a bonus, you can work around git-grep's current lack of --all by hitting M-*, ugly as the resulting command line may be. Strictly speaking, completing the regular expression argument (or option argument) makes no sense. However, we cannot prevent _all_ completion (it will fall back to filenames), so we dispense with any additional complication to detect whether the user still has to enter a regular expression. Signed-off-by: Thomas Rast Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7cf8557468..d3fec32997 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1069,7 +1069,8 @@ _git_grep () return ;; esac - COMPREPLY=() + + __gitcomp "$(__git_refs)" } _git_help () -- cgit v1.2.3 From 93cf50a412e3ed988cbce07e2ba3a80841d3884b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 17 Oct 2009 11:33:38 +0200 Subject: bash: complete more options for 'git rebase' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Complete all long options for 'git rebase' except --no-verify (probably used very seldom) and the long options corresponding to -v, -q, and -f. Signed-off-by: Björn Gustavsson Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index d3fec32997..7c7318c436 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1323,8 +1323,18 @@ _git_rebase () fi __git_complete_strategy && return case "$cur" in + --whitespace=*) + __gitcomp "$__git_whitespacelist" "" "${cur##--whitespace=}" + return + ;; --*) - __gitcomp "--onto --merge --strategy --interactive" + __gitcomp " + --onto --merge --strategy --interactive + --preserve-merges --stat --no-stat + --committer-date-is-author-date --ignore-date + --ignore-whitespace --whitespace= + " + return esac __gitcomp "$(__git_refs)" -- cgit v1.2.3 From f7ad96cfaaec3b32458ca69d44c50d1397d11d38 Mon Sep 17 00:00:00 2001 From: Markus Heidelberg Date: Wed, 28 Oct 2009 10:45:38 +0100 Subject: bash completion: difftool accepts the same options as diff So complete refs, files after the double-dash and some diff options that make sense for difftool. Signed-off-by: Markus Heidelberg Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7c7318c436..e3ddecc995 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -958,6 +958,8 @@ __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff _git_difftool () { + __git_has_doubledash && return + local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --tool=*) @@ -965,11 +967,15 @@ _git_difftool () return ;; --*) - __gitcomp "--tool=" + __gitcomp "--cached --staged --pickaxe-all --pickaxe-regex + --base --ours --theirs + --no-renames --diff-filter= --find-copies-harder + --relative --ignore-submodules + --tool=" return ;; esac - COMPREPLY=() + __git_complete_file } __git_fetch_options=" -- cgit v1.2.3 From c8998b4823cbccd6bd49c2034e242ae7d5873eae Mon Sep 17 00:00:00 2001 From: Scott Chacon Date: Wed, 28 Oct 2009 14:39:32 -0700 Subject: mergetool--lib: add p4merge as a pre-configured mergetool option Add p4merge to the set of built-in diff/merge tools, and update bash completion and documentation. Signed-off-by: Scott Chacon Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index e3ddecc995..2a9a88968f 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -953,7 +953,7 @@ _git_diff () } __git_mergetools_common="diffuse ecmerge emerge kdiff3 meld opendiff - tkdiff vimdiff gvimdiff xxdiff araxis + tkdiff vimdiff gvimdiff xxdiff araxis p4merge " _git_difftool () -- cgit v1.2.3 From 9858b87fbb990659ea98f1bc77c2e0283cdcaa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Wed, 11 Nov 2009 05:49:07 +0100 Subject: bash: add the merge option --ff-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index e3ddecc995..a0917d1809 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1224,7 +1224,7 @@ _git_log () __git_merge_options=" --no-commit --no-stat --log --no-log --squash --strategy - --commit --stat --no-squash --ff --no-ff + --commit --stat --no-squash --ff --no-ff --ff-only " _git_merge () -- cgit v1.2.3 From eaa4e6ee2a1df289e6900ee908751463b22a3a54 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Tue, 17 Nov 2009 18:49:10 -0600 Subject: Speed up bash completion loading MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since git is not used in each and every interactive xterm, it seems best to load completion support with cold caches and then load each needed thing lazily. This has most of the speed advantage of pre-generating everything at build time, without the complication of figuring out at build time what commands will be available at run time. On this slow laptop, this decreases the time to load git-completion.bash from about 500 ms to about 175 ms. Suggested-by: Kirill Smelkov Acked-by: Shawn O. Pearce Cc: Stephen Boyd Cc: SZEDER Gábor Cc: Sverre Rabbelier Signed-off-by: Jonathan Nieder Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 76 ++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 35 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7cf8557468..f67254d3d1 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -21,13 +21,7 @@ # 2) Added the following line to your .bashrc: # source ~/.git-completion.sh # -# 3) You may want to make sure the git executable is available -# in your PATH before this script is sourced, as some caching -# is performed while the script loads. If git isn't found -# at source time then all lookups will be done on demand, -# which may be slightly slower. -# -# 4) Consider changing your PS1 to also show the current branch: +# 3) Consider changing your PS1 to also show the current branch: # PS1='[\u@\h \W$(__git_ps1 " (%s)")]\$ ' # # The argument to __git_ps1 will be displayed only if you @@ -324,12 +318,8 @@ __git_remotes () done } -__git_merge_strategies () +__git_list_merge_strategies () { - if [ -n "${__git_merge_strategylist-}" ]; then - echo "$__git_merge_strategylist" - return - fi git merge -s help 2>&1 | sed -n -e '/[Aa]vailable strategies are: /,/^$/{ s/\.$// @@ -339,8 +329,17 @@ __git_merge_strategies () p }' } -__git_merge_strategylist= -__git_merge_strategylist=$(__git_merge_strategies 2>/dev/null) + +__git_merge_strategies= +# 'git merge -s help' (and thus detection of the merge strategy +# list) fails, unfortunately, if run outside of any git working +# tree. __git_merge_strategies is set to the empty string in +# that case, and the detection will be repeated the next time it +# is needed. +__git_compute_merge_strategies () +{ + : ${__git_merge_strategies:=$(__git_list_merge_strategies)} +} __git_complete_file () { @@ -474,27 +473,24 @@ __git_complete_remote_or_refspec () __git_complete_strategy () { + __git_compute_merge_strategies case "${COMP_WORDS[COMP_CWORD-1]}" in -s|--strategy) - __gitcomp "$(__git_merge_strategies)" + __gitcomp "$__git_merge_strategies" return 0 esac local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in --strategy=*) - __gitcomp "$(__git_merge_strategies)" "" "${cur##--strategy=}" + __gitcomp "$__git_merge_strategies" "" "${cur##--strategy=}" return 0 ;; esac return 1 } -__git_all_commands () +__git_list_all_commands () { - if [ -n "${__git_all_commandlist-}" ]; then - echo "$__git_all_commandlist" - return - fi local i IFS=" "$'\n' for i in $(git help -a|egrep '^ [a-zA-Z0-9]') do @@ -504,17 +500,18 @@ __git_all_commands () esac done } -__git_all_commandlist= -__git_all_commandlist="$(__git_all_commands 2>/dev/null)" -__git_porcelain_commands () +__git_all_commands= +__git_compute_all_commands () +{ + : ${__git_all_commands:=$(__git_list_all_commands)} +} + +__git_list_porcelain_commands () { - if [ -n "${__git_porcelain_commandlist-}" ]; then - echo "$__git_porcelain_commandlist" - return - fi local i IFS=" "$'\n' - for i in "help" $(__git_all_commands) + __git_compute_all_commands + for i in "help" $__git_all_commands do case $i in *--*) : helper pattern;; @@ -595,8 +592,13 @@ __git_porcelain_commands () esac done } -__git_porcelain_commandlist= -__git_porcelain_commandlist="$(__git_porcelain_commands 2>/dev/null)" + +__git_porcelain_commands= +__git_compute_porcelain_commands () +{ + __git_compute_all_commands + : ${__git_porcelain_commands:=$(__git_list_porcelain_commands)} +} __git_aliases () { @@ -1081,7 +1083,8 @@ _git_help () return ;; esac - __gitcomp "$(__git_all_commands) + __git_compute_all_commands + __gitcomp "$__git_all_commands attributes cli core-tutorial cvs-migration diffcore gitk glossary hooks ignore modules repository-layout tutorial tutorial-2 @@ -1427,7 +1430,8 @@ _git_config () return ;; pull.twohead|pull.octopus) - __gitcomp "$(__git_merge_strategies)" + __git_compute_merge_strategies + __gitcomp "$__git_merge_strategies" return ;; color.branch|color.diff|color.interactive|\ @@ -1528,7 +1532,8 @@ _git_config () pager.*) local pfx="${cur%.*}." cur="${cur#*.}" - __gitcomp "$(__git_all_commands)" "$pfx" "$cur" + __git_compute_all_commands + __gitcomp "$__git_all_commands" "$pfx" "$cur" return ;; remote.*.*) @@ -2125,7 +2130,8 @@ _git () --help " ;; - *) __gitcomp "$(__git_porcelain_commands) $(__git_aliases)" ;; + *) __git_compute_porcelain_commands + __gitcomp "$__git_porcelain_commands $(__git_aliases)" ;; esac return fi -- cgit v1.2.3 From 9a424b276c409a3510e7735b6ecc012f50dc2a49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sat, 5 Dec 2009 01:51:41 +0100 Subject: bash: update 'git commit' completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I just wanted to add the recently learnt '--reset-author' option, but then noticed that there are many more options missing. This patch adds support for all of 'git commit's options, except '--allow-empty', because it is primarily there for foreign scm interfaces. Furthermore, this patch also adds support for completing the arguments of those options that take a non-filename argument: valid modes are offered for '--cleanup' and '--untracked-files', while refs for '--reuse-message' and '--reedit-message', because these two take a commit as argument. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 11bf17a86c..7c18b0c07e 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -896,11 +896,31 @@ _git_commit () local cur="${COMP_WORDS[COMP_CWORD]}" case "$cur" in + --cleanup=*) + __gitcomp "default strip verbatim whitespace + " "" "${cur##--cleanup=}" + return + ;; + --reuse-message=*) + __gitcomp "$(__git_refs)" "" "${cur##--reuse-message=}" + return + ;; + --reedit-message=*) + __gitcomp "$(__git_refs)" "" "${cur##--reedit-message=}" + return + ;; + --untracked-files=*) + __gitcomp "all no normal" "" "${cur##--untracked-files=}" + return + ;; --*) __gitcomp " --all --author= --signoff --verify --no-verify --edit --amend --include --only --interactive - --dry-run + --dry-run --reuse-message= --reedit-message= + --reset-author --file= --message= --template= + --cleanup= --untracked-files --untracked-files= + --verbose --quiet " return esac -- cgit v1.2.3 From e25e2b4201716a912b29397515a858238497dbdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 12 Dec 2009 11:21:46 +0100 Subject: bash: Support new 'git fetch' options MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support the new options --all, --prune, and --dry-run for 'git fetch'. As the --multiple option was primarily introduced to enable 'git remote update' to be re-implemented in terms of 'git fetch' (16679e37) and is not likely to be used much from the command line, it does not seems worthwhile to complicate the code (to support completion of multiple remotes) to handle it. Signed-off-by: Björn Gustavsson Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7c18b0c07e..fbfa5f25c1 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -417,7 +417,17 @@ __git_complete_remote_or_refspec () while [ $c -lt $COMP_CWORD ]; do i="${COMP_WORDS[c]}" case "$i" in - --all|--mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + --mirror) [ "$cmd" = "push" ] && no_complete_refspec=1 ;; + --all) + case "$cmd" in + push) no_complete_refspec=1 ;; + fetch) + COMPREPLY=() + return + ;; + *) ;; + esac + ;; -*) ;; *) remote="$i"; break ;; esac @@ -1002,7 +1012,7 @@ _git_difftool () __git_fetch_options=" --quiet --verbose --append --upload-pack --force --keep --depth= - --tags --no-tags + --tags --no-tags --all --prune --dry-run " _git_fetch () -- cgit v1.2.3 From c18d5d82b45cb6963b3229556cedd587d94afca9 Mon Sep 17 00:00:00 2001 From: Robert Zeh Date: Tue, 29 Dec 2009 18:58:48 -0600 Subject: Add completion for git-svn mkdirs,reset,and gc Signed-off-by: Robert Zeh Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index fbfa5f25c1..c65462c9ed 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2022,7 +2022,7 @@ _git_svn () init fetch clone rebase dcommit log find-rev set-tree commit-diff info create-ignore propget proplist show-ignore show-externals branch tag blame - migrate + migrate mkdirs reset gc " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then @@ -2069,7 +2069,7 @@ _git_svn () __gitcomp "--stdin $cmt_opts $fc_opts" ;; create-ignore,--*|propget,--*|proplist,--*|show-ignore,--*|\ - show-externals,--*) + show-externals,--*|mkdirs,--*) __gitcomp "--revision=" ;; log,--*) @@ -2106,6 +2106,9 @@ _git_svn () --no-auth-cache --username= " ;; + reset,--*) + __gitcomp "--revision= --parent" + ;; *) COMPREPLY=() ;; -- cgit v1.2.3 From 4cc47382dfc2a71257934042f6c009287e101cb3 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 30 Dec 2009 19:04:38 -0800 Subject: bash completion: add space between branch name and status flags Improve the readability of the bash prompt by adding a space between the branch name and the status flags (dirty, stash, untracked). While we are cleaning up this section of code, the two cases for formatting the prompt are identical except for the format string, so make them the same. Suggested-by: Roman Fietze Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index c65462c9ed..3a6498c04b 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -163,11 +163,8 @@ __git_ps1 () fi fi - if [ -n "${1-}" ]; then - printf "$1" "$c${b##refs/heads/}$w$i$s$u$r" - else - printf " (%s)" "$c${b##refs/heads/}$w$i$s$u$r" - fi + local f="$w$i$s$u" + printf "${1:- (%s)}" "$c${b##refs/heads/}${f:+ $f}$r" fi } -- cgit v1.2.3 From cf6e7ba1c4c29fda3f16bfd4a4f1995ed45082d5 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Thu, 31 Dec 2009 12:48:41 +0100 Subject: bash completion: factor submodules into dirty state In the implementation of GIT_PS1_SHOWDIRTYSTATE in 738a94a (bash: offer to show (un)staged changes, 2009-02-03), I cut&pasted the git-diff invocations from dirty-worktree checks elsewhere, carrying along the --ignore-submodules option. As pointed out by Kevin Ballard, this doesn't really make sense: to the _user_, a changed submodule counts towards uncommitted changes. Signed-off-by: Thomas Rast Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 7cf8557468..4cb89a1256 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -148,11 +148,9 @@ __git_ps1 () elif [ "true" = "$(git rev-parse --is-inside-work-tree 2>/dev/null)" ]; then if [ -n "${GIT_PS1_SHOWDIRTYSTATE-}" ]; then if [ "$(git config --bool bash.showDirtyState)" != "false" ]; then - git diff --no-ext-diff --ignore-submodules \ - --quiet --exit-code || w="*" + git diff --no-ext-diff --quiet --exit-code || w="*" if git rev-parse --quiet --verify HEAD >/dev/null; then - git diff-index --cached --quiet \ - --ignore-submodules HEAD -- || i="+" + git diff-index --cached --quiet HEAD -- || i="+" else i="#" fi -- cgit v1.2.3 From 63d04a78043c61c52ae437fa6106e7029b466bbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Fri, 22 Jan 2010 11:54:51 +0100 Subject: bash: don't offer remote transport helpers as subcommands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since commits a2d725b7 (Use an external program to implement fetching with curl, 2009-08-05) and c9e388bb (Make the "traditionally-supported" URLs a special case, 2009-09-03) remote transport helpers like 'remote-ftp' and 'remote-curl' are offered by the completion script as available subcommands. Not good, since they are helpers, therefore should not be offered, so filter them out. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 1a9943c012..1a762e88e7 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -571,6 +571,7 @@ __git_list_porcelain_commands () read-tree) : plumbing;; receive-pack) : plumbing;; reflog) : plumbing;; + remote-*) : transport;; repo-config) : deprecated;; rerere) : plumbing;; rev-list) : plumbing;; -- cgit v1.2.3 From 00f09d0e4b1826ee0519ea64e919515032966450 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Thu, 28 Jan 2010 02:05:55 +0100 Subject: bash: support 'git notes' and its subcommands MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... and it will offer refs unless after -m or -F, because these two options require a non-ref argument. Signed-off-by: SZEDER Gábor Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 9651720410..8b56c34bde 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1306,6 +1306,24 @@ _git_name_rev () __gitcomp "--tags --all --stdin" } +_git_notes () +{ + local subcommands="edit show" + if [ -z "$(__git_find_on_cmdline "$subcommands")" ]; then + __gitcomp "$subcommands" + return + fi + + case "${COMP_WORDS[COMP_CWORD-1]}" in + -m|-F) + COMPREPLY=() + ;; + *) + __gitcomp "$(__git_refs)" + ;; + esac +} + _git_pull () { __git_complete_strategy && return @@ -2218,6 +2236,7 @@ _git () merge-base) _git_merge_base ;; mv) _git_mv ;; name-rev) _git_name_rev ;; + notes) _git_notes ;; pull) _git_pull ;; push) _git_push ;; rebase) _git_rebase ;; -- cgit v1.2.3 From 6d0d465e20b8c11924bc4e75563324771d0e0d63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= Date: Sat, 6 Feb 2010 09:37:53 +0100 Subject: bash: support the --autosquash option for rebase MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Björn Gustavsson Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 1 + 1 file changed, 1 insertion(+) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index da46bf81e6..35acad004e 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1386,6 +1386,7 @@ _git_rebase () --preserve-merges --stat --no-stat --committer-date-is-author-date --ignore-date --ignore-whitespace --whitespace= + --autosquash " return -- cgit v1.2.3 From 85f6b439f2d6ddc468d20f5ab34e11882f00375a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Fri, 12 Feb 2010 15:11:47 +0100 Subject: bash: support 'git am's new '--continue' option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contrib/completion') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 35acad004e..fe93747c93 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -667,7 +667,7 @@ _git_am () { local cur="${COMP_WORDS[COMP_CWORD]}" dir="$(__gitdir)" if [ -d "$dir"/rebase-apply ]; then - __gitcomp "--skip --resolved --abort" + __gitcomp "--skip --continue --resolved --abort" return fi case "$cur" in -- cgit v1.2.3