Bug 1038193

Summary: jcr2vfs: unnecessary commits created when migrating the assets
Product: [Retired] JBoss BRMS Platform 6 Reporter: Petr Široký <psiroky>
Component: Business CentralAssignee: Neus Miras <nmirasch>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Široký <psiroky>
Severity: high Docs Contact:
Priority: medium    
Version: 6.0.0CC: pzapataf
Target Milestone: ER6   
Target Release: 6.0.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-06 20:19:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Petr Široký 2013-12-04 15:18:10 UTC
Description of problem:
Discussed with devs, pasting the initial e-mail to make the issue clear:

Hello guys,

I have question regarding the jcr2vfs migration tool and how it creates
commits is git repo.

I noticed that migration tool is IMO creating unnecessary commits. For
each migrated asset it creates one commit that only "touches" the file,
e.g. creates empty file (the regular one, dot-file for metadata is
creating with second commit) and then creates second commit with actual
content of the files. I know this is not serious issue or something like
that, but it could be confusing in some cases. 

For example this two commits are created for one particular asset (one
version of the asset to be precise, if the asset has multiple versions
more commits will be created):
================================================================================
(Commit 1)
Author:     Petr Siroky <psiroky>
AuthorDate: Mon Dec 2 17:20:11 2013 +0100
Commit:     Petr Siroky <psiroky>
CommitDate: Mon Dec 2 17:20:11 2013 +0100
---
 mortgages/src/main/resources/mortgages/No bad credit checks.rdrl | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/mortgages/src/main/resources/mortgages/No bad credit
checks.rdrl b/mortgages/src/main/resources/mortgages/No bad credit
checks.rdrl
new file mode 100644
================================================================================
(Commit 2)
Author: mic <>
Date:   Wed Oct 1 04:55:21 2008 +0200

diff --git a/mortgages/src/main/resources/mortgages/.No bad credit
checks.rdrl b/mortgages/src/main/resources/mortgages/.No bad credit
checks.rdrl
new file mode 100644
index 0000000..a2c7f62
--- /dev/null
+++ b/mortgages/src/main/resources/mortgages/.No bad credit checks.rdrl 
@@ -0,0 +1,33 @@
+<org.uberfire.java.nio.base.Properties serialization="custom">
+  <unserializable-parents/>
+  <map>
+    <default>
+      <loadFactor>0.75</loadFactor>
+      <threshold>12</threshold>
+    </default>
+    <int>16</int>
+    <int>11</int>
+    <string>fileKey</string>
+
<string>AnyObjectId[e69de29bb2d1d6434b8b29ae775ad8c2e48c5391]</string>
+    <string>dcore.relation[0]</string>
+    <string></string>
+    <string>othermeta.category[0]</string>
+    <string>Home Mortgage/Eligibility rules</string>
+    <string>isDirectory</string>
+    <boolean>false</boolean>
+    <string>dcore.subject[0]</string>
+    <string></string>
+    <string>isOther</string>
+    <boolean>false</boolean>
+    <string>isSymbolicLink</string>
+    <boolean>false</boolean>
+    <string>isRegularFile</string>
+    <boolean>true</boolean>
+    <string>dcore.description[0]</string>
+    <string></string>
+    <string>dcore.source[0]</string>
+    <string></string>
+    <string>size</string>
+    <long>0</long>
+  </map>
+</org.uberfire.java.nio.base.Properties>
\ No newline at end of file
diff --git a/mortgages/src/main/resources/mortgages/No bad credit
checks.rdrl b/mortgages/src/main/resources/mortgages/No bad credit
checks.rdrl
index e69de29..fe9b9ec 100644
--- a/mortgages/src/main/resources/mortgages/No bad credit checks.rdrl  
+++ b/mortgages/src/main/resources/mortgages/No bad credit checks.rdrl  
@@ -0,0 +1,13 @@
+package mortgages;
+
+rule "No bad credit checks"
+       salience 10
+       dialect "mvel"
+       when
+               app : LoanApplication( )
+               ( Applicant( creditRating == "OK" ) or
Applicant( creditRating == "Sub prime" ) )
+       then
+               app.setApproved( false );
+               app.setExplanation( "Only AA" );
+               retract( app );
+end
============================================================================

From my point of view the first commit is completely unnecessary (as it
only creates empty file) and could be avoided, what do you think?

Version-Release number of selected component (if applicable):
6.0.0-ER5 (6.0.0-SNAPSHOT)


Additional info:

Comment 1 Neus Miras 2013-12-04 17:05:28 UTC
Removed the separated crateFile action when the file doesn't exist. Create it when the content is written.

Commit
https://github.com/droolsjbpm/drools-wb/commit/b8cfed7787f6b4ad6d9eb15878c3f0c43bc1104e

Comment 2 Petr Široký 2014-01-14 12:25:51 UTC
This particular issue with commits is fixed in 6.0.0-ER7. Other issues with number/type of commits will be logged as separates BZs.