@@ -386,6 +386,7 @@ test_expect_success 'setup change in subdirectory' '
386
386
echo master >sub/sub &&
387
387
git add sub/sub &&
388
388
git commit -m "added sub/sub" &&
389
+ git tag v1 &&
389
390
echo test >>file &&
390
391
echo test >>sub/sub &&
391
392
git add file sub/sub &&
@@ -421,12 +422,49 @@ run_dir_diff_test 'difftool --dir-diff ignores --prompt' '
421
422
grep file output
422
423
'
423
424
424
- run_dir_diff_test ' difftool --dir-diff from subdirectory' '
425
+ run_dir_diff_test ' difftool --dir-diff branch from subdirectory' '
425
426
(
426
427
cd sub &&
427
428
git difftool --dir-diff $symlinks --extcmd ls branch >output &&
428
- grep sub output &&
429
- grep file output
429
+ # "sub" must only exist in "right"
430
+ # "file" and "file2" must be listed in both "left" and "right"
431
+ test "1" = $(grep sub output | wc -l) &&
432
+ test "2" = $(grep file"$" output | wc -l) &&
433
+ test "2" = $(grep file2 output | wc -l)
434
+ )
435
+ '
436
+
437
+ run_dir_diff_test ' difftool --dir-diff v1 from subdirectory' '
438
+ (
439
+ cd sub &&
440
+ git difftool --dir-diff $symlinks --extcmd ls v1 >output &&
441
+ # "sub" and "file" exist in both v1 and HEAD.
442
+ # "file2" is unchanged.
443
+ test "2" = $(grep sub output | wc -l) &&
444
+ test "2" = $(grep file output | wc -l) &&
445
+ test "0" = $(grep file2 output | wc -l)
446
+ )
447
+ '
448
+
449
+ run_dir_diff_test ' difftool --dir-diff branch from subdirectory w/ pathspec' '
450
+ (
451
+ cd sub &&
452
+ git difftool --dir-diff $symlinks --extcmd ls branch -- .>output &&
453
+ # "sub" only exists in "right"
454
+ # "file" and "file2" must not be listed
455
+ test "1" = $(grep sub output | wc -l) &&
456
+ test "0" = $(grep file output | wc -l)
457
+ )
458
+ '
459
+
460
+ run_dir_diff_test ' difftool --dir-diff v1 from subdirectory w/ pathspec' '
461
+ (
462
+ cd sub &&
463
+ git difftool --dir-diff $symlinks --extcmd ls v1 -- .>output &&
464
+ # "sub" exists in v1 and HEAD
465
+ # "file" is filtered out by the pathspec
466
+ test "2" = $(grep sub output | wc -l) &&
467
+ test "0" = $(grep file output | wc -l)
430
468
)
431
469
'
432
470
0 commit comments