From: Jeff King Date: Thu, 27 Apr 2023 16:46:11 GMT Subject: Re: [PATCH v3 3/4] parse_commit(): handle broken whitespace-only timestamp Message-ID: <20230427164611.GA1976451@coredump.intra.peff.net> In-Reply-To: On Thu, Apr 27, 2023 at 12:55:26PM +0100, Phillip Wood wrote: > On 27/04/2023 11:11, Phillip Wood wrote: > > > > +    test_commit 1234567890 && > > > +    git cat-file commit HEAD >commit.orig && > > > +    sed "s/>.*/>    /" commit.munge && > > > +    ws_commit=$(git hash-object --literally -w -t commit > > > commit.munge) && > > > +    sed "s/>.*/>   $(printf "\013")/" commit.munge && > > > > Does the shell eat the '\v' when it trims trailing whitespace from the > > command substitution (I can't remember the rules off the top of my > > head)? > > Having looked it up, the shell trims newlines but not other whitespace so > this should be fine. Yep. I also wondered if some sed versions might complain. But it's really not that much more exotic than a tab, so it's probably OK. -Peff