]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4133-apply-filenames.sh
l10n: fr v2.23.0 round 2
[thirdparty/git.git] / t / t4133-apply-filenames.sh
CommitLineData
da915939
AG
1#!/bin/sh
2#
3# Copyright (c) 2010 Andreas Gruenbacher
4#
5
6test_description='git apply filename consistency check'
7
8. ./test-lib.sh
9
10test_expect_success setup '
a48fcd83 11 cat > bad1.patch <<EOF &&
da915939
AG
12diff --git a/f b/f
13new file mode 100644
14index 0000000..d00491f
15--- /dev/null
16+++ b/f-blah
17@@ -0,0 +1 @@
18+1
19EOF
20 cat > bad2.patch <<EOF
21diff --git a/f b/f
22deleted file mode 100644
23index d00491f..0000000
24--- b/f-blah
25+++ /dev/null
26@@ -1 +0,0 @@
27-1
28EOF
29'
30
31test_expect_success 'apply diff with inconsistent filenames in headers' '
a48fcd83 32 test_must_fail git apply bad1.patch 2>err &&
76638d90 33 test_i18ngrep "inconsistent new filename" err &&
a48fcd83 34 test_must_fail git apply bad2.patch 2>err &&
76638d90 35 test_i18ngrep "inconsistent old filename" err
da915939
AG
36'
37
42699741
RS
38test_expect_success 'apply diff with new filename missing from headers' '
39 cat >missing_new_filename.diff <<-\EOF &&
40 diff --git a/f b/f
41 index 0000000..d00491f
42 --- a/f
43 @@ -0,0 +1 @@
44 +1
45 EOF
46 test_must_fail git apply missing_new_filename.diff 2>err &&
47 test_i18ngrep "lacks filename information" err
48'
49
50test_expect_success 'apply diff with old filename missing from headers' '
51 cat >missing_old_filename.diff <<-\EOF &&
52 diff --git a/f b/f
53 index d00491f..0000000
54 +++ b/f
55 @@ -1 +0,0 @@
56 -1
57 EOF
58 test_must_fail git apply missing_old_filename.diff 2>err &&
59 test_i18ngrep "lacks filename information" err
60'
61
da915939 62test_done