chiark / gitweb /
stgit.el: Add "d" for a few diff commands, similar to git.el
[stgit] / t / t2500-clean.sh
CommitLineData
ec6084cb
KH
1#!/bin/sh
2
3test_description='Run "stg clean"'
4
5. ./test-lib.sh
6
7test_expect_success 'Initialize StGit stack' '
8 stg init &&
9 stg new e0 -m e0 &&
10 stg new p0 -m p0 &&
11 echo foo > foo.txt &&
12 git add foo.txt &&
13 stg refresh &&
14 stg new e1 -m e1 &&
15 stg new e2 -m e2 &&
16 stg pop
17'
18
19test_expect_success 'Clean empty patches' '
f9d9a062
CM
20 [ "$(echo $(stg series --applied --noprefix))" = "e0 p0 e1" ] &&
21 [ "$(echo $(stg series --unapplied --noprefix))" = "e2" ] &&
ec6084cb 22 stg clean &&
f9d9a062
CM
23 [ "$(echo $(stg series --applied --noprefix))" = "p0" ] &&
24 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
ec6084cb
KH
25'
26
52e96a35
PR
27test_expect_success 'Create a conflict' '
28 stg new p1 -m p1 &&
29 echo bar > foo.txt &&
30 stg refresh &&
31 stg pop &&
32 stg new p2 -m p2
33 echo quux > foo.txt &&
34 stg refresh &&
f979802d 35 conflict stg push
52e96a35
PR
36'
37
a639e7bb 38test_expect_success 'Make sure conflicting patches are preserved' '
52e96a35 39 stg clean &&
f9d9a062
CM
40 [ "$(echo $(stg series --applied --noprefix))" = "p0 p2 p1" ] &&
41 [ "$(echo $(stg series --unapplied --noprefix))" = "" ]
52e96a35
PR
42'
43
ec6084cb 44test_done