我们试图创建一个补丁文件,其中包含两个moodle版本之间的更改。
就是这样做的
$ git clone https://github.com/moodle/moodle.git
$ cd moodle
$ git diff v3.8.1...v3.11.0 > /tmp/upgrade3_8_1__3_11_0.patch
但当我们验证这个文件时,补丁似乎很奇怪:
$ grep " a/version.php" /tmp/upgrade3_8_1__3_11_0.patch -A 13
diff --git a/version.php b/version.php
index 6806d4e84d7..9c4d48bbb41 100644
--- a/version.php
+++ b/version.php
@@ -29,9 +29,9 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2019111800.00; // 20191118 = branching date YYYYMMDD - do not modify!
+$version = 2021051700.00; // 20210517 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
-$release = '3.8 (Build: 20191118)'; // Human-friendly version name
-$branch = '38'; // This version's branch.
+$release = '3.11 (Build: 20210517)';// Human-friendly version name
+$branch = '311'; // This version's branch.
问题:
应该是
-$release = '3.8.1 ...
代替
-$release = '3.8 ...
如果我们只在version.php上执行命令,它会产生预期的结果:
$ git diff v3.8.1..v3.11.0 version.php
diff --git a/version.php b/version.php
index 93c45b4ab93..9c4d48bbb41 100644
--- a/version.php
+++ b/version.php
@@ -29,9 +29,9 @@
defined('MOODLE_INTERNAL') || die();
-$version = 2019111801.00; // 20191118 = branching date YYYYMMDD - do not modify!
+$version = 2021051700.00; // 20210517 = branching date YYYYMMDD - do not modify!
// RR = release increments - 00 in DEV branches.
// .XX = incremental changes.
-$release = '3.8.1 (Build: 20200113)'; // Human-friendly version name
-$branch = '38'; // This version's branch.
+$release = '3.11 (Build: 20210517)';// Human-friendly version name
+$branch = '311'; // This version's branch.
$maturity = MATURITY_STABLE; // This version's maturity level.
怎么可能呢?
我们如何创建正确的补丁?
Sidenode:我们甚至有一个不可复制的案例,git diff v3.8.1..v3.11.0 version.php
也显示了错误的结果。输出不是确定性的吗?它取决于当前分支吗?
$ git --version
git version 2.25.1
这是以前配置的:
git config diff.renameLimit 999999
您使用的是3点...
,这与使用..
不同。这两个修订的共同祖先可能是3.8,这就是为什么你会看到这样的修订集。
并且,在对文件进行转换时,您使用的是..
。尝试使用...
,您将获得相同的";出乎意料的">结果。