Re: [PATCH 12/17] update submodules: add submodule_move_head
- From
Stefan Beller <sbeller@google.com>
- Date
- Mar 13, 2017, 20:50 UTC
- Message-ID
- <CAGZ79kYGdafOc4W6_aUwvCDs5aqXKf5fwa8msQ2gq4swND69ng@mail.gmail.com>
- In-Reply-To
- <xmqqo9x7ug2j.fsf@gitster.mtv.corp.google.com>
On Sat, Mar 11, 2017 at 11:09 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 25 quoted lines
> Brandon Williams <bmwill@google.com> writes:
>
>>> diff --git a/submodule.c b/submodule.c
>>> index 0b2596e88a..bc5fecf8c5 100644
>>> --- a/submodule.c
>>> +++ b/submodule.c
>>> @@ -1239,6 +1239,141 @@ int bad_to_remove_submodule(const char *path, unsigned flags)
>>> return ret;
>>> }
>>>
>>> +static int submodule_has_dirty_index(const struct submodule *sub)
>>> +{
>>> + struct child_process cp = CHILD_PROCESS_INIT;
>>> +
>>> + prepare_submodule_repo_env_no_git_dir(&cp.env_array);
>>> +
>>> + cp.git_cmd = 1;
>>> + argv_array_pushl(&cp.args, "diff-index", "--quiet", \
>>> + "--cached", "HEAD", NULL);
>>
>> The formatting of this line is a little odd. Also you can drop the
>> backslash.
>
> Heh. I think I saw and pointed out the same during the review of
> the previous round X-<. It is a bit disappointing.Yes. I remember having a local mixup of branches, such that I fear I may have missed other feedback of the previous round as well then. I do remember removing a backslash, so maybe I got confused with another backslash as well.
I'll reroll with this fixed.
Show 18 quoted lines
>
>>> +static void submodule_reset_index(const char *path)
>>> +{
>>> + struct child_process cp = CHILD_PROCESS_INIT;
>>> + prepare_submodule_repo_env_no_git_dir(&cp.env_array);
>>> +
>>> + cp.git_cmd = 1;
>>> + cp.no_stdin = 1;
>>> + cp.dir = path;
>>> +
>>> + argv_array_pushf(&cp.args, "--super-prefix=%s/", path);
>>> + argv_array_pushl(&cp.args, "read-tree", "-u", "--reset", NULL);
>>> +
>>> + argv_array_push(&cp.args, EMPTY_TREE_SHA1_HEX);
>
> Somewhat related; will this use of --super-prefix be affected when
> we split it into two for "adjust pathspec" prefix and "adjust
> output" prefix?Let's see how the superproject prefixing evolves and what Brandon sends out. When the superprefix changes its meaning I'll adjust here.