File: get-changedfiles.ps1

package info (click to toggle)
golang-github-azure-azure-sdk-for-go 68.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 556,256 kB
  • sloc: javascript: 196; sh: 96; makefile: 7
file content (40 lines) | stat: -rw-r--r-- 1,406 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

# cSpell:ignore Committish
# cSpell:ignore committish
# cSpell:ignore PULLREQUEST
# cSpell:ignore TARGETBRANCH
# cSpell:ignore SOURCECOMMITID
# cSpell:ignore elete
# cSpell:ignore ename
<#
  .SYNOPSIS
  Returns git diff changes in pull request.
  .DESCRIPTION
  The script is to return diff changes in pull request.
  .PARAMETER SourceCommittish
  The branch committish PR merges from.
  Definition of committish: https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefcommit-ishacommit-ishalsocommittish
  .PARAMETER TargetCommittish
  The branch committish PR targets to merge into.
  .PARAMETER DiffPath
  The files which git diff to scan against. Support regex match. E.g. "eng/common/*", "*.md"
  .PARAMETER DiffFilterType
  The filter type A(a)dd, D(d)elete, R(r)ename, U(u)pate. 
  E.g. 'ad' means filter out the newly added file and deleted file 
  E.g. '' means no filter on file mode.
#>
[CmdletBinding()]
param (
  [string] $SourceCommittish = "${env:SYSTEM_PULLREQUEST_SOURCECOMMITID}",
  [string] $TargetCommittish = ("origin/${env:SYSTEM_PULLREQUEST_TARGETBRANCH}" -replace "refs/heads/"),
  [string] $DiffPath = "",
  [string] $DiffFilterType = 'd'
)

Set-StrictMode -Version 3
. (Join-Path $PSScriptRoot common.ps1)

return Get-ChangedFiles -SourceCommittish $SourceCommittish `
-TargetCommittish $TargetCommittish `
-DiffPath $DiffPath `
-DiffFilterType $DiffFilterType