From 81d4700725107ff999584016a0c8ae8a20b2d7fb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 6 Aug 2025 00:57:26 +0000 Subject: [PATCH 1/4] Initial plan From 99649c19b6b029356614083add6fad8b90b2fbf0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 6 Aug 2025 01:28:40 +0000 Subject: [PATCH 2/4] Fix gitignore to allow PowerShell module bin folders Co-authored-by: liliankasem <2198905+liliankasem@users.noreply.github.com> --- src/Cli/func/StaticResources/gitignore | 4 +- .../ParserTests/GitIgnoreParserTests.cs | 137 ++++++++++++++++++ 2 files changed, 140 insertions(+), 1 deletion(-) diff --git a/src/Cli/func/StaticResources/gitignore b/src/Cli/func/StaticResources/gitignore index e04adb7ca..0f45fa443 100644 --- a/src/Cli/func/StaticResources/gitignore +++ b/src/Cli/func/StaticResources/gitignore @@ -1,4 +1,6 @@ -bin +bin/ +**/bin/ +!Modules/** obj csx .vs diff --git a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs index fda16c0a6..105f6743b 100644 --- a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs +++ b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs @@ -147,5 +147,142 @@ public void DeniesShouldNotDenyNestedUnignoredFilesInIgnoredDirectories() { _gitignore.Denies("nonexistent/foo/wat").Should().BeFalse(); } + + [Fact] + public void PowerShellModuleBinFoldersShouldBeHandledCorrectly() + { + // Test the current gitignore content from the actual static resource + var currentGitIgnore = @"bin +obj +csx +.vs +edge +Publish + +*.user +*.suo +*.cscfg +*.Cache +project.lock.json + +/packages +/TestResults + +/tools/NuGet.exe +/App_Data +/secrets +/data +.secrets +appsettings.json +local.settings.json + +node_modules +dist + +# Local python packages +.python_packages/ + +# Python Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Azurite artifacts +__blobstorage__ +__queuestorage__ +__azurite_db*__.json"; + + var currentParser = new GitIgnoreParser(currentGitIgnore); + + // These paths should be ignored (regular bin folders) + currentParser.Denies("bin/somefile.dll").Should().BeTrue(); + currentParser.Denies("src/bin/output.dll").Should().BeTrue(); + + // These PowerShell module paths are currently being ignored but shouldn't be + // This demonstrates the current problem + currentParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); + currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); + + // Non-bin files in modules should not be ignored + currentParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); + } + + [Fact] + public void PowerShellModuleBinFoldersShouldNotBeIgnoredWithUpdatedGitIgnore() + { + // Test the proposed fix + var updatedGitIgnore = @"bin/ +**/bin/ +!Modules/** +obj +csx +.vs +edge +Publish + +*.user +*.suo +*.cscfg +*.Cache +project.lock.json + +/packages +/TestResults + +/tools/NuGet.exe +/App_Data +/secrets +/data +.secrets +appsettings.json +local.settings.json + +node_modules +dist + +# Local python packages +.python_packages/ + +# Python Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Azurite artifacts +__blobstorage__ +__queuestorage__ +__azurite_db*__.json"; + + var updatedParser = new GitIgnoreParser(updatedGitIgnore); + + // Regular bin folders should still be ignored + updatedParser.Denies("bin/somefile.dll").Should().BeTrue(); + updatedParser.Denies("src/bin/output.dll").Should().BeTrue(); + + // PowerShell module bin folders should NOT be ignored (this is the fix) + updatedParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); + updatedParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); + + // Non-bin files in modules should still not be ignored + updatedParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); + } } } From 738651f5e960c8645592e60923e6bcb7b5f3db5d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 6 Aug 2025 17:37:47 +0000 Subject: [PATCH 3/4] Remove trailing whitespace from test file to fix StyleCop warnings Co-authored-by: surgupta-msft <16623184+surgupta-msft@users.noreply.github.com> --- .../ParserTests/GitIgnoreParserTests.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs index 105f6743b..be2b8c1a2 100644 --- a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs +++ b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs @@ -202,16 +202,16 @@ public void PowerShellModuleBinFoldersShouldBeHandledCorrectly() __azurite_db*__.json"; var currentParser = new GitIgnoreParser(currentGitIgnore); - + // These paths should be ignored (regular bin folders) currentParser.Denies("bin/somefile.dll").Should().BeTrue(); currentParser.Denies("src/bin/output.dll").Should().BeTrue(); - + // These PowerShell module paths are currently being ignored but shouldn't be // This demonstrates the current problem currentParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); - + // Non-bin files in modules should not be ignored currentParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); } @@ -272,15 +272,15 @@ public void PowerShellModuleBinFoldersShouldNotBeIgnoredWithUpdatedGitIgnore() __azurite_db*__.json"; var updatedParser = new GitIgnoreParser(updatedGitIgnore); - + // Regular bin folders should still be ignored updatedParser.Denies("bin/somefile.dll").Should().BeTrue(); updatedParser.Denies("src/bin/output.dll").Should().BeTrue(); - + // PowerShell module bin folders should NOT be ignored (this is the fix) updatedParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); updatedParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); - + // Non-bin files in modules should still not be ignored updatedParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); } From d04bd291d565bd44c1622412462ae6fe99d9c1af Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 6 Aug 2025 19:03:13 +0000 Subject: [PATCH 4/4] Fix failing PowerShell module test to use actual gitignore content Co-authored-by: surgupta-msft <16623184+surgupta-msft@users.noreply.github.com> --- .../ParserTests/GitIgnoreParserTests.cs | 129 +----------------- 1 file changed, 6 insertions(+), 123 deletions(-) diff --git a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs index be2b8c1a2..43119c42b 100644 --- a/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs +++ b/test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. +using Azure.Functions.Cli; using Azure.Functions.Cli.Common; using FluentAssertions; using Xunit; @@ -149,57 +150,10 @@ public void DeniesShouldNotDenyNestedUnignoredFilesInIgnoredDirectories() } [Fact] - public void PowerShellModuleBinFoldersShouldBeHandledCorrectly() + public async void PowerShellModuleBinFoldersShouldBeHandledCorrectly() { // Test the current gitignore content from the actual static resource - var currentGitIgnore = @"bin -obj -csx -.vs -edge -Publish - -*.user -*.suo -*.cscfg -*.Cache -project.lock.json - -/packages -/TestResults - -/tools/NuGet.exe -/App_Data -/secrets -/data -.secrets -appsettings.json -local.settings.json - -node_modules -dist - -# Local python packages -.python_packages/ - -# Python Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# Azurite artifacts -__blobstorage__ -__queuestorage__ -__azurite_db*__.json"; + var currentGitIgnore = await StaticResources.GitIgnore; var currentParser = new GitIgnoreParser(currentGitIgnore); @@ -207,82 +161,11 @@ public void PowerShellModuleBinFoldersShouldBeHandledCorrectly() currentParser.Denies("bin/somefile.dll").Should().BeTrue(); currentParser.Denies("src/bin/output.dll").Should().BeTrue(); - // These PowerShell module paths are currently being ignored but shouldn't be - // This demonstrates the current problem - currentParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); - currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeTrue("Current implementation incorrectly ignores PowerShell module bin files"); + // These PowerShell module paths should NOT be ignored with the updated gitignore + currentParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); + currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); // Non-bin files in modules should not be ignored currentParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); - } - - [Fact] - public void PowerShellModuleBinFoldersShouldNotBeIgnoredWithUpdatedGitIgnore() - { - // Test the proposed fix - var updatedGitIgnore = @"bin/ -**/bin/ -!Modules/** -obj -csx -.vs -edge -Publish - -*.user -*.suo -*.cscfg -*.Cache -project.lock.json - -/packages -/TestResults - -/tools/NuGet.exe -/App_Data -/secrets -/data -.secrets -appsettings.json -local.settings.json - -node_modules -dist - -# Local python packages -.python_packages/ - -# Python Environments -.env -.venv -env/ -venv/ -ENV/ -env.bak/ -venv.bak/ - -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# Azurite artifacts -__blobstorage__ -__queuestorage__ -__azurite_db*__.json"; - - var updatedParser = new GitIgnoreParser(updatedGitIgnore); - - // Regular bin folders should still be ignored - updatedParser.Denies("bin/somefile.dll").Should().BeTrue(); - updatedParser.Denies("src/bin/output.dll").Should().BeTrue(); - - // PowerShell module bin folders should NOT be ignored (this is the fix) - updatedParser.Denies("Modules/Az.Storage/8.1.0/Storage.Autorest/bin/Az.Storage.private.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); - updatedParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored"); - - // Non-bin files in modules should still not be ignored - updatedParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse(); - } } }