File tree Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Expand file tree Collapse file tree 2 files changed +49
-1
lines changed Original file line number Diff line number Diff line change @@ -262,7 +262,7 @@ sub list_modified {
262262 }
263263 }
264264
265- for (run_cmd_pipe(qw( git diff-files --numstat --summary --raw --) , @ARGV )) {
265+ for (run_cmd_pipe(qw( git diff-files --ignore-submodules=dirty -- numstat --summary --raw --) , @ARGV )) {
266266 if (($add , $del , $file ) =
267267 / ^([-\d ]+) ([-\d ]+) (.*)/ ) {
268268 $file = unquote_path($file );
Original file line number Diff line number Diff line change @@ -493,4 +493,52 @@ test_expect_success 'add -p works even with color.ui=always' '
493493 test_cmp expect actual
494494'
495495
496+ test_expect_success ' setup different kinds of dirty submodules' '
497+ test_create_repo for-submodules &&
498+ (
499+ cd for-submodules &&
500+ test_commit initial &&
501+ test_create_repo dirty-head &&
502+ (
503+ cd dirty-head &&
504+ test_commit initial
505+ ) &&
506+ cp -R dirty-head dirty-otherwise &&
507+ cp -R dirty-head dirty-both-ways &&
508+ git add dirty-head &&
509+ git add dirty-otherwise dirty-both-ways &&
510+ git commit -m initial &&
511+
512+ cd dirty-head &&
513+ test_commit updated &&
514+ cd ../dirty-both-ways &&
515+ test_commit updated &&
516+ echo dirty >>initial &&
517+ : >untracked &&
518+ cd ../dirty-otherwise &&
519+ echo dirty >>initial &&
520+ : >untracked
521+ ) &&
522+ git -C for-submodules diff-files --name-only >actual &&
523+ cat >expected <<-\EOF &&
524+ dirty-both-ways
525+ dirty-head
526+ dirty-otherwise
527+ EOF
528+ test_cmp expected actual &&
529+ git -C for-submodules diff-files --name-only --ignore-submodules=dirty >actual &&
530+ cat >expected <<-\EOF &&
531+ dirty-both-ways
532+ dirty-head
533+ EOF
534+ test_cmp expected actual
535+ '
536+
537+ test_expect_success ' status ignores dirty submodules (except HEAD)' '
538+ git -C for-submodules add -i </dev/null >output &&
539+ grep dirty-head output &&
540+ grep dirty-both-ways output &&
541+ ! grep dirty-otherwise output
542+ '
543+
496544test_done
You can’t perform that action at this time.
0 commit comments