Re: [PATCH 03/10] builtin: use default hash when outside a repository
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jul 1, 2025, 21:14 UTC
- Message-ID
- <aGRP0WiG8ZRzgilp@fruit.crustytoothpaste.net>
- In-Reply-To
- <aGPIBa-1xjqk8EEE@pks.im>
On 2025-07-01 at 11:35:33, Patrick Steinhardt wrote:
Show 14 quoted lines
> On Fri, Jun 20, 2025 at 01:19:35AM +0000, brian m. carlson wrote: > > We have some commands that can operate inside or outside a repository. > > If we're operating outside a repository, we clearly cannot use the > > repository's hash algorithm as a default since it doesn't exist, so > > instead, let's pick the default instead of specifically SHA-1. Right > > now this results in no functional change since the default is SHA-1, but > > that may change in the future. > > With the preceding commit in mind that introduced GIT_HASH_ORIGINAL you > could also argue that those callsites should be converted to use that > define instead. We always used to treat them as SHA1 repositories, and > we have no better way of telling otherwise, so we use the historical > value of SHA1 so that scripts aren't dependent on how exactly Git was > built.
I don't think I want to do that. A lot of the functionality people use outside of repositories, such as index-pack and ls-remote, actually operates on repository objects and so it makes sense to use the default.
For instance, it will be a major inconvenience to still have to specify a custom object format three to five years after the switchover.
-- brian m. carlson (they/them) Toronto, Ontario, CA