summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorCornelius Weig <cornelius.weig@tngtech.com>2017-02-03 12:01:55 +0100
committerJunio C Hamano <gitster@pobox.com>2017-02-03 22:25:46 -0800
commitbd9ab9dfc0b64128b10567906032c7f6e1d9bd67 (patch)
treed16eddcf09414f3a46885e920afd0847a2e31c5b /contrib
parente24a256b5946f933d19d68ec071d80990bffcebd (diff)
downloadgit-bd9ab9dfc0b64128b10567906032c7f6e1d9bd67.tar.gz
completion: improve bash completion for git-add
Command completion for git-add did not recognize some long-options. This commits adds completion for all long-options that are mentioned in the man-page synopsis. In addition, if the user specified `--update` or `-u`, path completion will only suggest modified tracked files. Signed-off-by: Cornelius Weig <cornelius.weig@tngtech.com> Reviewed-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash10
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index d1a43f9381..bfa3afb4c1 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -947,13 +947,17 @@ _git_add ()
--*)
__gitcomp "
--interactive --refresh --patch --update --dry-run
- --ignore-errors --intent-to-add
+ --ignore-errors --intent-to-add --force --edit --chmod=
"
return
esac
- # XXX should we check for --update and --all options ?
- __git_complete_index_file "--others --modified --directory --no-empty-directory"
+ local complete_opt="--others --modified --directory --no-empty-directory"
+ if test -n "$(__git_find_on_cmdline "-u --update")"
+ then
+ complete_opt="--modified"
+ fi
+ __git_complete_index_file "$complete_opt"
}
_git_archive ()