Skip to content

Commit

Permalink
FTR-101 Choose the version type for the file content.
Browse files Browse the repository at this point in the history
  • Loading branch information
CDA0 committed Nov 8, 2023
1 parent fcbb599 commit 1cd6236
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Utils Changelog

## v0.0.8

* Updated `GetFileContent` in `azuredevops` to allow specifying of the version type.

## v.0.0.7

* Allowed configuring of filename in `GetFileContent` in `azuredevops`.
Expand Down
14 changes: 12 additions & 2 deletions azuredevops/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,25 @@ import (
)

// GetFileContent gets content in a file over API.
func (a *AzureDevOps) GetFileContent(projectName string, repoName string, version string, filepath string) (*git.GitItem, error) {
func (a *AzureDevOps) GetFileContent(projectName string, repoName string, version string, filepath string, versionType string) (*git.GitItem, error) {
client, err := git.NewClient(a.ctx, a.connection)
if err != nil {
return nil, err
}

var vt git.GitVersionType
switch versionType {
case "branch":
vt = git.GitVersionTypeValues.Branch
case "commit":
vt = git.GitVersionTypeValues.Commit
case "tag":
vt = git.GitVersionTypeValues.Tag
}

includeContent := true
gitVersionDescriptor := git.GitVersionDescriptor{
VersionType: &git.GitVersionTypeValues.Tag,
VersionType: &vt,
Version: &version,
}
getItemArgs := git.GetItemArgs{
Expand Down

0 comments on commit 1cd6236

Please sign in to comment.