From: Lars Hjemli <hjemli@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
"Shawn O. Pearce" <spearce@spearce.org>,
git@vger.kernel.org
Subject: [PATCH 3/4 v2] Add tests for .git file
Date: Wed, 6 Feb 2008 08:56:23 +0100 [thread overview]
Message-ID: <1202284583-24478-1-git-send-email-hjemli@gmail.com> (raw)
In-Reply-To: <7vfxw66a0s.fsf@gitster.siamese.dyndns.org>
Verify that the basic plumbing works when .git is a file pointing at
the real git directory.
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
---
This updated patch replaces cut with sed and tries to do proper quoting.
t/t0002-gitfile.sh | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 74 insertions(+), 0 deletions(-)
create mode 100755 t/t0002-gitfile.sh
diff --git a/t/t0002-gitfile.sh b/t/t0002-gitfile.sh
new file mode 100755
index 0000000..7f8ee2f
--- /dev/null
+++ b/t/t0002-gitfile.sh
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+test_description='.git file
+
+Verify that plumbing commands work when .git is a file
+'
+. ./test-lib.sh
+
+objpath() {
+ echo $1 | sed -re 's|(..)(.+)|\1/\2|'
+}
+
+objck() {
+ p=$(objpath $1)
+ if test ! -f "$REAL/objects/$p"
+ then
+ echo "Object not found: $REAL/objects/$p"
+ false
+ fi
+}
+
+test_expect_success 'setup' '
+ REAL="$(pwd)/.real" &&
+ mv .git "$REAL" &&
+ echo "gitdir: $REAL" >.git
+'
+
+test_expect_success 'check rev-parse --git-dir' '
+ test "$REAL" = "$(git rev-parse --git-dir)"
+'
+
+test_expect_success 'check hash-object' '
+ echo "foo" >bar &&
+ SHA=$(cat bar | git hash-object -w --stdin) &&
+ objck $SHA
+'
+
+test_expect_success 'check cat-file' '
+ git cat-file blob $SHA >actual &&
+ diff -u bar actual
+'
+
+test_expect_success 'check update-index' '
+ if test -f "$REAL/index"
+ then
+ echo "Hmm, $REAL/index exists?"
+ false
+ fi &&
+ rm -f "$REAL/objects/$(objpath $SHA)" &&
+ git update-index --add bar &&
+ if ! test -f "$REAL/index"
+ then
+ echo "$REAL/index not found"
+ false
+ fi &&
+ objck $SHA
+'
+
+test_expect_success 'check write-tree' '
+ SHA=$(git write-tree) &&
+ objck $SHA
+'
+
+test_expect_success 'check commit-tree' '
+ SHA=$(echo "commit bar" | git commit-tree $SHA) &&
+ objck $SHA
+'
+
+test_expect_success 'check rev-list' '
+ echo $SHA >"$REAL/HEAD" &&
+ test "$SHA" = "$(git rev-list HEAD)"
+'
+
+test_done
--
1.5.4.6.g6627
next prev parent reply other threads:[~2008-02-06 7:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-04 20:59 [PATCH 0/4] Introduce the .git-file Lars Hjemli
2008-02-04 20:59 ` [PATCH 1/4] Add platform-independent .git "symlink" Lars Hjemli
2008-02-04 20:59 ` [PATCH 2/4] Document the .git-file Lars Hjemli
2008-02-04 20:59 ` [PATCH 3/4] Add tests for .git file Lars Hjemli
2008-02-04 20:59 ` [PATCH 4/4] git-submodule: prepare for the .git-file Lars Hjemli
2008-02-04 22:23 ` Mike Hommey
2008-02-04 22:44 ` Lars Hjemli
2008-02-06 3:25 ` [PATCH 3/4] Add tests for .git file Junio C Hamano
2008-02-06 7:56 ` Lars Hjemli [this message]
2008-02-06 8:40 ` [PATCH 3/4 v2] " Junio C Hamano
2008-02-06 9:30 ` Lars Hjemli
2008-02-06 10:13 ` Junio C Hamano
2008-02-06 10:35 ` Lars Hjemli
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=1202284583-24478-1-git-send-email-hjemli@gmail.com \
--to=hjemli@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=spearce@spearce.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.