-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: update clones if they're present #61
Conversation
src/MultiDocumenter.jl
Outdated
elseif isempty(current_branch) | ||
@error "current_branch was empty" | ||
end | ||
run(`$(git()) -C $(doc.upstream) reset --hard origin/$(doc.branch)`) |
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.
I am also not super comfortable with the reset --hard
here. Especially if doc.upstream
is pointing into a subdirectory of a real directory. Actually, instead of -C
, should probably use --git-dir
..
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.
Is there ever any harm in hard-resetting a remote branch?
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.
I think if everything is normal, then it doesn't do anything wrong. But the cases I'm concerned about:
- Something has gone horribly wrong, and
doc.upstream
is not actually a separate Git repo anymore, and then this command nukes changes on your main repository. - The user has actually gone into the cloned directories and modified stuff, and then we nuke their updates.
So I am wondering if something like a git merge --ff-only
would be the better option here. I didn't want to do a simple git pull
, since that, I believe, would fetch all branches.
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.
What I meant is that reset --hard origin/mybranch
can't ever nuke any local changes, because those are in mybranch
instead.
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.
I might be mistaken, but I believe reset --hard
will change the commit your current branch points to origina/mybranch
(any commit not on other branches/repos will become lost-ish), and it will also nuke all uncommitted working tree changes.
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.
Oh, doh! Yeah, I just misread the command here :P
Ok, so how about we just checkout remote/mybranch
for the build?
I updated this, making it Unrelatedly, I also added |
So if you are cloning the remotes to a local directory, it updates the local remotes. Not a 100% sure about this, but it would be good to have something like this.
It does slow things down a bit (not as bad as full clones, but still). So maybe we want to guard this with an environment variable or something?