Re: [regression?] "git status -a" reports modified for empty submodule directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Johannes Sixt <j.sixt@xxxxxxxxxxxxx> writes:

> Junio C Hamano schrieb:
>> "Ping Yin" <pkufranky@xxxxxxxxx> writes:
>> 
>>> In the super project super with empty submodule directory sub
>>> $ git diff
>>> diff --git a/sub b/sub
>>> deleted file mode 160000
>>> index f2c0d45..0000000
>>> --- a/sub
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -Subproject commit f2c0d4509a3178c...
>> 
>> The repository used to have a subproject and now it doesn't.  Why
>> shouldn't it report the removal?
>
> Because you are not required to have a subproject checked out?

Yes, but.

This is a policy issue, which is not very well enforced currently.

I have been scratching my head to figure out where the right balance we
should strike at for the past week and a half.

For example, it has long been known ever since submodules were introduced
that if you work inside a sparsely checked out supermodule you have to use
"commit -a" with care, because the command notices missing submodule, and
there is no way for it to differenciate between the case you _want to_
remove it and the case you did not care about it, so you will end up
removing unchecked out submodules.

That quirk was something people could live with while submodule support
was merely a newly invented curiosity.  But I do not think a command at
high level (iow Porcelain) such as commit and status should be left
unaware of the Policy that equate missing submodule and unmodified one
forever.  We should actively enforce the policy, so that unless you
explicitly ask nicely, the command should consider a missing submodule
just as unmodified, e.g. "commit -a" should not remove unchecked out
submodules.

But then you would need a way to ask nicely.  How?  Perhaps using "git rm",
and low level "update-index --remove".  Do we even need "commit -A"?  I
doubt it --- you do not remove submodules every day.

We'd like to keep the lowest-level unaware of the Policy, which means that
"diff-files" and "diff-index" should report unchecked out submodules.
Otherwise script writers will be left with no way to differenciate missing
and removed submodules.

Once we start doing this, I think "git diff" Porcelain should fall into
Policy-aware category.





--
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux