From: Phillip Wood Date: Thu, 27 Apr 2023 11:55:26 GMT Subject: Re: [PATCH v3 3/4] parse_commit(): handle broken whitespace-only timestamp Message-ID: In-Reply-To: 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. Best Wishes Phillip > > Best Wishes > > Phillip > >> +    vt_commit=$(git hash-object --literally -w -t commit commit.munge) >> +' >> + >> +test_expect_success '--until treats whitespace date as sentinel' ' >> +    echo $ws_commit >expect && >> +    git rev-list --until=1980-01-01 $ws_commit >actual && >> +    test_cmp expect actual && >> + >> +    echo $vt_commit >expect && >> +    git rev-list --until=1980-01-01 $vt_commit >actual && >> +    test_cmp expect actual >> +' >> + >> +test_expect_success 'pretty-printer handles whitespace date' ' >> +    # as with the %ad test above, we will show these as the empty >> string, >> +    # not the 1970 epoch date. This is intentional; see 7d9a281941 >> (t4212: >> +    # test bogus timestamps with git-log, 2014-02-24) for more >> discussion. >> +    echo : >expect && >> +    git log -1 --format="%at:%ct" $ws_commit >actual && >> +    test_cmp expect actual && >> +    git log -1 --format="%at:%ct" $vt_commit >actual && >> +    test_cmp expect actual >> +' >> + >>   test_done >