Thread (26 messages) flat view 26 messages, 3 authors, 2018-06-21

Re: [RFC PATCH 09/10] submodule: support reading .gitmodules even when it's not checked out

From: Stefan Beller <hidden>
Date: 2018-05-15 01:46:02

On Mon, May 14, 2018 at 3:58 AM, Antonio Ospite [off-list ref] wrote:
When the .gitmodules file is not available in the working directory, try
using HEAD:.gitmodules from the index.
I think HEAD:.gitmodules is different than the index (the former is
part of the latest commit, whereas the index could have changed via
git-add, that is not committed yet).
This covers the case when the
file is part of the repository but for some reason it is not checked
out, for example because of a sparse checkout.

This makes it possible to use at least the 'git submodule' commands
which *read* the gitmodules configuration file without fully populating
the work dir.
Instead of checking for an explicit sparse "hidden" could we just rely on
the file missing? Then I could continue using submodules if I just
"rm .gitmodules".
Writing to .gitmodules wills still require that the file is checked out,
so check for that in config_gitmodules_set.
That makes sense!
Signed-off-by: Antonio Ospite <redacted>
---

I am doing the is_gitmodules_hidden() check in the open for now, I am not sure
whether it is approprate to do that inside stage_updated_gitmodules.
Why do we need that check at all?

In your use case, you want to checkout *a* .gitmodules file, not necessarily
the .gitmodules file of that repo you're currently working on. So it
sort of makes
sense to prevent cross-repo changes (i.e. committing the .gitmodules
accidentally
into the wrong repo)

Stefan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help