Merge branch 'jk/pull-rebase-with-work-tree'
[git/mjg.git] / t / t4135 / make-patches
blobf5f45ddd099e34cef563882ed152932747802a1c
1 #!/bin/sh
3 do_filename() {
4 desc=$1
5 postimage=$2
7 rm -fr file-creation &&
8 git init file-creation &&
10 cd file-creation &&
11 git commit --allow-empty -m init &&
12 echo postimage >"$postimage" &&
13 git add -N "$postimage" &&
14 git diff HEAD >"../git-$desc.diff"
15 ) &&
17 rm -fr trad-modification &&
18 mkdir trad-modification &&
20 cd trad-modification &&
21 echo preimage >"$postimage.orig" &&
22 echo postimage >"$postimage" &&
23 ! diff -u "$postimage.orig" "$postimage" >"../diff-$desc.diff"
24 ) &&
26 rm -fr trad-creation &&
27 mkdir trad-creation &&
29 cd trad-creation &&
30 mkdir a b &&
31 echo postimage >"b/$postimage" &&
32 ! diff -pruN a b >"../add-$desc.diff"
36 do_filename plain postimage.txt &&
37 do_filename 'with spaces' 'post image.txt' &&
38 do_filename 'with tab' 'post image.txt' &&
39 do_filename 'with backslash' 'post\image.txt' &&
40 do_filename 'with quote' '"postimage".txt' &&
41 expand add-plain.diff >damaged.diff ||
43 echo >&2 Failed. &&
44 exit 1