From: Mark Mentovai Date: Sat, 24 May 2025 03:10:27 GMT Subject: Re: [PATCH v2 1/2] t4129: test that git apply warns for unexpected mode changes Message-ID: In-Reply-To: Junio C Hamano wrote: > Mark Mentovai 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!