diff options
author | Graham Knop <haarg@haarg.org> | 2022-08-18 12:27:01 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-08-18 21:29:56 +0200 |
commit | 16dd3f70cc16005d5af7146385733a7c945fb67e (patch) | |
tree | 542c3bda14bc71a5df4c3eca46be8e6a7b91b2f3 /.mailmap | |
parent | bf4a32d613b6736998d60a3c7ec23dd39cbe10a1 (diff) | |
download | perl-16dd3f70cc16005d5af7146385733a7c945fb67e.tar.gz |
fix t/porting/authors.t detection of merge commits
git-rev-parse HEAD^2` was used to detect if HEAD was a merge commit.
When HEAD is not a merge commit then HEAD^2 produces an error;
When HEAD is a merge commit then HEAD^2 points to the second parent.
The problem was that `git rev-parse "HEAD^2"` also produced output on STDOUT
which caused `$revision_range` to be set to something bogus.
Example:
$ git rev-parse HEAD^2 2>/dev/null ; echo $?
HEAD^2
128
$ git log HEAD^1..HEAD^2
fatal: ambiguous argument 'HEAD^1..HEAD^2': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
The fix is to use --verify which doesn't give output on STDOUT for something invalid.
It does print an error on STDERR (for invalid things) which can be silenced using -q
$ git rev-parse --verify HEAD^2
fatal: Needed a single revision
$ git rev-parse -q --verify HEAD^2
$
For an actual merge commit:
$ git rev-parse -q --verify e91a97a^2
bee6601bbf238b5366ce11cd41f6b095bfeebfd8
(i.e. working as expected)
Diffstat (limited to '.mailmap')
0 files changed, 0 insertions, 0 deletions