Hi Junio
On 22/04/2024 16:50, Junio C Hamano wrote:
Rubén Justo <rjusto@xxxxxxxxx> writes:
1: 0317594bce ! 1: b418b03f15 add-patch: response to unknown command
@@ t/t3701-add-interactive.sh: test_expect_success 'warn about add.interactive.useB
+ test_when_finished "git reset --hard; rm -f command" &&
+ echo W >command &&
+ git add -N command &&
-+ cat >expect <<-EOF &&
-+ diff --git a/command b/command
-+ new file mode 100644
-+ index 0000000..a42d8ff
-+ --- /dev/null
-+ +++ b/command
-+ @@ -0,0 +1 @@
-+ +W
++ git diff command >expect &&
++ cat >>expect <<-EOF &&
+ (1/1) Stage addition [y,n,q,a,d,e,p,?]? Unknown command ${SQ}W${SQ} (use ${SQ}?${SQ} for help)
+ (1/1) Stage addition [y,n,q,a,d,e,p,?]?$SP
+ EOF
Interesting.
My first reaction was "how is this different from checking just the
last line of the actual output? The early part of expect and actual
both come from an internal invocation of 'git diff', and they must
match by definition".
But that may really be the point of this test.
Yes - we want to make sure that we are not printing the help and the
only way to do that is to check the whole output
Best Wishes
Phillip
That is, we may later decide to tweak the way "git diff" hunks are
presented, and we expect that the way "git add -p" presents the
hunks would change together with it automatically.