Add range comparison support to stg-mdiff.
[stgit] / t / t1000-branch-create.sh
CommitLineData
fe847176
YD
1#!/bin/sh
2#
3# Copyright (c) 2006 Yann Dirson
4#
5
6test_description='Branch operations.
7
8Exercises the "stg branch" commands.
9'
10
11. ./test-lib.sh
12
13stg init
14
e152aab3
KH
15test_expect_success \
16 'Create a spurious refs/patches/ entry' '
17 find .git -name foo | xargs rm -rf &&
18 touch .git/refs/patches/foo
19'
20
fe847176 21test_expect_failure \
e152aab3
KH
22 'Try to create an stgit branch with a spurious refs/patches/ entry' '
23 stg branch -c foo
24'
25
26test_expect_success \
27 'Check that no part of the branch was created' '
28 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/patches/foo" &&
29 ( grep foo .git/HEAD; test $? = 1 )
fe847176
YD
30'
31
32test_expect_success \
e152aab3
KH
33 'Create a spurious patches/ entry' '
34 find .git -name foo | xargs rm -rf &&
35 touch .git/patches/foo
fe847176
YD
36'
37
38test_expect_failure \
e152aab3
KH
39 'Try to create an stgit branch with a spurious patches/ entry' '
40 stg branch -c foo
fe847176
YD
41'
42
43test_expect_success \
e152aab3
KH
44 'Check that no part of the branch was created' '
45 test "`find .git -name foo | tee /dev/stderr`" = ".git/patches/foo" &&
46 ( grep foo .git/HEAD; test $? = 1 )
47'
48
49test_expect_success \
50 'Create a git branch' '
51 find .git -name foo | xargs rm -rf &&
52 cp .git/refs/heads/master .git/refs/heads/foo
fe847176
YD
53'
54
55test_expect_failure \
e152aab3
KH
56 'Try to create an stgit branch with an existing git branch by that name' '
57 stg branch -c foo
fe847176
YD
58'
59
60test_expect_success \
e152aab3
KH
61 'Check that no part of the branch was created' '
62 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
63 ( grep foo .git/HEAD; test $? = 1 )
fe847176
YD
64'
65
e152aab3
KH
66test_expect_success \
67 'Create an invalid refs/heads/ entry' '
68 find .git -name foo | xargs rm -rf &&
69 touch .git/refs/heads/foo
70'
fe847176
YD
71
72test_expect_failure \
e152aab3
KH
73 'Try to create an stgit branch with an invalid refs/heads/ entry' '
74 stg branch -c foo
fe847176
YD
75'
76
77test_expect_success \
e152aab3
KH
78 'Check that no part of the branch was created' '
79 test "`find .git -name foo | tee /dev/stderr`" = ".git/refs/heads/foo" &&
80 ( grep foo .git/HEAD; test $? = 1 )
fe847176
YD
81'
82
83test_done