]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs-apply: ensure guilt import retains commit messages
authorDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 23:10:58 +0000 (09:10 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 30 Jul 2015 23:10:58 +0000 (09:10 +1000)
The commit message attached to each patch is being filtered out
during the process of preparing it for import via guilt. This
results in commits without the corresponding commit message.
Massage the patch format to ensure that guilt imports the commit
message along with the code changes.

Also, older versions of filterdiff do not handle git diff metadata
correctly, so add a version check on filterdiff to make sure we use
a working version.

Signed-off-by: Dave Chinner <david@fromorbit.com>
tools/libxfs-apply

index acc53815ca82d7cfbe402fd3eb5f06e876ef0694..4a8c8a68cbd2f16b63d3c517468cdd5f77c6ab50 100755 (executable)
@@ -28,6 +28,24 @@ fail()
        exit
 }
 
+# filterdiff 0.3.4 is the first version that handles git diff metadata (almost)
+# correctly. It just doesn't work properly in prior versions, so those versions
+# can't be used to extract the commit message prior to the diff. Hence just
+# abort and tell the user to upgrade if an old version is detected. We need to
+# check against x.y.z version numbers here.
+_version=`filterdiff --version | cut -d " " -f 5`
+_major=`echo $_version | cut -d "." -f 1`
+_minor=`echo $_version | cut -d "." -f 2`
+_patch=`echo $_version | cut -d "." -f 3`
+if [ $_major -eq 0 ]; then
+       if [ $_minor -lt 3 ]; then
+               fail "filterdiff $_version found. 0.3.4 or greater is required."
+       fi
+       if [ $_minor -eq 3 -a $_patch -le 3 ]; then
+               fail "filterdiff $_version found. 0.3.4 or greater is required."
+       fi
+fi
+
 # We should see repository contents we recognise, both at the source and
 # destination. Kernel repositorys will have fs/xfs/libxfs, and xfsprogs
 # repositories will have libxcmd.
@@ -123,6 +141,7 @@ filter_kernel_patch()
 
        # Create the new patch
        filterdiff \
+               --verbose \
                -I $_libxfs_files \
                --strip=1 \
                --addoldprefix=a/fs/xfs/ \
@@ -148,6 +167,7 @@ filter_xfsprogs_patch()
 
        # Create the new patch
        filterdiff \
+               --verbose \
                -I $_libxfs_files \
                --strip=3 \
                --addoldprefix=a/ \