Unity icon indicating copy to clipboard operation
Unity copied to clipboard

Submodule support

Open andybak opened this issue 6 years ago • 6 comments

I had to abandon Git Desktop because of it's patchy and incomplete support for submodules.

It would be helpful if the docs for this project could state how complete submodule support is and what limitations there are.

andybak avatar Jul 04 '18 10:07 andybak

@andybak Thanks for the feedback! Right now we don't do anything special with submodules, but there are certainly improvements that can be made, particularly in showing changes in submodules and guiding users in how to commit them. Are there particular things that you'd like to see from submodule support?

shana avatar Jul 04 '18 12:07 shana

Right now we don't do anything special with submodules

So - would you expect common sense basic workflows using submodules to work? I'm mainly interested in being able to use submodules in a project with non-coders for 3rd party code.

I don't mind if adding and updating submodules requires me to use the shell - but other team members shouldn't have to if they don't touch the submodule contents.

  1. Assuming they never edit files in the submodule - then the submodule should be pretty invisible to them i.e. nothing should ever appear in the list of local changes (Github desktop fails at this)
  2. Pulls should checkout newly added submodule code
  3. Pulls should update submodules if they've been changed externally (i.e. pointing to a new commit hash)
  4. It should be possible to discard accidental changes to local files within a submodule (it would be nice if a commit was possible too but that's not part of my use-case)

In summary - people who don't know how to use git via the command line should be able to interact with projects that use submodules as long as they don't want to interact directly with the submodule code.

andybak avatar Jul 04 '18 14:07 andybak

Yup, that all makes sense. I'll take this issue and turn it into a spec list of improvements for submodule support so we can start adding those things in.

Level 1 easy submodule support

  • [ ] Pull should be followed by submodule update --init
  • [ ] Branch switch should also do submodule update --init

Level 2

  • [ ] Discard on a submodule entry should discard changes in the submodule

Level 3

  • [ ] Changes view should list the file changes in submodules
  • [ ] A commit that includes all submodule changes should commit those first and then commit the parent submodule hash change

shana avatar Jul 05 '18 12:07 shana

Awesome improvement, I'm looking forward to it!

Another nice to have feature would be to allow users to choose which branch/tag of the submodule they are using.

Imagine I am the maintainer of a shared submodule and I want to release a new version that has breaking changes with all current projects. I don't want my others to update their main repo and automatically have their project stop working. Only if they select the newer version this would happen, and they would know that they need to manually fix things.

aviggiano avatar Dec 03 '18 11:12 aviggiano

Hello, I would also really appreciate better submodule support.

Unknowingly I added a folder of 3rd party code into my Unity project that had some .git configuration files in it and it registered as a submodule (invisibly). When I cloned my project on another computer using github desktop, the folder in Assets was gone and of course the project was broken. I was confused for a while but then I checked in github site and it appeared as submodule, with no obvious way to manage. Apparently only way is through command line. Seems like Github for Unity should be a bit more informative about this so it is easier to use for the non-coders in teams.

Github for Unity should alert to the presence of any git-altering files when assets are added and allow the user to decide what to do (or have some settings to auto manage) and also allow an interface to list present submodules, add submodule from remote repo, update, and switch the branches of a submodule.

Actually this would also be nice in Github Desktop.

Cdddo avatar Apr 03 '19 19:04 Cdddo

@shana Unsure if "file changes" mentioned under level 3 includes "file additions". I'm hoping this includes auto-adding files created inside submodules within Unity (similar to how new files behave in the parent folder).

helixquar avatar Apr 06 '21 14:04 helixquar