Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 1/1] --color and --no-color git-log options don't need diffs to be computed.

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:43:37

Pierre Habouzit [off-list ref] writes:
quoted hunk
Signed-off-by: Pierre Habouzit <redacted>
---

 revision.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/revision.c b/revision.c
index 33d092c..0dee835 100644
--- a/revision.c
+++ b/revision.c
@@ -1209,8 +1209,9 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch
 
 			opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
 			if (opts > 0) {
-				if (strcmp(argv[i], "-z"))
-					revs->diff = 1;
+				revs->diff = strcmp(argv[i], "-z")
+					&& strcmp(argv[i], "--color")
+					&& strcmp(argv[i], "--no-color");
 				i += opts - 1;
 				continue;
 			}
Aside from the "don't override the option that is already set"
comment from David, I am somewhat unhappy that this piece
already knows too much about which option to diff potentially
changes the output (but not commits us to produce the diff) and
which option causes us to actually produce output.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help