git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bash completion: Fix the . -> .. revision range completion
@ 2008-07-13 11:19 Petr Baudis
  2008-07-13 12:11 ` Jakub Narebski
  2008-07-13 21:38 ` Junio C Hamano
  0 siblings, 2 replies; 22+ messages in thread
From: Petr Baudis @ 2008-07-13 11:19 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: git

When Git sees a string with trailing dot on a place where revision
range could occur, it will unconditionally append another dot to
it to help complete a revision range. However, filespec can usually
occur at such a place as well. I have been hitting this all the time
lately with

	git log git-submodule.<tab>

and the like.

This patch will make Git perform the . -> .. completion in
__git_complete_revlist only if there is no filename starting with
the entered prefix available.  At few places, filename could not occur
when calling __git_complete_revlist; however, taking this into account
did not seem worth complicating the code further.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 contrib/completion/git-completion.bash |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 61581fe..fe24b8c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -325,7 +325,12 @@ __git_complete_revlist ()
 		__gitcomp "$(__git_refs)" "$pfx" "$cur"
 		;;
 	*.)
-		__gitcomp "$cur."
+		if ls "$cur"* >/dev/null 2>&1; then
+			# This is a file, not revision range
+			__gitcomp "$(__git_refs)"
+		else
+			__gitcomp "$cur."
+		fi
 		;;
 	*)
 		__gitcomp "$(__git_refs)"

^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2008-07-16  7:22 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-13 11:19 [PATCH] bash completion: Fix the . -> .. revision range completion Petr Baudis
2008-07-13 12:11 ` Jakub Narebski
2008-07-13 21:38 ` Junio C Hamano
2008-07-13 22:06   ` Shawn O. Pearce
2008-07-13 23:07   ` Petr Baudis
2008-07-13 23:25     ` Junio C Hamano
2008-07-13 23:52       ` Linus Torvalds
2008-07-14  0:00         ` Shawn O. Pearce
2008-07-14  5:38           ` Linus Torvalds
2008-07-14  5:57             ` Shawn O. Pearce
2008-07-14  6:27             ` Shawn O. Pearce
2008-07-14  6:47               ` Björn Steinbrink
2008-07-14  6:50                 ` Björn Steinbrink
2008-07-14 12:39                   ` Andreas Ericsson
2008-07-14 14:51                   ` Linus Torvalds
2008-07-14 14:50               ` Linus Torvalds
2008-07-15  4:25                 ` Shawn O. Pearce
2008-07-15  8:05                   ` Andreas Ericsson
2008-07-15  8:10                     ` Andreas Ericsson
2008-07-15  8:17                       ` Andreas Ericsson
2008-07-15 23:38                     ` Shawn O. Pearce
2008-07-16  7:20                       ` Andreas Ericsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).