#!/bin/sh # # Copyright (c) 2010 Andreas Gruenbacher # global test_description := ''git apply filename consistency check'' source ./test-lib.sh test_expect_success setup ' cat > bad1.patch < bad2.patch <err && test_i18ngrep "inconsistent new filename" err && test_must_fail git apply bad2.patch 2>err && test_i18ngrep "inconsistent old filename" err ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git apply filename consistency check">)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tcat > bad1.patch < <"diff --git a/f b/f\n"> <"new file mode 100644\n"> <"index 0000000..d00491f\n"> <"--- /dev/null\n"> <"+++ b/f-blah\n"> <"@@ -0,0 +1 @@\n"> <"+1\n"> <"EOF\n"> <"\tcat > bad2.patch < <"diff --git a/f b/f\n"> <"deleted file mode 100644\n"> <"index d00491f..0000000\n"> <"--- b/f-blah\n"> <"+++ /dev/null\n"> <"@@ -1 +0,0 @@\n"> <"-1\n"> <"EOF\n"> ) } ) (C {(test_expect_success)} {(SQ <"apply diff with inconsistent filenames in headers">)} { (SQ <"\n"> <"\ttest_must_fail git apply bad1.patch 2>err &&\n"> <"\ttest_i18ngrep \"inconsistent new filename\" err &&\n"> <"\ttest_must_fail git apply bad2.patch 2>err &&\n"> <"\ttest_i18ngrep \"inconsistent old filename\" err\n"> ) } ) (C {(test_done)}) ] )