3 # Copyright (c) 2010 Andreas Gruenbacher
6 test_description
='git apply filename consistency check'
10 test_expect_success setup
'
11 cat > bad1.patch <<EOF &&
14 index 0000000..d00491f
20 cat > bad2.patch <<EOF
22 deleted file mode 100644
23 index d00491f..0000000
31 test_expect_success
'apply diff with inconsistent filenames in headers' '
32 test_must_fail git apply bad1.patch 2>err &&
33 test_i18ngrep "inconsistent new filename" err &&
34 test_must_fail git apply bad2.patch 2>err &&
35 test_i18ngrep "inconsistent old filename" err
38 test_expect_success
'apply diff with new filename missing from headers' '
39 cat >missing_new_filename.diff <<-\EOF &&
41 index 0000000..d00491f
46 test_must_fail git apply missing_new_filename.diff 2>err &&
47 test_i18ngrep "lacks filename information" err
50 test_expect_success
'apply diff with old filename missing from headers' '
51 cat >missing_old_filename.diff <<-\EOF &&
53 index d00491f..0000000
58 test_must_fail git apply missing_old_filename.diff 2>err &&
59 test_i18ngrep "lacks filename information" err