From: Eric Sunshine Date: Tue, 04 Mar 2025 18:28:42 GMT Subject: Re: [PATCH 1/1] t1403: prefer test_path_exists helper function Message-ID: In-Reply-To: On Tue, Mar 4, 2025 at 1:07 PM Eric Sunshine wrote: > > >> >> > remove_object() { > > >> >> > file=$(sha1_file "$*") && > > >> >> > - test -e "$file" && > > >> >> > + test_path_exists "$file" && > > >> >> > rm -f "$file" > > >> >> > } && > > However, it's still not clear to me why this function is making the > `test -e "$file"` assertion in the first place or why the enclosing > test should care, especially since that assertion is only checking > that `git commit` worked correctly, but that's not the intent of this > particular test[1]. So, `test -e "$file"` seems pointless or at least > misleading. Perhaps, I'm falling into the trap of assuming that a lone `git commit` in a new repository will unconditionally create a loose object, and that that will always be the case? If, down the road, `git commit` no longer works that way, then the assumption about the loose object becomes invalid, in which case I can see how the `test -e "$file"` assertion is protecting the test against that future.