Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checkout: add flag to delete artifacts prior to checkout #154

Open
kevin-hanselman opened this issue Aug 13, 2023 Discussed in #150 · 0 comments
Open

checkout: add flag to delete artifacts prior to checkout #154

kevin-hanselman opened this issue Aug 13, 2023 Discussed in #150 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@kevin-hanselman
Copy link
Owner

kevin-hanselman commented Aug 13, 2023

Discussed in #150

OP:

Assume I've a checked out stage with file set/a1.txt and set/a2.txt

I set a git tag "1and2" for that version.

Now I add set/a3.txt and commit+push via dud. And also commit&push via git.

Next I checkout the "1and2" tag via git and want to update the symlinks.

I did dud fetch & dud checkout but the a3.txt file still exists. I had to delete the set folder and do dud fetch & dud checkout to get it updated. Probably there is a smarter way?

My response:

You have correctly identified the (currently) recommended way to handle this situation: Delete the old directory/files before checkout. I realize this is not ideal or streamlined, though.

I would like to improve this scenario by adding a checkout --rm flag that would delete the relevant artifacts for you prior to the checkout operation. I'm not sure if this would help your situation though, as it seems you are tracking individual files and not a directory. If you're changing a stage's artifacts across commits, Dud does not interrogate Git for past versions of a stage file, so it doesn't know which files were previously tracked or not. However, if you're tracking the entire set directory, checkout --rm would delete the entire directory before checking it out, thus fixing this issue.

I purposefully did not make checkout --rm the default behavior because it adds side effects to the checkout operation. Maintaining simplicity in Dud is a core principle for me.

@kevin-hanselman kevin-hanselman added enhancement New feature or request good first issue Good for newcomers labels Aug 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant