t / t4110-apply-scan.shon commit git wrapper: more careful argument stuffing (10b15b8)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4# Copyright (c) 2005 Robert Fitzsimons
   5#
   6
   7test_description='git-apply test for patches which require scanning forwards and backwards.
   8
   9'
  10. ./test-lib.sh
  11
  12# setup
  13
  14cat > patch1.patch <<\EOF
  15diff --git a/new.txt b/new.txt
  16new file mode 100644
  17--- /dev/null
  18+++ b/new.txt
  19@@ -0,0 +1,12 @@
  20+a1
  21+a11
  22+a111
  23+a1111
  24+b1
  25+b11
  26+b111
  27+b1111
  28+c1
  29+c11
  30+c111
  31+c1111
  32EOF
  33cat > patch2.patch <<\EOF
  34diff --git a/new.txt b/new.txt
  35--- a/new.txt
  36+++ b/new.txt
  37@@ -1,7 +1,3 @@
  38-a1
  39-a11
  40-a111
  41-a1111
  42 b1
  43 b11
  44 b111
  45EOF
  46cat > patch3.patch <<\EOF
  47diff --git a/new.txt b/new.txt
  48--- a/new.txt
  49+++ b/new.txt
  50@@ -6,6 +6,10 @@
  51 b11
  52 b111
  53 b1111
  54+b2
  55+b22
  56+b222
  57+b2222
  58 c1
  59 c11
  60 c111
  61EOF
  62cat > patch4.patch <<\EOF
  63diff --git a/new.txt b/new.txt
  64--- a/new.txt
  65+++ b/new.txt
  66@@ -1,3 +1,7 @@
  67+a1
  68+a11
  69+a111
  70+a1111
  71 b1
  72 b11
  73 b111
  74EOF
  75cat > patch5.patch <<\EOF
  76diff --git a/new.txt b/new.txt
  77--- a/new.txt
  78+++ b/new.txt
  79@@ -10,3 +10,7 @@
  80 c11
  81 c111
  82 c1111
  83+c2
  84+c22
  85+c222
  86+c2222
  87EOF
  88
  89test_expect_success "S = git-apply scan" \
  90    'git-apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch'
  91mv new.txt apply.txt
  92
  93test_expect_success "S = patch scan" \
  94    'cat patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch | patch'
  95mv new.txt patch.txt
  96
  97test_expect_success "S = cmp" \
  98    'cmp apply.txt patch.txt'
  99
 100test_done
 101