Re: [PATCH v2 1/2] t4129: test that git apply warns for unexpected mode changes
- From
Mark Mentovai <mark@chromium.org>
- Date
- May 24, 2025, 03:10 UTC
- Message-ID
- <d14135de-ddbc-0875-3ffe-700a2fd33d90@chromium.org>
- In-Reply-To
- <xmqqmsb2vr6z.fsf@gitster.g>
Junio C Hamano wrote:
Show 26 quoted lines
> Mark Mentovai <mark@chromium.org> writes:
>> diff --git a/t/t4129-apply-samemode.sh b/t/t4129-apply-samemode.sh
>> index 2149ad5da44c..082e56db651e 100755
>> --- a/t/t4129-apply-samemode.sh
>> +++ b/t/t4129-apply-samemode.sh
>> @@ -102,15 +102,23 @@ test_expect_success POSIXPERM 'do not use core.sharedRepository for working tree
>> )
>> '
>>
>> +test_file_mode_staged () {
>> + git ls-files --stage -- "$2" >ls-files-output &&
>> + test_grep "^10$1 " ls-files-output
>> +}
>> +
>> +test_file_mode_HEAD () {
>> + git ls-tree HEAD -- "$2" >ls-tree-output &&
>> + test_grep "^10$1 " ls-tree-output
>> +}
>
> The script is about testing executable bits, so it is fine that the
> above cannot be used to expect a symbolic link (if we wanted to
> support it, we'd just take the whole 100644 vs 120000 without
> support to let the caller give abbreviated input).
>
> But then it is curious that this asks the caller to say 0755 vs 0644,
> not 755 vs 644, which would be sufficient.The leading 0 was because I prefer to present numbers represented in octal in this form.
On the basis of your comment in the 2/2 patch about using 000000 for an absent file, I'll change this to use the six-digit form uniformly.
> Very portable way to add an executable file. Would work regardless > of the filesystem. Very nice.
Thanks!