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

Re: git-checkout-index, flag ordering and --prefix kludgy handling

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 18, 2005, 02:48 UTC
Message-ID
<Pine.LNX.4.64.0510171933200.3369@g5.osdl.org>
In-Reply-To
<7vmzl7tv89.fsf@assigned-by-dhcp.cox.net>
On Mon, 17 Oct 2005, Junio C Hamano wrote:
> 
> One reason I have not done nor said much about this was because
> I've been thinking about making the branch/refname more explicit
> on our command line.

Yes, I know it's ambigious at times, but it really is very convenient. Usually we allow a "--" to say where a filename starts when it _is_ ambiguous.

However, you're right, we fail that at times. In particular, git-rev-parse fails it.

Something like this?
		Linus
---
diff --git a/rev-parse.c b/rev-parse.c
index 41b9dae..85230df 100644
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -151,6 +151,12 @@ static void show_datestring(const char *
 	show(buffer);
 }
 
+static void show_file(const char *arg)
+{
+	if ((filter & (DO_NONFLAGS|DO_NOREV)) == (DO_NONFLAGS|DO_NOREV))
+		show(arg);
+}
+
 int main(int argc, char **argv)
 {
 	int i, as_is = 0, verify = 0;
@@ -162,7 +168,7 @@ int main(int argc, char **argv)
 		char *dotdot;
 	
 		if (as_is) {
-			show(arg);
+			show_file(arg);
 			continue;
 		}
 		if (*arg == '-') {
@@ -282,9 +288,7 @@ int main(int argc, char **argv)
 		}
 		if (verify)
 			die("Needed a single revision");
-		if ((filter & (DO_NONFLAGS|DO_NOREV)) ==
-		    (DO_NONFLAGS|DO_NOREV))
-			show(arg);
+		show_file(arg);
 	}
 	show_default();
 	if (verify && revs_count != 1)
Previous: Junio C HamanoNext: Linus Torvalds
Message 7 of 10 in “git-checkout-index, flag ordering and --prefix kludgy handling”
  1. BlaisorbladeOct 16, 2005
  2. Junio C HamanoOct 17, 2005
  3. Linus TorvaldsOct 17, 2005
  4. Junio C HamanoOct 18, 2005
  5. Linus TorvaldsOct 18, 2005
  6. Junio C HamanoOct 18, 2005
  7. Linus TorvaldsOct 18, 2005
  8. Teach "git diff" to handle filenames startign with '-'Linus Torvalds, Oct 18, 2005
  9. Handle "-" at beginning of filenames, part 3Linus Torvalds, Oct 18, 2005
  10. git-checkout: revert specific paths to either index or a given tree-ish.Junio C Hamano, Oct 18, 2005

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.