Thread (3 messages) flat view 3 messages, 2 authors, 2016-06-15

Re: git-rev-parse question.

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:04
Subsystem: the rest · Maintainer: Linus Torvalds


On Tue, 23 Aug 2005, Linus Torvalds wrote:
Try this trivial patch, it should work better.
Actually, don't do the "show_default()" part of this. We should _not_ show 
the default string if we haev "--no-revs" and the string doesn't match a 
rev.

Also, this fixes "--" handlign with "--flags". Thinking about it for a 
few seconds made it obvious that we shouldn't show it.

		Linus
---
Subject: Fix git-rev-parse --default and --flags handling

This makes the argument to --default and any --flags arguments should up 
correctly, and makes "--" together with --flags act sanely.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/rev-parse.c b/rev-parse.c
--- a/rev-parse.c
+++ b/rev-parse.c
@@ -107,7 +107,7 @@ static void show_arg(char *arg)
 	if (do_rev_argument && is_rev_argument(arg))
 		show_rev_arg(arg);
 	else
-		show_norev(arg);
+		show(arg);
 }
 
 static void show_default(void)
@@ -122,7 +122,7 @@ static void show_default(void)
 			show_rev(NORMAL, sha1, s);
 			return;
 		}
-		show_arg(s);
+		show_norev(s);
 	}
 }
 
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
 		if (*arg == '-') {
 			if (!strcmp(arg, "--")) {
 				show_default();
-				if (revs_only)
+				if (revs_only || flags_only)
 					break;
 				as_is = 1;
 			}
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help