+2017-06-22 Carlos Alberto Lopez Perez <clopez@igalia.com>
+
+ pretty patch doesn't show image diffs with newer versions of git
+ https://bugs.webkit.org/show_bug.cgi?id=173691
+
+ A new security check added in git >= 2.3.3 causes it to abort
+ when the tool runs "git apply" to generate the images.
+ Detect if git supports the flag --unsafe-paths and pass it.
+
+ Reviewed by Darin Adler.
+
+ * PrettyPatch/PrettyPatch.rb:
+
2017-05-26 Devin Rousso <drousso@apple.com>
Provide bug information when https://webkit.org/b/# URLs are added in comments
def self.run_git_apply_on_patch(output_filepath, patch)
# Apply the git binary patch using git-apply.
- cmd = GIT_PATH + " apply --directory=" + File.dirname(output_filepath)
+ cmd = GIT_PATH + " apply"
+ # Check if we need to pass --unsafe-paths (git >= 2.3.3)
+ helpcmd = GIT_PATH + " help apply"
+ stdin, stdout, stderr = *Open3.popen3(helpcmd)
+ begin
+ if stdout.read().include? "--unsafe-paths"
+ cmd += " --unsafe-paths"
+ end
+ end
+ cmd += " --directory=" + File.dirname(output_filepath)
stdin, stdout, stderr = *Open3.popen3(cmd)
begin
stdin.puts(patch)