git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] bash: offer refs instead of filenames for 'git revert'

From
SZEDER Gábor <szeder@ira.uka.de>
Date
Nov 27, 2008, 13:35 UTC
Message-ID
<1227792953-4095-1-git-send-email-szeder@ira.uka.de>

The completion script for 'git revert' currently offers options and filenames. However, 'git revert' doesn't take any filenames from the command line, but a single commit. Therefore, it's more sane to offer refs instead.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
---
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 39bf18b..7e668d5 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1348,7 +1348,7 @@ _git_revert ()
 		return
 		;;
 	esac
-	COMPREPLY=()
+	__gitcomp "$(__git_refs)"
 }
 
 _git_rm ()
-- 
1.6.0.4.814.gfe502
Next: Shawn O. Pearce
Message 1 of 2 in “bash: offer refs instead of filenames for 'git revert'”
  1. bash: offer refs instead of filenames for 'git revert'SZEDER Gábor, Nov 27, 2008
  2. Shawn O. PearceNov 27, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.