Re: [PATCH v2 01/10] t: add helper to convert object IDs to paths
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Jun 18, 2019, 01:29 UTC
- Message-ID
- <20190618012943.GB8877@genre.crustytoothpaste.net>
- In-Reply-To
- <nycvar.QRO.7.76.6.1906172102180.44@tvgsbejvaqbjf.bet>
On 2019-06-17 at 19:05:03, Johannes Schindelin wrote:
Show 11 quoted lines
> I guess it does not *really* matter all that much, but this does spawn a
> new process (and I think it actually spawns 4 on Windows, for reasons, and
> spawning processes is super expensive on Windows).
>
> We might actually want to think about using something like this instead
> (which admittedly looks a bit like gobbledygook to the uninitiated, but it
> definitely avoids any spawned process):
>
> test_oid_to_path () {
> echo "${1%${1#??}}/${1#??}"
> }I'm fine making that change. The original design was because we had other code that used that technique and I didn't see an obviously better solution. Now you've provided one and a good justification.
I think the complexity isn't too terrible since it's a one-line function and the comment adequately explains the behavior so people don't have to parse it to understand it.
-- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204