MycroftAI / mycroft-skills-kit

Mycroft Skills Kit
Apache License 2.0
28 stars 12 forks source link

Update to switch branch correctly #36

Closed forslund closed 4 years ago

forslund commented 4 years ago

This runs "git remote origin -a" to set the local HEAD reference to the same as the remote. (see "git remote set-head --help")

Could use some additional testing but seems safe as far as I can see.

krisgesling commented 4 years ago

Hey I was just reading some of the git docs to consider possible edge cases and saw:

With -a or --auto, the remote is queried to determine its HEAD, then the symbolic-ref refs/remotes//HEAD is set to the same branch. e.g., if the remote HEAD is pointed at next, "git remote set-head origin -a" will set the symbolic-ref refs/remotes/origin/HEAD to refs/remotes/origin/next. This will only work if refs/remotes/origin/next already exists; if not it must be fetched first.

Whilst unlikely, I guess there's the chance that the remote HEAD doesn't exist locally yet. Is it worth running fetch first?

forslund commented 4 years ago

Maybe, at this point the submodule should be initialized and thus fetched...I think...It can't do any harm however so we might just do it so it's 100 % safe...

krisgesling commented 4 years ago

This seems to be working well as it is. Do you want to add in the extra fetch to be super safe?

forslund commented 4 years ago

Maybe we can merge it as it is and if the issue occurs we can handle it.