Re: [PATCH] ls-files: respect 'submodule.recurse' config

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

 



Hi Junio,

> Le 10 sept. 2020 à 00:25, Junio C Hamano <gitster@xxxxxxxxx> a écrit :
> 
> "Philippe Blain via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes:
> 
>> From: Philippe Blain <levraiphilippeblain@xxxxxxxxx>
>> 
>> `git ls-files` learned to recurse into submodules when given
>> '--recurse-submodules' back in e77aa336f1 (ls-files: optionally recurse
>> into submodules, 2016-10-07) but it does not respect the
>> 'submodule.recurse' config option which was later introduced in
>> 046b48239e (Introduce 'submodule.recurse' option for worktree
>> manipulators, 2017-05-31).
>> 
>> Add a 'git_ls_files_config' function to read this configuration
>> variable, and adjust the documentation and tests accordingly.
> 
> I am afraid that this will break existing scripts big time, and I
> would not be surprised if 046b48239e refrained to do the equivalent
> of this patch very much on purpose to avoid such a regression.

As I read it, 046b48239e was just the introduction of the config and
it's implementation for read-tree/checkout/reset, and the other commands
with '--recurse-submodules' would come later (as was done in the following 
commits in branch 'sb/submodule-blanket-recursive').

Also, in gitsubmodules(7) [1], 'ls-files' is used as if it respects 'submodule.recurse',
so I think that was Stefan's original plan. (It's been that way since the introduction
of that man page in d48034551a).

> Anybody who writes a script using ls-files _without_ passing the
> --recurse-submodules option expects that the ls-files command will
> stop at submodule boundary without recursing, that the script can
> notice and pick up mode 160000 entries in the output from ls-files,
> and that the script can decide if it wants to descend into
> submodules it discovered that way.
> 
> It is easy to imagine that such a script will break badly when run
> by a user who has the configuration variable set, I would think.

I understand, but I would argue that such a user could easily adapt their
script to add '--no-recurse-submodules' to their ls-files invocation if that 
is the case, no ?

> So, no.  I am not enthused to see this change.

OK, if I'm not able to change your mind, what would you think of a separate
config variable then, say `ls-files.recurseSubmodules` ? This would be more granular,
so less chance of breaking existing scripts, but still provide for a way to configure 
Git to always recurse in submodules, including for 'ls-files'...

Thanks,
Philippe.


[1] https://git-scm.com/docs/gitsubmodules#_workflow_for_an_artificially_split_repo





[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