t8300: compensate for Git sha256 patch-id behavior
commit33333cf7ecaf2b9b07ff7eca930b259fbb3be6c8
authorKyle J. McKay <mackyle@gmail.com>
Sat, 21 Aug 2021 12:14:11 +0000 (21 05:14 -0700)
committerKyle J. McKay <mackyle@gmail.com>
Sat, 21 Aug 2021 12:14:11 +0000 (21 05:14 -0700)
tree6da1745434b0d417ccbe2f0327786db1e4d3c0d0
parent6eac1b000a427ecb522c3550a1bc37f12bf25526
t8300: compensate for Git sha256 patch-id behavior

The help for `git patch-id` says:

  Read a patch from the standard input and compute the patch ID for it.

  A "patch ID" is nothing but a sum of SHA-1 of the file diffs associated
  [...]

It neglects to mention anything about SHA2 sha256 or anything about the
output being affected by whether or not the current directory is a valid
`git rev-parse --git-dir` or not.

And yet, if the current directory is a valid `git rev-parse --git-dir`
directory AND it happens to be using sha256 instead of sha1, then the
output of `git patch-id` will be using sha256 instead of sha1.

There's, of course, nothing about this in the help for `git patch-id`
at all -- it continues to reference SHA-1.

However, simply setting the git directory (using GIT_DIR, --git-dir or -C),
addresses the problem.

A very simple fix for a non-obvious issue which is, fortunately,
future-proof if the `git patch-id` behavior ends up getting changed.

Signed-off-by: Kyle J. McKay <mackyle@gmail.com>
t/t8300-wayback-export.sh