summaryrefslogtreecommitdiff
path: root/test/gitget-test.sh
blob: a5e9f2c877997af102a68e4ade899c66dca45e0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/env roundup

describe gitget
. ./test-common.sh

it_displays_help() {
	LC_ALL=C gitget -h >$tmpdir/stdout 2>$tmpdir/stderr

	[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
	empty $tmpdir/stderr
}

it_fails_with_0_args() {
	gitget >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?

	[[ $stat != 0 ]]
	empty $tmpdir/stdout
	not empty $tmpdir/stderr
}

it_forces_url_for_bare() {
	mkdir "$tmpdir/src"
	cd "$tmpdir/src"
	git init .
	git config --local user.email 'libretools-test@localhost'
	git config --local user.name 'Test Suite'
	echo a > a
	git add .
	git commit -m 'initial commit'
	cd ..
	gitget bare src dst.git
	cd dst.git
	[[ "$(git config --get remote.origin.url)" == "$tmpdir/src" ]]
	cd ..
	gitget bare "file://$PWD/src" dst.git || r=$?
	[[ $r != 0 ]]
	gitget -f bare "file://$PWD/src" dst.git
	cd dst.git
	[[ "$(git config --get remote.origin.url)" == "file://$tmpdir/src" ]]
}