Debian Codegraph @

tests/inputs/issues/386/make_386_repo.sh

raw
1 #!/bin/sh
2 git init issue386
3 cd issue386/
4
5 CCODE=$(cat <<'EOC1'
6 /*
7 * Compile:
8 * gcc hello.c -o hello
9 *
10 * Run:
11 * hello
12 */
13 main (int argc, char *argv[])
14 {
15 printf("Hello.\n");
16 }
17 EOC1
18 )
19 echo "${CCODE}" > hello1.c
20
21 CCODE=$(cat <<'EOC2'
22 // Compile:
23 // gcc hello.c -o hello
24 // hello
25 main (int argc, char *argv[])
26 {
27 printf("extra line.\n");
28 printf("Hello.\n");
29 }
30 EOC2
31 )
32 echo "${CCODE}" > hello2.c
33
34 PCODE=$(cat <<'EOP'
35 #!/usr/bin/env python
36 import sys
37 import numpy as np
38 # nothing useful
39 print(np.random.rand(3,4))
40 EOP
41 )
42 echo "${PCODE}" > stuff.py
43
44 git add hello1.c hello2.c
45 git commit --allow-empty-message -m ''
46 git add stuff.py
47 git commit --allow-empty-message -m ''
48 git rm hello1.c
49 git commit --allow-empty-message -m ''
50 git rm stuff.py hello2.c
51 git commit --allow-empty-message -m ''
52
53 HASH4=`git log --oneline -n 1 --skip 0 | perl -p -e 's/\s+$/\n/g'`
54 HASH3=`git log --oneline -n 1 --skip 1 | perl -p -e 's/\s+$/\n/g'`
55 HASH2=`git log --oneline -n 1 --skip 2 | perl -p -e 's/\s+$/\n/g'`
56 HASH1=`git log --oneline -n 1 --skip 3 | perl -p -e 's/\s+$/\n/g'`
57
58 echo "HASH4=$HASH4"
59 echo "HASH3=$HASH3"
60 echo "HASH2=$HASH2"
61 echo "HASH1=$HASH1"
62
63 # hello1.c hello2.c
64 git archive -o ${HASH1}.tar ${HASH1}
65
66 # hello1.c hello2.c stuff.py
67 git archive -o ${HASH2}.tar ${HASH2}
68
69 # hello2.c stuff.py
70 git archive -o ${HASH3}.tar ${HASH3}
71
72 # empty
73 git archive -o ${HASH4}.tar ${HASH4}
74
75 cloc --git --diff ${HASH1} ${HASH2}
76 cloc --diff ${HASH1}.tar ${HASH2}.tar
77 echo '++++++++++++++++++++++++++++++++++++++++++'
78 cloc --git --diff ${HASH2} ${HASH3}
79 cloc --diff ${HASH2}.tar ${HASH3}.tar
80 echo '++++++++++++++++++++++++++++++++++++++++++'
81 cloc --git --diff ${HASH3} ${HASH4}
82 cloc --diff ${HASH3}.tar ${HASH4}.tar
83 echo '++++++++++++++++++++++++++++++++++++++++++'
84 cloc --git --diff ${HASH4} ${HASH1}
85 cloc --diff ${HASH4}.tar ${HASH1}.tar
86 echo '++++++++++++++++++++++++++++++++++++++++++'
87 cloc --git --diff ${HASH1} ${HASH4}
88 cloc --diff ${HASH1}.tar ${HASH4}.tar