Add detection for an existing `.snapcraft.yaml` file before running `snapcraft init`
Metadata
Current evaluation
Merged fix preventing snapcraft init from creating a duplicate snapcraft.yaml when .snapcraft.yaml exists. A unit test was added per reviewer request before merge.
Suggested action: —
No scores available.
Issue body
(This fixes bug [1604326](https://pad.lv/1604326))
This ensures that an extra `snapcraft.yaml` isn't created when a `.snapcraft.yaml` file already exists.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix preventing snapcraft init from creating a duplicate snapcraft.yaml when .snapcraft.yaml exists. A unit test was added per reviewer request before merge. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix that prevents creating a duplicate snapcraft.yaml when .snapcraft.yaml already exists. The contributor added a requested unit test before maintainer approval and merge. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged after the author added a requested unit test. The change adds detection for an existing .snapcraft.yaml file before running snapcraft init, preventing duplicate file creation and fixing bug 1604326. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #5664 fix: snapcraft init crash when snapcraft.yaml exists but is empty | snapcraft | merged | Merged a fix for a snapcraft init crash when snapcraft.yaml exists but is empty. The PR addressed review comments, added unit tests, and passed all CI checks before merging. | |
| #582 Support for a hidden snapcraft.yaml | snapcraft | merged | Merged. Adds support for a hidden .snapcraft.yaml config, erroring if both it and snapcraft.yaml exist. snapcraft init still creates the standard file. Incorporated reviewer terminology feedback and passed retests before merging. | |
| #4662 fix(test): do not create 2 snapcraft.yaml and confuse location | snapcraft | merged | Merged a test fix preventing duplicate snapcraft.yaml creation in conflicting root and snap directories. Resolves silent overrides and ensures hooks are detected by clarifying fixture paths. Approved and merged. | |
| #6204 test: regression tests for .snapcraft.yaml as project file | snapcraft | merged | Merged regression tests for #5083 confirming .snapcraft.yaml detection. The fix was previously applied in PR #5349 via a craft-application 5 refactor. Adds unit, integration, and spread tests covering all supported project file locations. |