File: make-patches

package info (click to toggle)
git 1%3A2.1.4-2.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 28,832 kB
  • sloc: ansic: 154,058; sh: 131,926; perl: 28,828; tcl: 21,269; python: 5,337; makefile: 3,509; lisp: 1,786; php: 120; asm: 98; csh: 45
file content (45 lines) | stat: -rwxr-xr-x 965 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh

do_filename() {
	desc=$1
	postimage=$2

	rm -fr file-creation &&
	git init file-creation &&
	(
		cd file-creation &&
		git commit --allow-empty -m init &&
		echo postimage >"$postimage" &&
		git add -N "$postimage" &&
		git diff HEAD >"../git-$desc.diff"
	) &&

	rm -fr trad-modification &&
	mkdir trad-modification &&
	(
		cd trad-modification &&
		echo preimage >"$postimage.orig" &&
		echo postimage >"$postimage" &&
		! diff -u "$postimage.orig" "$postimage" >"../diff-$desc.diff"
	) &&

	rm -fr trad-creation &&
	mkdir trad-creation &&
	(
		cd trad-creation &&
		mkdir a b &&
		echo postimage >"b/$postimage" &&
		! diff -pruN a b >"../add-$desc.diff"
	)
}

do_filename plain postimage.txt &&
do_filename 'with spaces' 'post image.txt' &&
do_filename 'with tab' 'post	image.txt' &&
do_filename 'with backslash' 'post\image.txt' &&
do_filename 'with quote' '"postimage".txt' &&
expand add-plain.diff >damaged.diff ||
{
	echo >&2 Failed. &&
	exit 1
}