-
Notifications
You must be signed in to change notification settings - Fork 269
[pull] Implement pull <git> #1061
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
Conversation
internal/boxcli/pull.go
Outdated
|
||
cmd.Flags().BoolVarP( | ||
&flags.force, "force", "f", false, | ||
"Force overwrite of existing global config files", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drop global
and make singular file
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do. I've been adding [global]
to indicate optionality.
internal/boxcli/pull.go
Outdated
path, err := ensureGlobalConfig(cmd) | ||
if err != nil { | ||
return errors.WithStack(err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how should we refactor this call so that it is applicable to non-global use-case as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be here, global parent command already does this. Will remove.
internal/boxcli/pull.go
Outdated
return errors.WithStack(err) | ||
} | ||
|
||
err = box.PullGlobal(cmd.Context(), overwrite, pullPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets rename PullGlobal
to just Pull
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, was on my todo.
@savil FYI, the implementation changed a bit (now simpler). We don't create git repos, we just copy the content to avoid keeping any state. |
## Summary Stacked on #1061 This allows users to push global config (and any other files) to a repo. Pushing applies the current global profile on top of the latest commit in the repo (clone, commit, and push). It does not require force because it always applies on the latest commit. ## How was it tested? ```bash devbox global pull git@github.com:mikeland86/global.git devbox global push git@github.com:mikeland86/global.git devbox global add curl devbox global push git@github.com:mikeland86/global.git ```
Summary
This implements
devbox global pull <git>
and offers familiar--force
flag to overwrite conflicts.Existing functionality change:
It also changes the behavior of existing
pull <url>
andpull <local-path>
to also warn and overwrite on--force
instead of merging. We do this to standardize behavior.How was it tested?