fix: app new with chaos should just take the local repo as it is (#495)

Fixes toolshed/abra#494

Reviewed-on: toolshed/abra#495
Co-authored-by: p4u1 <p4u1_f4u1@riseup.net>
Co-committed-by: p4u1 <p4u1_f4u1@riseup.net>
This commit is contained in:
2025-02-10 14:00:42 +00:00
committed by p4u1
parent 8a7fe4ca07
commit 15d6b1a2a5
2 changed files with 9 additions and 32 deletions

View File

@ -81,35 +81,8 @@ var AppNewCommand = &cobra.Command{
log.Fatal(err)
}
// NOTE(d1): rely on tags as there is no recipe.EnvVersion yet because
// the app has not been fully created. we rely on the local git state of
// the repository
tags, err := recipe.Tags()
if err != nil {
log.Fatal(err)
}
internal.SortVersionsDesc(tags)
if len(tags) == 0 {
// NOTE(d1): this is a new recipe with no released versions
recipeVersion = config.UNKNOWN_DEFAULT
} else {
recipeVersion = tags[len(tags)-1]
}
if err := recipe.IsDirty(); err != nil {
log.Fatal(err)
}
if !internal.Offline && !recipe.Dirty {
if err := recipe.EnsureUpToDate(); err != nil {
log.Fatal(err)
}
}
}
if !internal.Chaos {
recipeVersion = chaosVersion
} else {
if err := recipe.EnsureIsClean(); err != nil {
log.Fatal(err)
}