Sam Vilain <sam.vilain@xxxxxxxxxxxxxxx> writes: > With submodules it can be quite easy to end up with a situation where the > version in the supermodule doesn't exist in the submodule. Add to the > example pre-commit hook a script which checks before every commit whether > the submodule commit is likely to exist at the URL defined in the > .gitmodules file. > > Signed-off-by: Sam Vilain <sam.vilain@xxxxxxxxxxxxxxx> > --- > This should be useful for those using submodules. Perhaps it should also > have an equivalent in the 'git submodule' command. If I am a developer who is not interested in any of the submodules in the project at all (i.e. I do not have any submodule checked out), my commits will never touch any of the submodules. In such a case, I shouldn't be forced to fetch/clone the submodule nor have a checkout. Which means... > +# first, check that all submodule commits are available by a remote > +# which has the same URL as the one they are listed in. > +if [ -n "$GIT_WORK_TREE" ] > +then > + cd "$GIT_WORK_TREE" > +fi > + > +git ls-tree $(git write-tree) | grep commit | > +while read mode type sha1 submodule > +do ... the input fed to this while look utterly wrong. At least, you should be checking *new* commit that is introduced to the tree with this commit. I didn't read the body of the while loop; no matter what it does, if its input is wrong, its end result cannot be correct. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html