From 67f1fe5f08d3f6146cf13f8a65ceeab1509581a8 Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Mon, 16 Feb 2009 17:34:57 +0100 Subject: bash completion: only show 'log --merge' if merging The gitk completion only shows --merge if MERGE_HEAD is present. Do it the same way for git-log completion. Signed-off-by: Thomas Rast Acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'contrib') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 554a03ff4f..0bb74c05e5 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -937,6 +937,11 @@ _git_log () __git_has_doubledash && return local cur="${COMP_WORDS[COMP_CWORD]}" + local g="$(git rev-parse --git-dir 2>/dev/null)" + local merge="" + if [ -f $g/MERGE_HEAD ]; then + merge="--merge" + fi case "$cur" in --pretty=*) __gitcomp " @@ -968,7 +973,7 @@ _git_log () --decorate --diff-filter= --color-words --walk-reflogs --parents --children --full-history - --merge + $merge " return ;; -- cgit v1.2.3 From ba7906f2f4c332f814d270d2e16b0010516fc53e Mon Sep 17 00:00:00 2001 From: "Daniel Cheng (aka SDiZ)" Date: Mon, 30 Mar 2009 19:27:37 +0800 Subject: Fix bash completion in path with spaces Signed-off-by: Daniel Cheng (aka SDiZ) Trivially-acked-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 0bb74c05e5..8fc01fb497 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -939,7 +939,7 @@ _git_log () local cur="${COMP_WORDS[COMP_CWORD]}" local g="$(git rev-parse --git-dir 2>/dev/null)" local merge="" - if [ -f $g/MERGE_HEAD ]; then + if [ -f "$g/MERGE_HEAD" ]; then merge="--merge" fi case "$cur" in @@ -1681,7 +1681,7 @@ _gitk () local cur="${COMP_WORDS[COMP_CWORD]}" local g="$(git rev-parse --git-dir 2>/dev/null)" local merge="" - if [ -f $g/MERGE_HEAD ]; then + if [ -f "$g/MERGE_HEAD" ]; then merge="--merge" fi case "$cur" in -- cgit v1.2.3