Re: [PATCH v2 1/2] pretty: add X-Change-ID to mail formats

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 03, 2025 at 01:29:51PM +0200, Drew DeVault wrote:

> One remark that occurs to me upon spinning v2 is that I'm not sure how
> to test this behavior. There is no obvious way to cause git upstream to
> produce a commit with a change-id -- presently these are only ever added
> by third-party tools.

I don't have any opinion on the feature itself, but the plumbing way to
do it would perhaps be:

  # make some vanilla commit...
  git commit -m foo &&

  # make a new variant with the change id
  commit=$(
    git cat-file commit HEAD |
    perl -lpe 'print "change-id foo" unless length' |
    git hash-object -w --stdin -t commit
  ) &&

  # replace the old one
  git update-ref HEAD $commit

which would be enough for Git's test suite. If this is something that
other third-party tools are going to start adding, it might be worth
adding some tests to Git's suite anyway to make sure it is handled
correctly. (I didn't follow the discussion on whether a new commit
header was something the Git project wanted to endorse, versus sticking
it in a trailer line, so don't take this as either a positive or
negative on the approach).

-Peff




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux