all repos

mugit @ 7218955

🐮 git server that your cow will love

mugit/testscript/cli-repo-set-default.txtar (view raw)

Oleksandr Smirnov Oleksandr Smirnov
olexsmir@gmail.com
tests: join testscript file, 2 months ago
1
# set head: sets default branch
2
3
git init local
4
cp file.txt local/file.txt
5
git -C local add file.txt
6
git -C local commit -m 'init master'
7
8
git -C local switch -c develop
9
cp develop.txt local/develop.txt
10
git -C local add develop.txt
11
git -C local commit -m 'init develop'
12
13
14
mugit repo new heady
15
git -C local push file://$REPOS/heady.git master
16
git -C local push file://$REPOS/heady.git develop
17
18
19
exec cat $REPOS/heady.git/HEAD
20
stdout 'ref: refs/heads/master'
21
22
# change head
23
mugit repo set-default heady develop
24
stderr 'changed repo head repo=heady.git branch=develop' # fix output
25
26
exec cat $REPOS/heady.git/HEAD
27
stdout 'ref: refs/heads/develop'
28
29
# go back to master
30
mugit repo set-default heady.git master
31
stderr 'changed repo head repo=heady.git branch=master' # fix output
32
33
exec cat $REPOS/heady.git/HEAD
34
stdout 'ref: refs/heads/master'
35
36
# can't use non existent branch
37
! mugit repo set-default nonexistent main
38
stderr 'failed to open repo'
39
40
# no repo provided
41
! mugit repo set-default
42
stderr 'no name provided'
43
44
45
-- file.txt --
46
initial content
47
48
-- develop.txt --
49
develop content