aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorMichael Hackner <mhackner@gmail.com>2026-09-27 13:31:20 -0700
committerGitHub <noreply@github.com>2026-09-27 22:31:20 +0200
commit2527eed26354dd18090b3de29f7fa0f7a1872540 (patch)
tree11053426b82bb1f05a19bcc4ccbd26e02dbda111 /scripts
parentc210c953e454882c5ef3cd366bcd4b53b7c64791 (diff)
fix: make release test robust to diff.noPrefix git config (#4663)
`git apply` by default expects `-p1`, which is the default behavior of `git diff`, but this can be overridden by config. Specify it explicitly so it works regardless.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/test_release.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/test_release.py b/scripts/test_release.py
index f495c89c..bf79c0e8 100644
--- a/scripts/test_release.py
+++ b/scripts/test_release.py
@@ -193,7 +193,10 @@ class ReleaseTests(unittest.TestCase):
release.select_hotfix("release/hotfix", "v2.0.0")
candidate = self.prepare()
release.validate_diff(hotfix, candidate, "1.0.1")
- patch = subprocess.check_output(["git", "diff", "--binary", hotfix, candidate])
+ # Reproduce a developer git config with diff prefixes disabled; the
+ # explicit --default-prefix must keep the patch applicable to git apply -p1.
+ self.git("config", "diff.noprefix", "true")
+ patch = subprocess.check_output(["git", "diff", "--binary", "--default-prefix", hotfix, candidate])
self.git("checkout", "-q", "master")
subprocess.run(["git", "apply", "--3way", "--index"], input=patch, check=True)
self.assertEqual(Path("src/feature.rs").read_text(), "b and c\n")