miniscruff/changie

Create .changes/unreleased folder if it doesn't exist

Closed this issue · 7 comments

Is your feature request related to a problem? Please describe.
changie new fails without a .changes/unreleased folder. This explains why changie init creates a file .changes/unreleased/.gitkeep (since git doesn't retain empty folders).

Describe the solution you'd like
It would be nice if changie new simply created the folder if it doesn't exist, as happens when running changie init. This doesn't seem like a risky thing to do.

Describe alternatives you've considered
Checking the .gitkeep file into git is clearly the intended approach, but I question whether it's really necessary 🤷

haha yea, https://www.freecodecamp.org/news/what-is-gitkeep/
My idea was to create this folder, and the .gitkeep or it would be deleted, to sort of mark the folder "hey, this is where changie will put things, it is empty now, but just a heads up" sort of thing. Having new create the directory is fine and would also work, but I was thinking it would help to always have a directory around, even if empty and not have it pop in and out depending on if anything was unreleased.

I guess if init created it, but new would re-create it, then its up to you how you want to use it.

Perhaps it's a bug then? I didn't check mine in and I get this (replicated by deleting the unreleased folder in the changie repo)
Screenshot 2023-12-08 at 5 54 47 pm

I don't think people should be digging around in the .changes folder, so they shouldn't notice the unreleased folder popping in and out. Git diff only shows files added or removed not whether the folder sticks around 🙂

I don't think people should be digging around in the .changes folder, so they shouldn't notice the unreleased folder popping in and out. Git diff only shows files added or removed not whether the folder sticks around 🙂

yea, that error definitely looks like what I expect. I wouldn't call it a bug as the intended and supported use case is, you use init and then new, batch and merge as normal. If you do not use init, or you end up deleting the .gitkeep and unreleased directory it would fail.

But I would consider it a fair feature request to allow the option of keeping that directory around or having changie create it if you deleted it. However, changie will not delete the directory if it is empty. But I think git is fine with that. Not sure though.

Yes I don't think changie should delete the empty folder. But creating it if it's missing seems harmless?

Yea I think I would accept that

Thank you! I was considering trying to implement it myself but I would need to learn the code and wouldn't have time until next week 😅

Thank you! I was considering trying to implement it myself but I would need to learn the code and wouldn't have time until next week 😅

No worries, should be good to go now.