summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-04-19 17:53:19 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-04-19 18:25:12 -0400
commit243b4c911e10060ab11c1d759d4100c92cdda9d9 (patch)
treea7a0e13012b63d03da83dc1df0e57cceb1fc41d2 /test
parentd792dad1b0636234894f704e9222ddebe84f336f (diff)
gitget: correctly handle the -f[orce] flag on bare repositories
Diffstat (limited to 'test')
-rw-r--r--test/gitget-test.sh38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/gitget-test.sh b/test/gitget-test.sh
new file mode 100644
index 0000000..d14ce16
--- /dev/null
+++ b/test/gitget-test.sh
@@ -0,0 +1,38 @@
+#!/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 .
+ 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" ]]
+}