diff --git a/engine/src/flutter/tools/pkg/git_repo_tools/lib/git_repo_tools.dart b/engine/src/flutter/tools/pkg/git_repo_tools/lib/git_repo_tools.dart index 34f5bd462d..47b7d74b07 100644 --- a/engine/src/flutter/tools/pkg/git_repo_tools/lib/git_repo_tools.dart +++ b/engine/src/flutter/tools/pkg/git_repo_tools/lib/git_repo_tools.dart @@ -86,7 +86,8 @@ final class GitRepo { 'git', 'diff', '--name-only', - '--diff-filter=ACMRT', + '--diff-filter=ACMRT', // Added, copied, modified, renamed, or type-changed. + '--relative', // _gitOutputToList will prepend the CWD so we don't want duplicate sub-paths mergeBase, ]); return _gitOutputToList(masterResult); @@ -111,6 +112,7 @@ final class GitRepo { '--no-commit-id', '--name-only', '--diff-filter=ACMRT', // Added, copied, modified, renamed, or type-changed. + '--relative', // _gitOutputToList will prepend the CWD so we don't want duplicate sub-paths '-r', 'HEAD', ]); diff --git a/engine/src/flutter/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart b/engine/src/flutter/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart index 7b17d9c46a..a5d4bbc508 100644 --- a/engine/src/flutter/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart +++ b/engine/src/flutter/tools/pkg/git_repo_tools/test/git_repo_tools_test.dart @@ -26,7 +26,8 @@ void main() { } // Succeed calling "git diff --name-only --diff-filter=ACMRT fake-sha-hash". - if (command.join(' ') == 'git diff --name-only --diff-filter=ACMRT $fakeShaHash') { + if (command.join(' ') == + 'git diff --name-only --diff-filter=ACMRT --relative $fakeShaHash') { return FakeProcess(stdout: 'file1\nfile2'); } @@ -62,7 +63,8 @@ void main() { return FakeProcess(); } - if (command.join(' ') == 'git diff --name-only --diff-filter=ACMRT $fakeShaHash') { + if (command.join(' ') == + 'git diff --name-only --diff-filter=ACMRT --relative $fakeShaHash') { return FakeProcess(stdout: 'file1\nfile2'); } @@ -91,7 +93,7 @@ void main() { } if (command.join(' ') == - 'git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r HEAD') { + 'git diff-tree --no-commit-id --name-only --diff-filter=ACMRT --relative -r HEAD') { return FakeProcess(stdout: 'file1\nfile2'); } @@ -120,7 +122,7 @@ void main() { } if (command.join(' ') == - 'git diff-tree --no-commit-id --name-only --diff-filter=ACMRT -r HEAD') { + 'git diff-tree --no-commit-id --name-only --diff-filter=ACMRT --relative -r HEAD') { return FakeProcess(stdout: 'file1\nfile2'); } @@ -164,7 +166,8 @@ void main() { return FakeProcess(); } - if (command.join(' ') == 'git diff --name-only --diff-filter=ACMRT $fakeShaHash') { + if (command.join(' ') == + 'git diff --name-only --diff-filter=ACMRT --relative $fakeShaHash') { return FakeProcess(stdout: 'file1\nfile2'); }