On Thu, Aug 18, 2016 at 11:25 AM, Stefan Beller <sbel...@google.com> wrote:
> On Wed, Aug 17, 2016 at 5:51 PM, Jacob Keller <jacob.e.kel...@intel.com> 
> wrote:
>> From: Jacob Keller <jacob.kel...@gmail.com>
>> The submodule log diff output incorrectly states that the submodule is
>> "not checked out" in cases where it wants to say the submodule is "not
>> initialized". Change the wording to reflect the actual check being
>> performed.
>> Signed-off-by: Jacob Keller <jacob.kel...@gmail.com>
>> ---
>>  submodule.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> diff --git a/submodule.c b/submodule.c
>> index 1b5cdfb7e784..e1a51b7506ff 100644
>> --- a/submodule.c
>> +++ b/submodule.c
>> @@ -348,7 +348,7 @@ void show_submodule_summary(FILE *f, const char *path,
>>         if (is_null_sha1(two))
>>                 message = "(submodule deleted)";
>>         else if (add_submodule_odb(path))
>> -               message = "(not checked out)";
>> +               message = "(not initialized)";
> I think "not checked" out is actually correct here.

Hmmm.. It shouldn't say not checked out. I was running iinto problems
in some of my tests which indicated that the entire sub module didn't
exist. I think I had already assumed it wasn't failing when no
checkout. I think I have some fix for add_submodule_odb that can help
with this, making submodule dir behave correctly for this case.

I want add_submodule_odb to work in both of these cases:

a) we don't have a working checkout but we have the objects in the
usual location
b) we have a working directory with objects inside a .git folder but
it hasn't yet been moved into .git/modules/<>

I'll take a look and see what I can do.

>     $ git clone https://gerrit.googlesource.com/gerrit
>     $ cd gerrit
>     $ git submodule update --init
>       ...
>     $ git diff cc82b24..5222e66 plugins/
>     Submodule plugins/cookbook-plugin 2d40ee2..69b8f9f:
>      > Organize imports
>     $ rm -rf plugins/cookbook-plugin/
>     $ git diff cc82b24..5222e66 plugins/
>     Submodule plugins/cookbook-plugin 2d40ee2...69b8f9f (not checked out)
>     $
> Mind that by "rm -rf" of the working dir I create the "not checked out,
> but initialized state and even cloned state".
> So as a long term TODO:
>     I guess we could teach `add_submodule_odb` to operate
>     inside its git directory instead of its working directory, to have
>     it working whenever we have the object database (no matter if
>     checked out or not). Although this may collide with the plan of a
>     different refs backend? I dunno.
> add_submodule_odb is used in a variety of places:
>     show_submodule_header
>     submodule_needs_pushing
>     push_submodule
>     is_submodule_commit_present
>     merge_submodule
> And all of them seem to not require a checkout, but the presence of
> objects is fine.

Yea, they really only need objects, not the working tree.

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to