On Thu, Jul 6, 2017 at 7:13 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Stefan Beller <sbeller@xxxxxxxxxx> writes: > >> Speaking of submodules, It's not just features, but I also send bug fixes. ;) >> https://public-inbox.org/git/20170630003851.17288-1-sbeller@xxxxxxxxxx/ >> (That patch is not related to this series, except for working in the submodule >> area, but I consider that patch more important than e.g. this series.) > > I did not see the patch as fixing a bug, though. > > I do agree that overwriting the branch tips in the submodule > repositories, possibly rewinding and discarding user's work done on > the local branches, is indeed a problem. It however is unclear why > detaching HEAD is a good solution to solve that problem. I am not saying detaching a HEAD is a good solution, but I am saying it is a better solution than corrupting the submodule branch, such that commits are lost in the submodule, only to be recorvered via the reflog. > After all, there must have been a reason why the user had checked > out a branch and had pointed it at a specific commit (presumably, > so that further work would be done while on the branch, to make it > easier and safer to eventually push the result back to the upstream > of the submodule's project). So another solution that seems equally > viable, if not even more so, could be to fail the recursive checkout > saying why the checkout cannot be done, just like we fail a checkout > when a local change interferes with updating the contents in the > working tree and the index with an error message explaining which > paths are problematic. That seems like a better model to me for now. > I am *not* saying which one among the above two is better; I am not > even saying that there could be only these two possible solutions. > I just found the posted patch unsatisfactory because it did not make > it clear why the chosen solution is a good one. ok. My long term plan is to introduce another type of symbolic ref, which references a gitlink in another repository, such that the submodule can have a clear distinction between "follows the superproject", "has its own authoritative branch" and "its detached HEAD can mean anything, e.g. historical submodule behavior" > Perhaps I misread the description; but that would mean the > description was prone to be misread and has room for improvement ;-) ok.