Re: [PATCH v3 0/1] Support updating working trees when pushing into non-bare repos
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Nov 13, 2014, 19:11 UTC
- Message-ID
- <xmqqd28q29w2.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <xmqqbnob2ds7.fsf@gitster.dls.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 21 quoted lines
>> -static const char *merge_worktree(unsigned char *sha1)
>> +static const char *update_worktree(unsigned char *sha1)
>> {
>> const char *update_refresh[] = {
>> "update-index", "--ignore-submodules", "--refresh", NULL
>> };
>> + const char *diff_index[] = {
>> + "diff-index", "--quiet", "--cached", "--ignore-submodules",
>> + "HEAD", "--", NULL
>> + };
>> const char *read_tree[] = {
>> "read-tree", "-u", "-m", sha1_to_hex(sha1), NULL
>> };
>
> OK.
>
> "update-index --refresh && diff-files && diff-index --cached" is how
> we traditionally ensure the working tree is absolutely clean (see
> require_clean_work_tree in git-sh-setup.sh), but I do not think of a
> reason why diff-files step is not redundant. As a totally separate
> topic outside this series, we may want to visit that shell function.Ahh, scratch that. Over there we use 'update-index -q --refresh', so the difference between the index and the working tree is not noticed and we do need diff-files. Here, the code runs update-index without -q, so we do catch such a difference without diff-files.
Sorry for the noise ;-)