mirror of
https://github.com/therootcompany/golib.git
synced 2026-03-02 23:57:59 +00:00
fix(monorel): bump tags the latest commit touching the module, not HEAD
In a monorepo the module's most recent commit is often behind HEAD (other modules may have been committed on top). git log --format=%H -1 -- . run from the module root returns the SHA of the last commit that touched that directory; we pass it explicitly to `git tag <tag> <sha>` instead of letting git default to HEAD.
This commit is contained in:
parent
b1be4ce829
commit
ae46430b7b
@ -292,7 +292,13 @@ func bumpModuleTag(group *moduleGroup, component string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newTag := computeBumpTag(prefix, latestStable, component)
|
newTag := computeBumpTag(prefix, latestStable, component)
|
||||||
mustRunIn(modRoot, "git", "tag", newTag)
|
// Tag the most recent commit that touched this module's directory, which
|
||||||
|
// may be behind HEAD if other modules have been updated more recently.
|
||||||
|
commitSHA := mustRunIn(modRoot, "git", "log", "--format=%H", "-1", "--", ".")
|
||||||
|
if commitSHA == "" {
|
||||||
|
fatalf("no commits found in %s", modRoot)
|
||||||
|
}
|
||||||
|
mustRunIn(modRoot, "git", "tag", newTag, commitSHA)
|
||||||
return newTag
|
return newTag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user