Skip to content

Commit

Permalink
[nektos#2056] Fixed failing tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
GROwen committed Oct 23, 2023
1 parent a6325c2 commit c840dac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/common/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ func FindGitRef(ctx context.Context, file string) (string, error) {
return "", err
}

headRef, _ := repo.Head()
headRef, err := repo.Head()
if err != nil {
return "", err
}
logger.Debugf("HEAD points to revision '%s'", headRef.Hash().String())

// The assumption is made that if the revision has a tag associated with it the ref and ref_name should reference it.
Expand Down
1 change: 1 addition & 0 deletions pkg/common/git/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ func TestGitFindRef(t *testing.T) {
},
"current_head_is_master_and_pointer_exists_to_another_branch": {
Prepare: func(t *testing.T, dir string) {
require.NoError(t, gitCmd("-C", dir, "commit", "--allow-empty", "-m", "msg"))
require.NoError(t, gitCmd("-C", dir, "checkout", "-b", "mybranch"))
require.NoError(t, gitCmd("-C", dir, "checkout", "master"))
},
Expand Down

0 comments on commit c840dac

Please sign in to comment.