[PATCH] guilt: improve patch header handling
[guilt/mob.git] / regression / t-025.sh
blob426a3cf67d20b2dde3b6099cffea2b3862ac3dcc
1 #!/bin/bash
3 # Test the new code
6 source $REG_DIR/scaffold
8 cmd setup_repo
10 function fixup_time_info
12 touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
15 for pname in file dir/file dir/subdir/file ; do
16 cmd guilt-new "$pname"
17 cmd guilt-pop
18 fixup_time_info "$pname"
19 cmd guilt-push
21 cmd list_files
22 done
24 cmd guilt-push --all
26 cmd guilt-new append
27 cmd guilt-pop
28 fixup_time_info append
29 cmd guilt-push
31 cmd list_files
33 cmd guilt-pop --all
35 cmd guilt-new prepend
36 cmd guilt-pop
37 fixup_time_info prepend
38 cmd guilt-push
40 cmd list_files
42 shouldfail guilt-new "white space"
44 cmd list_files
46 for pname in prepend mode /abc ./blah ../blah abc/./blah abc/../blah abc/. abc/.. abc/ ; do
47 shouldfail guilt-new "$pname" 2>&1
49 cmd list_files
50 done
53 # Test the -f option
56 # modify the working dir file
57 cmd echo qwerty >> def
58 cmd git diff
60 # try to make a new patch, without -f
61 shouldfail guilt new uncommitted-changes
62 cmd git diff
63 cmd list_files
65 # give new -f, to force things
66 cmd guilt new -f uncommitted-changes
67 cmd git diff
68 cmd guilt pop
69 fixup_time_info uncommitted-changes
70 cmd guilt push
71 cmd list_files
73 # modify the working dir file (again)
74 cmd echo dvorak >> def
75 cmd git update-index def
76 cmd git diff
77 cmd git diff HEAD
79 # try to make a new patch, without -f
80 shouldfail guilt new uncommitted-changes2
81 cmd git diff
82 cmd git diff HEAD
83 cmd list_files
85 # give new -f, to force things
86 cmd guilt new -f uncommitted-changes2
87 cmd git diff
88 cmd git diff HEAD
89 cmd guilt pop
90 fixup_time_info uncommitted-changes2
91 cmd guilt push
92 cmd list_files