Skip to content

Commit 171a9bd

Browse files
Copilotliliankasemsurgupta-msft
authored
Fix .gitignore to allow PowerShell module bin folders (#4574)
* Initial plan * Fix gitignore to allow PowerShell module bin folders Co-authored-by: liliankasem <2198905+liliankasem@users.noreply.github.com> * Remove trailing whitespace from test file to fix StyleCop warnings Co-authored-by: surgupta-msft <16623184+surgupta-msft@users.noreply.github.com> * Fix failing PowerShell module test to use actual gitignore content Co-authored-by: surgupta-msft <16623184+surgupta-msft@users.noreply.github.com> * Fix missing closing brace in GitIgnoreParserTests.cs Co-authored-by: liliankasem <2198905+liliankasem@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: liliankasem <2198905+liliankasem@users.noreply.github.com> Co-authored-by: surgupta-msft <16623184+surgupta-msft@users.noreply.github.com>
1 parent 06400da commit 171a9bd

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

src/Cli/func/StaticResources/gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
bin
1+
bin/
2+
**/bin/
3+
!Modules/**
24
obj
35
csx
46
.vs

test/Cli/Func.UnitTests/ParserTests/GitIgnoreParserTests.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT License. See LICENSE in the project root for license information.
33

4+
using Azure.Functions.Cli;
45
using Azure.Functions.Cli.Common;
56
using FluentAssertions;
67
using Xunit;
@@ -147,5 +148,25 @@ public void DeniesShouldNotDenyNestedUnignoredFilesInIgnoredDirectories()
147148
{
148149
_gitignore.Denies("nonexistent/foo/wat").Should().BeFalse();
149150
}
151+
152+
[Fact]
153+
public async void PowerShellModuleBinFoldersShouldBeHandledCorrectly()
154+
{
155+
// Test the current gitignore content from the actual static resource
156+
var currentGitIgnore = await StaticResources.GitIgnore;
157+
158+
var currentParser = new GitIgnoreParser(currentGitIgnore);
159+
160+
// These paths should be ignored (regular bin folders)
161+
currentParser.Denies("bin/somefile.dll").Should().BeTrue();
162+
currentParser.Denies("src/bin/output.dll").Should().BeTrue();
163+
164+
// These PowerShell module paths should NOT be ignored with the updated gitignore
165+
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");
166+
currentParser.Denies("Modules/SomeModule/1.0.0/bin/Module.dll").Should().BeFalse("PowerShell module bin files should not be ignored");
167+
168+
// Non-bin files in modules should not be ignored
169+
currentParser.Denies("Modules/Az.Accounts/2.0.0/lib/netstandard2.0/Microsoft.Azure.dll").Should().BeFalse();
170+
}
150171
}
151172
}

0 commit comments

Comments
 (0)