Browse Source
Before d473e2e0e8
(diff.c: convert -U|--unified, 2019-01-27), -U and
--unified are implemented with a custom parser opt_arg() in diff.c. I
didn't check this code carefully and not realize that it's the
equivalent of PARSE_OPT_NONEG | PARSE_OPT_OPTARG.
In other words, if -U is specified without any argument, the option
should be accepted, and the default value should be used. Without
PARSE_OPT_OPTARG, parse_options() will reject this case and cause a
regression.
Reported-by: Bryan Turner <bturner@atlassian.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint


5 changed files with 100 additions and 4 deletions
@ -0,0 +1,29 @@
@@ -0,0 +1,29 @@
|
||||
$ git diff -U1 initial..side |
||||
diff --git a/dir/sub b/dir/sub |
||||
index 35d242b..7289e35 100644 |
||||
--- a/dir/sub |
||||
+++ b/dir/sub |
||||
@@ -2 +2,3 @@ A |
||||
B |
||||
+1 |
||||
+2 |
||||
diff --git a/file0 b/file0 |
||||
index 01e79c3..f4615da 100644 |
||||
--- a/file0 |
||||
+++ b/file0 |
||||
@@ -3 +3,4 @@ |
||||
3 |
||||
+A |
||||
+B |
||||
+C |
||||
diff --git a/file3 b/file3 |
||||
new file mode 100644 |
||||
index 0000000..7289e35 |
||||
--- /dev/null |
||||
+++ b/file3 |
||||
@@ -0,0 +1,4 @@ |
||||
+A |
||||
+B |
||||
+1 |
||||
+2 |
||||
$ |
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
$ git diff -U2 initial..side |
||||
diff --git a/dir/sub b/dir/sub |
||||
index 35d242b..7289e35 100644 |
||||
--- a/dir/sub |
||||
+++ b/dir/sub |
||||
@@ -1,2 +1,4 @@ |
||||
A |
||||
B |
||||
+1 |
||||
+2 |
||||
diff --git a/file0 b/file0 |
||||
index 01e79c3..f4615da 100644 |
||||
--- a/file0 |
||||
+++ b/file0 |
||||
@@ -2,2 +2,5 @@ |
||||
2 |
||||
3 |
||||
+A |
||||
+B |
||||
+C |
||||
diff --git a/file3 b/file3 |
||||
new file mode 100644 |
||||
index 0000000..7289e35 |
||||
--- /dev/null |
||||
+++ b/file3 |
||||
@@ -0,0 +1,4 @@ |
||||
+A |
||||
+B |
||||
+1 |
||||
+2 |
||||
$ |
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
$ git diff -U initial..side |
||||
diff --git a/dir/sub b/dir/sub |
||||
index 35d242b..7289e35 100644 |
||||
--- a/dir/sub |
||||
+++ b/dir/sub |
||||
@@ -1,2 +1,4 @@ |
||||
A |
||||
B |
||||
+1 |
||||
+2 |
||||
diff --git a/file0 b/file0 |
||||
index 01e79c3..f4615da 100644 |
||||
--- a/file0 |
||||
+++ b/file0 |
||||
@@ -1,3 +1,6 @@ |
||||
1 |
||||
2 |
||||
3 |
||||
+A |
||||
+B |
||||
+C |
||||
diff --git a/file3 b/file3 |
||||
new file mode 100644 |
||||
index 0000000..7289e35 |
||||
--- /dev/null |
||||
+++ b/file3 |
||||
@@ -0,0 +1,4 @@ |
||||
+A |
||||
+B |
||||
+1 |
||||
+2 |
||||
$ |
Loading…
Reference in new issue