Skip to content

Commit

Permalink
updateAUTHORS.pm: overrule 'diff.algorithm'
Browse files Browse the repository at this point in the history
When the 'diff.algorithm' in git config is set to 'patience'
(i.e. `git config diff.algorithm patience`) then t/porting/update_authors.t
failed because it can renders a slightly different diff which results in
different line counts which caused the test failed.

An example of such a commit f7e7b4d:
	$ git show --oneline --numstat --diff-algorithm=myers f7e7b4d
	f7e7b4d win32.c: use _mkgmtime() instead of mktime() in stat()
	11      2       pod/perldelta.pod
	10      13      win32/win32.c

	$ git show --oneline --numstat --diff-algorithm=patience f7e7b4d
	f7e7b4d win32.c: use _mkgmtime() instead of mktime() in stat()
	11      2       pod/perldelta.pod
	9       12      win32/win32.c

Note: I opted to use `git -c diff.algorithm` since that will also
      work on old git versions that don't support `git log --diff-algorithm`
  • Loading branch information
Bram authored and demerphq committed Sep 6, 2022
1 parent a128afa commit 70d9119
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Porting/updateAUTHORS.pm
Expand Up @@ -211,7 +211,7 @@ sub read_commit_log {
push @args, "'$self->{commit_range}'" if $self->{commit_range};

my $last_commit_info;
my $cmd= qq(git log @args);
my $cmd= qq(git -c diff.algorithm=myers log @args);
$cmd =~ s/'/"/g if $^O =~ /Win/;
open my $fh, "-|", $cmd
or die "Failed to open git log pipe: $!";
Expand Down

0 comments on commit 70d9119

Please sign in to comment.