Skip to content

Commit 7d4928e

Browse files
authored
Fix cannot remove hidden files on linux (#16172)
* Update skip module list for generation branch * Fix cannot remove hidden files on linux * Fix cannot remove hidden files on linux * Fix cannot remove hidden files on linux Co-authored-by: wyunchi-ms <[email protected]>
1 parent b3a4209 commit 7d4928e

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.ci-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
"**/readme.md",
6565
"src/**/document/*",
6666
".ci-config.json",
67-
"tools/PrepareAutorestModule.ps1"
67+
"tools/PrepareAutorestModule.ps1",
68+
"tools/SyncFromMainBranch.ps1"
6869
],
6970
"phases": []
7071
},

tools/SyncFromMainBranch.ps1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,17 @@ git checkout -b "syncToolsFolder-$BranchName" "origin/$BranchName"
2222
# There are some files or folders who need to be keeped in target branch.
2323
foreach ($UnSyncPath in $Config.UnSyncPath)
2424
{
25-
Write-Host "Back up $UnSyncPath from $BranchName branch."
26-
$ParentFolder = Split-Path -path $UnSyncPath -Parent
27-
Copy-Item -Path $UnSyncPath -Destination "$TmpFolder/$ParentFolder" -Recurse -Force
25+
if (Test-Path -Path $UnSyncPath)
26+
{
27+
Write-Host "Back up $UnSyncPath from $BranchName branch."
28+
$ParentFolder = Split-Path -path $UnSyncPath -Parent
29+
Copy-Item -Path $UnSyncPath -Destination "$TmpFolder/$ParentFolder" -Recurse -Force
30+
}
2831
}
2932

3033
foreach ($SyncPath in $Config.SyncPath)
3134
{
32-
Remove-Item -Path $SyncPath -Recurse
35+
Remove-Item -Path $SyncPath -Recurse -Force
3336
Copy-Item -Path "$TmpFolder/$SyncPath" -Destination $SyncPath -Recurse -Force
3437
git add $SyncPath
3538
}

0 commit comments

Comments
 (0)