git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthias Lederhofer <matled@gmx.net>
To: git@vger.kernel.org
Subject: [PATCH] test git-rev-parse
Date: Fri, 16 Mar 2007 23:33:57 +0100	[thread overview]
Message-ID: <20070316223357.GA16255@moooo.ath.cx> (raw)

this tests --is-bare-repository, --is-inside-git-dir, --show-cdup and
--show-prefix

Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
The number of the test has to be changed.
---
 t/t9999-rev-parse.sh |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 57 insertions(+), 0 deletions(-)
 create mode 100755 t/t9999-rev-parse.sh

diff --git a/t/t9999-rev-parse.sh b/t/t9999-rev-parse.sh
new file mode 100755
index 0000000..c385660
--- /dev/null
+++ b/t/t9999-rev-parse.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+test_description='test git rev-parse'
+. ./test-lib.sh
+
+test_expect_success 'toplevel: is-bare-repository' \
+	'test "false" = "$(git rev-parse --is-bare-repository)"'
+test_expect_success 'toplevel: is-inside-git-dir' \
+	'test "false" = "$(git rev-parse --is-inside-git-dir)"'
+test_expect_success 'toplevel: show-cdup' \
+	'test "" = "$(git rev-parse --show-cdup)"'
+test_expect_success 'toplevel: show-prefix' \
+	'test "" = "$(git rev-parse --show-prefix)"'
+
+cd .git/objects || exit 1
+test_expect_success 'in-git-dir: is-bare-repository' \
+	'test "false" = "$(git rev-parse --is-bare-repository)"'
+test_expect_success 'in-git-dir: is-inside-git-dir' \
+	'test "true" = "$(git rev-parse --is-inside-git-dir)"'
+test_expect_success 'in-git-dir: show-cdup' \
+	'test "../../" = "$(git rev-parse --show-cdup)"'
+test_expect_success 'in-git-dir: show-prefix' \
+	'test ".git/objects/" = "$(git rev-parse --show-prefix)"'
+cd ../.. || exit 1
+
+mkdir sub || exit 1
+cd sub || exit 1
+test_expect_success 'subdirectory: is-bare-repository' \
+	'test "false" = "$(git rev-parse --is-bare-repository)"'
+test_expect_success 'subdirectory: is-inside-git-dir' \
+	'test "false" = "$(git rev-parse --is-inside-git-dir)"'
+test_expect_success 'subdirectory: show-cdup' \
+	'test "../" = "$(git rev-parse --show-cdup)"'
+test_expect_success 'subdirectory: show-prefix' \
+	'test "sub/" = "$(git rev-parse --show-prefix)"'
+cd .. || exit 1
+
+test_expect_success 'core.bare = true: is-bare-repository' \
+	'git config core.bare true &&
+	test "true" = "$(git rev-parse --is-bare-repository)"'
+test_expect_success 'unset core.bare: is-bare-repository' \
+	'git config --unset core.bare &&
+	test "false" = "$(git rev-parse --is-bare-repository)"'
+
+mv .git foo.git || exit 1
+export GIT_DIR=foo.git
+export GIT_CONFIG=foo.git/config
+test_expect_success 'GIT_DIR=foo.git: is-bare-repository' \
+	'test "true" = "$(git rev-parse --is-bare-repository)"'
+test_expect_success 'GIT_DIR=foo.git, core.bare = true: is-bare-repository' \
+	'git --git-dir foo.git config core.bare true &&
+	test "true" = "$(git --git-dir foo.git rev-parse --is-bare-repository)"'
+test_expect_success 'GIT_DIR=foo.git, core.bare = false: is-bare-repository' \
+	'git config core.bare false &&
+	test "false" = "$(git rev-parse --is-bare-repository)"'
+
+test_done
-- 
1.5.0.3.972.g70823

                 reply	other threads:[~2007-03-16 22:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070316223357.GA16255@moooo.ath.cx \
    --to=matled@gmx.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).