Subject: Re: [PATCH v3 0/1] Support updating working trees when pushing into non-bare repos

From: Junio C Hamano <[email-masked]>
Date: Thu, 13 Nov 2014 11:11:41 -0800

Junio C Hamano <[email-masked]> writes:

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