prepare-ChangeLog does not show the correct result with using --git-commit
https://bugs.webkit.org/show_bug.cgi?id=230816
Patch by Hoa Dinh <dvh@apple.com> on 2021-09-27
Reviewed by Jonathan Bedard.
When we pass the parameter --git-commit, we need to use the correct reference version when
computing the difference between the version before and after the change.
This patch fixes it by passing the version before the specified commit.
Also, when --git-commit is used, we need compare against the correct version of the file.
This patch fixes that part by calling git to retrieve the accurate version.
* Scripts/prepare-ChangeLog:
(originalFile):
(generateFunctionLists):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@283112 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Tools/Scripts/prepare-ChangeLog b/Tools/Scripts/prepare-ChangeLog
index 479d779..41063c0 100755
--- a/Tools/Scripts/prepare-ChangeLog
+++ b/Tools/Scripts/prepare-ChangeLog
@@ -268,7 +268,9 @@
$command = SVN . " cat $escapedPathsString";
} elsif (isGit()) {
$command = GIT . " show ";
- if ($mergeBase) {
+ if ($gitCommit) {
+ $command .= "$gitCommit^";
+ } elsif ($mergeBase) {
$command .= "$mergeBase";
} else {
$command .= "HEAD";
@@ -290,7 +292,12 @@
},
openFile => sub ($) {
my ($file) = @_;
- return unless open(SOURCE, "<", $file);
+ if (isGit() && $gitCommit && !$gitIndex) {
+ my $command = GIT . " show " . "$gitCommit" . ":'$file'";
+ return unless open(SOURCE, "-|", $command);
+ } else {
+ return unless open(SOURCE, "<", $file);
+ }
return \*SOURCE;
},
openOriginalFile => sub ($) {