Skip to content

Commit

Permalink
Trim off the target branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sima-zhu authored and azure-sdk committed Feb 18, 2021
1 parent f61de7b commit 315dd75
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions eng/common/scripts/get-markdown-files-from-changed-files.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ param (
# The root repo we scaned with.
[string] $RootRepo = '$PSScriptRoot/../../..',
# The target branch to compare with.
[string] $targetBranch = "origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}"
[string] $targetBranch = "${env:SYSTEM_PULLREQUEST_TARGETBRANCH}"
)
$deletedFiles = (git diff $targetBranch HEAD --name-only --diff-filter=D)
$renamedFiles = (git diff $targetBranch HEAD --diff-filter=R)
$changedMarkdowns = (git diff $targetBranch HEAD --name-only -- '*.md')

# Trim the "ref/head" for master branch
$targetBranch = $targetBranch -replace "refs/heads/"

$deletedFiles = (git diff "origin/$targetBranch" HEAD --name-only --diff-filter=D)
$renamedFiles = (git diff "origin/$targetBranch" HEAD --diff-filter=R)
$changedMarkdowns = (git diff "origin/$targetBranch" HEAD --name-only -- '*.md')

$beforeRenameFiles = @()
# Retrieve the 'renamed from' files. Git command only returns back the files after rename.
Expand Down

0 comments on commit 315dd75

Please sign in to comment.