From: Lars Hjemli <hjemli@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: [PATCH] Add tests for .git file
Date: Sat, 2 Feb 2008 16:02:51 +0100 [thread overview]
Message-ID: <1201964571-4801-1-git-send-email-hjemli@gmail.com> (raw)
In-Reply-To: <1201948579-11807-1-git-send-email-hjemli@gmail.com>
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>
---
t/t0002-gitfile.sh | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 71 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..55276c6
--- /dev/null
+++ b/t/t0002-gitfile.sh
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+test_description='.git file
+
+Verify that plumbing commands work when .git is a file
+'
+. ./test-lib.sh
+
+chkfile() {
+ D=$(echo $1 | cut -b 1-2) &&
+ F=$(echo $1 | cut -b 3-40) &&
+ if test ! -f $REAL/objects/$D/$F
+ then
+ echo "Object not found: $REAL/objects/$D/$F"
+ 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) &&
+ chkfile $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 -rf $REAL/objects/* &&
+ git update-index --add bar &&
+ if ! test -f $REAL/index
+ then
+ echo "$REAL/index not found"
+ false
+ fi &&
+ chkfile $SHA
+'
+
+test_expect_success 'check write-tree' '
+ SHA=$(git write-tree) &&
+ chkfile $SHA
+'
+
+test_expect_success 'check commit-tree' '
+ SHA=$(echo "commit bar" | git commit-tree $SHA) &&
+ chkfile $SHA
+'
+
+test_expect_success 'check rev-list' '
+ echo $SHA >$REAL/HEAD &&
+ test "$SHA" = "$(git rev-list HEAD)"
+'
+
+test_done
--
1.5.4.GIT-dirty
next prev parent reply other threads:[~2008-02-02 15:05 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-02 10:36 [PATCH] Add platform-independent .git "symlink" Lars Hjemli
2008-02-02 15:02 ` Lars Hjemli [this message]
2008-02-02 15:56 ` Johannes Schindelin
2008-02-02 17:59 ` Lars Hjemli
2008-02-02 18:09 ` Lars Hjemli
2008-02-02 18:19 ` Johannes Schindelin
2008-02-02 18:34 ` Johannes Schindelin
2008-02-04 1:57 ` Shawn O. Pearce
2008-02-04 3:05 ` Junio C Hamano
2008-02-04 14:34 ` Johannes Schindelin
2008-02-04 21:17 ` Brandon Casey
2008-02-04 21:31 ` Johannes Schindelin
2008-02-04 22:08 ` Brandon Casey
2008-02-04 22:19 ` Johannes Schindelin
2008-02-04 22:44 ` Brandon Casey
2008-02-04 22:56 ` Brandon Casey
2008-02-05 0:51 ` Johannes Schindelin
2008-02-05 0:49 ` Johannes Schindelin
2008-02-05 2:42 ` Brandon Casey
2008-02-05 12:57 ` Johannes Schindelin
2008-02-02 18:47 ` Lars Hjemli
2008-02-03 1:55 ` Johannes Schindelin
2008-02-04 0:07 ` Junio C Hamano
2008-02-04 0:24 ` Johannes Schindelin
2008-02-04 1:35 ` Shawn O. Pearce
2008-02-04 1:45 ` Junio C Hamano
2008-02-04 2:00 ` Shawn O. Pearce
2008-02-04 11:59 ` Lars Hjemli
2008-02-04 14:36 ` Johannes Schindelin
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=1201964571-4801-1-git-send-email-hjemli@gmail.com \
--to=hjemli@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/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).