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

Prevent pushin dura branches to remote #75

Open
jamestomasino opened this issue Jan 14, 2022 · 4 comments
Open

Prevent pushin dura branches to remote #75

jamestomasino opened this issue Jan 14, 2022 · 4 comments

Comments

@jamestomasino
Copy link

Some safeguards would be helpful to prevent accidentally poluting your remote with innumerable dura branches. Perhaps a git hook?

@tkellogg
Copy link
Owner

This is good to think about. I know there's another cohort of dura users that want to always push dura branches somewhere and not think about it. Branch management needs more thought.

Are there any global config variables we can set to prevent this?

@dswij
Copy link
Contributor

dswij commented Jan 15, 2022

I think you can tell git which refs you would like to push/not-push with remote.<remote-name>.push. So I assume it's something like git config --add remote.origin.push '^refs/heads/dura/*'.

Important note is that negative ref-spec is only recently added., and using git push --all will still push dura/* branches anyway.

Another idea that just came to my mind is for dura to create a new refs instead. So instead of acting under refs/heads/dura/*, dura will use refs/dura/*, with the added benefit that most of git commands won't take anything under refs/dura for consideration (e.g. git branch). I'm not so sure if this is a good idea though, I haven't found a way to use common commands in git to tinker with refs comfortably.

@JakeStanger
Copy link
Collaborator

This sounds like a good idea. I envision a push_to_remote setting in the dura repo config, which defaults to false.

I've changed my mind about 5 times while writing this so if anybody has anything to add please do, but I think we should go with the refs model. The main reason for this is the git config option won't work if a repo already has remote.origin.push set.

Should old branches be retroactively updated? These would need to be updated when the repo is polled, and probably cached in the runtime.db to avoid unnecessary work. Alternatively we could fire-and-forget, and just set the setting when the branch is created. I'm not sure how well that'd work with the proposed changes in #9 though.

@ciil
Copy link

ciil commented Jan 30, 2022

If this functionality is implemented, there probably needs to be an overall/default option regarding the frequency with which to push because I hardly think most users would want pushes every few seconds (if saving frequently). Maybe even something like a distinct pushurl from the repo config for dura branches so that not everything is immediately pushed to e.g. a public github repo but can still be safe offsite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants