You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TonelLoaderGitVersionStrategy>>#attemptVersionFromGit silently fails when .git/HEAD does not point a branch but a commit. In Jenkins this might happen depending on how the checkout is done. In the attached version an error is raised when versioning fails for that reason.
!TonelLoaderGitVersionStrategy privateMethods !
attemptVersionFromGit
"Private - Attempts to read git metadata from the repository path of the loader (if available)."self loader reader repositoryPath
ifNil: [TonelLoaderErrorsignal: ('There is no repository path specified')]
ifNotNil: [:repoPath | | gitBranchCommitFilegitBranchPathgitHeadPathcommitHashcommitDate |
gitHeadPath := (repoPath append:'.git') append:'HEAD'.
gitHeadPath exists
ifTrue: [| refsPathString headFile stat |
[
headFile :=CfsReadFileStreamopen: gitHeadPath asString.
refsPathString := headFile nextLine.
refsPathString := refsPathString copyFrom:6to: refsPathString size]
ensure: [headFile close].
gitBranchPath := (repoPath append:'.git') append: refsPathString.
gitBranchPath exists
ifTrue: [
gitBranchCommitFile :=CfsReadFileStreamopen: gitBranchPath asString.
[
commitHash := gitBranchCommitFile nextLine first:7.
stat := gitBranchPath cfsStat.
commitDate :=DateAndTimedate: stat stMtime first time: stat stMtime last]
ensure: [gitBranchCommitFile close].
commitHash isEmptyOrNil
ifTrue: [
TonelLoaderErrorsignal:
('Could not retrieve commit hash from the repository')]
ifFalse: [
^(self versionNamePattern
expandMacrosWith: commitHash
with: gitBranchPath parts last
with: commitDate)]]
ifFalse: [
TonelLoaderErrorsignal: (
'There is no git branch path at <1p>'expandMacrosWith: gitBranchPath)]]
ifFalse: [
TonelLoaderErrorsignal: (
'There is no git repository at <1p>'expandMacrosWith:self loader reader repositoryPath)]
].
^nil! !
ps: Issue reported by Adriaan van Os
The text was updated successfully, but these errors were encountered:
TonelLoaderGitVersionStrategy>>#attemptVersionFromGit silently fails when .git/HEAD does not point a branch but a commit. In Jenkins this might happen depending on how the checkout is done. In the attached version an error is raised when versioning fails for that reason.
ps: Issue reported by Adriaan van Os
The text was updated successfully, but these errors were encountered: