Skip to content

Failing to get parseUnifiedDiff for copied files  #193

@MadnessIRL

Description

@MadnessIRL

When parsing a file that was copied in a raw pull request .diff, UnifiedDiffReader will fail with:

com.github.difflib.unifieddiff.UnifiedDiffParserException: expected file start line not found
	at com.github.difflib.unifieddiff.UnifiedDiffReader.parse(UnifiedDiffReader.java:120)

To Reproduce

  1. Obtain the .diffs via bitbucket API of a PR that has a copy of a file, e.g.:
diff --git src://modules/configuration/config/web/pcf/account/AccountContactCV.pcf dst://modules/configuration/config/web/pcf/account/AccountContactCV.default.pcf
similarity index 99%
copy from modules/configuration/config/web/pcf/account/AccountContactCV.pcf
copy to modules/configuration/config/web/pcf/account/AccountContactCV.default.pcf
index 13efef5778..1a08b0befc 100644
--- src://modules/configuration/config/web/pcf/account/AccountContactCV.pcf
+++ dst://modules/configuration/config/web/pcf/account/AccountContactCV.default.pcf
@@ -1,16 +1,17 @@
 <?xml version="1.0"?>
 <PCF
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="../../../../../pcf.xsd">
   <CardViewPanel
-    id="AccountContactCV">
+    id="AccountContactCV"
+    mode="default">
     <Require
       name="acctContact"
       type="AccountContact"/>
     <Require
       name="showAddressTools"
       type="boolean"/>
     <Require
       name="showRolesTab"
       type="boolean"/>
     <Variable
  1. Try obtaining the UnifiedDiffs:
    image

image

Notice how the file that was being looked by UnifiedParseDiff does not exist here, and the new copy should have been used instead (AccountContactCV.default.pcf)
image

Expected behavior
The correct file should be parsed and/or consider the original one removed.

System

  • Java 17
  • 4.12(latest)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions