From: Johannes Sixt <j.sixt@viscovery.net>
To: "SZEDER Gábor" <szeder@ira.uka.de>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 02/19] tests: add tests for the bash prompt functions in the completion script
Date: Wed, 09 May 2012 10:07:03 +0200 [thread overview]
Message-ID: <4FAA25A7.4020300@viscovery.net> (raw)
In-Reply-To: <1336524290-30023-3-git-send-email-szeder@ira.uka.de>
Am 5/9/2012 2:44, schrieb SZEDER Gábor:
> The tests cover the discovery of the '.git' directory in the
> __gitdir() function in different scenarios, and the prompt itself,
> i.e. branch name, detached heads, operations (rebase, merge,
> cherry-pick, bisect), and status indicators (dirty, stash, untracked
> files; but not the upstream status).
The following patch contains fixups are needed to pass the tests at
this point plus a few more changes.
--- >8 ---
From: Johannes Sixt <j6t@kdbg.org>
Subject: [PATCH] fixup! tests: add tests for the bash prompt functions in the
completion script
- $TRASH_DIRECTORY is /c/dir style path, but git produces c:/dir style
paths. Use $(pwd), which is short for $(pwd -W) that produces the
latter, to assemble expected test data and paths read by git.
- As long as GIT_DIR is only exported for use by git and not used by
the completion functions, the move to $(pwd) is only cosmetic and
for consistency.
- Insert a #!/bin/sh in the shell script to ensure the test will pass
should git-rebase ever be ported to C.
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
t/t9903-bash-prompt.sh | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index a6c9ce9..3880c56 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -32,9 +32,9 @@ test_expect_success 'setup for prompt tests' '
'
test_expect_success 'gitdir - from command line (through $__git_dir)' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
(
- __git_dir="$TRASH_DIRECTORY/otherrepo/.git" &&
+ __git_dir="$(pwd)/otherrepo/.git" &&
__gitdir > "$actual"
) &&
test_cmp expected "$actual"
@@ -59,7 +59,7 @@ test_expect_success 'gitdir - .git directory in cwd' '
'
test_expect_success 'gitdir - .git directory in parent' '
- echo "$TRASH_DIRECTORY/.git" > expected &&
+ echo "$(pwd)/.git" > expected &&
(
cd subdir/subsubdir &&
__gitdir > "$actual"
@@ -77,7 +77,7 @@ test_expect_success 'gitdir - cwd is a .git directory' '
'
test_expect_success 'gitdir - parent is a .git directory' '
- echo "$TRASH_DIRECTORY/.git" > expected &&
+ echo "$(pwd)/.git" > expected &&
(
cd .git/refs/heads &&
__gitdir > "$actual"
@@ -86,9 +86,9 @@ test_expect_success 'gitdir - parent is a .git directory' '
'
test_expect_failure 'gitdir - $GIT_DIR set while .git directory in cwd' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
(
- GIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&
+ GIT_DIR="$(pwd)/otherrepo/.git" &&
export GIT_DIR &&
__gitdir > "$actual"
) &&
@@ -96,9 +96,9 @@ test_expect_failure 'gitdir - $GIT_DIR set while .git directory in cwd' '
'
test_expect_success 'gitdir - $GIT_DIR set while .git directory in parent' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
(
- GIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&
+ GIT_DIR="$(pwd)/otherrepo/.git" &&
export GIT_DIR &&
cd subdir &&
__gitdir > "$actual"
@@ -107,8 +107,8 @@ test_expect_success 'gitdir - $GIT_DIR set while .git directory in parent' '
'
test_expect_success 'gitdir - gitfile in cwd' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
- echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
+ echo "gitdir: $(pwd)/otherrepo/.git" > subdir/.git &&
test_when_finished "rm -f subdir/.git" &&
(
cd subdir &&
@@ -118,8 +118,8 @@ test_expect_success 'gitdir - gitfile in cwd' '
'
test_expect_success 'gitdir - gitfile in parent' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
- echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" > subdir/.git &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
+ echo "gitdir: $(pwd)/otherrepo/.git" > subdir/.git &&
test_when_finished "rm -f subdir/.git" &&
(
cd subdir/subsubdir &&
@@ -129,7 +129,7 @@ test_expect_success 'gitdir - gitfile in parent' '
'
test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '
- echo "$TRASH_DIRECTORY/otherrepo/.git" > expected &&
+ echo "$(pwd)/otherrepo/.git" > expected &&
mkdir otherrepo/dir &&
test_when_finished "rm -rf otherrepo/dir" &&
ln -s otherrepo/dir link &&
@@ -238,11 +238,12 @@ test_expect_success 'prompt - interactive rebase' '
printf " (b1|REBASE-i)" > expected
echo "#!$SHELL_PATH" >fake_editor.sh &&
cat >>fake_editor.sh <<\EOF &&
+#!/bin/sh
echo "edit $(git log -1 --format="%h")" > "$1"
EOF
test_when_finished "rm -f fake_editor.sh" &&
chmod a+x fake_editor.sh &&
- test_set_editor "$TRASH_DIRECTORY/fake_editor.sh" &&
+ test_set_editor "$(pwd)/fake_editor.sh" &&
git checkout b1 &&
test_when_finished "git checkout master" &&
git rebase -i HEAD^ &&
--
1.7.10.1.1689.gacdfbde
next prev parent reply other threads:[~2012-05-09 8:07 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 0:44 [PATCH 00/19] Bash prompt speedup SZEDER Gábor
2012-05-09 0:44 ` [PATCH 01/19] tests: move code to run tests under bash into a helper library SZEDER Gábor
2012-05-09 0:44 ` [PATCH 02/19] tests: add tests for the bash prompt functions in the completion script SZEDER Gábor
2012-05-09 8:07 ` Johannes Sixt [this message]
2012-05-09 18:08 ` Junio C Hamano
2012-05-10 6:09 ` Johannes Sixt
2012-05-09 18:36 ` Junio C Hamano
2012-05-09 20:33 ` SZEDER Gábor
2012-05-09 0:44 ` [PATCH 03/19] completion: use __gitdir() in _git_log() SZEDER Gábor
2012-05-09 18:41 ` Junio C Hamano
2012-05-09 19:01 ` SZEDER Gábor
2012-05-09 0:44 ` [PATCH 04/19] completion: respect $GIT_DIR SZEDER Gábor
2012-05-09 8:09 ` Johannes Sixt
2012-05-09 18:54 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 05/19] bash prompt: don't show the prompt when .git/HEAD is unreadable SZEDER Gábor
2012-05-09 19:32 ` Junio C Hamano
2012-05-09 19:45 ` SZEDER Gábor
2012-05-09 0:44 ` [PATCH 06/19] bash prompt: return early from __git_ps1() when not in a git repository SZEDER Gábor
2012-05-09 0:44 ` [PATCH 07/19] completion: make __gitdir() store repository path in $__git_dir SZEDER Gábor
2012-05-09 19:36 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 08/19] completion: use $__git_dir instead of $(__gitdir) SZEDER Gábor
2012-05-09 19:43 ` Junio C Hamano
2012-05-09 20:22 ` SZEDER Gábor
2012-05-09 20:56 ` Junio C Hamano
2012-05-09 21:36 ` SZEDER Gábor
2012-05-09 0:44 ` [RFC PATCH 09/19] completion: platform-specific helper function to get physical path SZEDER Gábor
2012-05-09 7:37 ` Johannes Sixt
2012-05-09 0:44 ` [PATCH 10/19] completion: use bash builtins to search for repository SZEDER Gábor
2012-05-09 19:52 ` Junio C Hamano
2012-05-09 22:34 ` SZEDER Gábor
2012-05-09 22:59 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 11/19] bash prompt: use bash builtins to find out current branch SZEDER Gábor
2012-05-09 20:02 ` Junio C Hamano
2012-05-09 21:11 ` SZEDER Gábor
2012-05-09 21:25 ` Junio C Hamano
2012-05-09 21:45 ` SZEDER Gábor
2012-05-09 21:50 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 12/19] bash prompt: use bash builtins to check whether inside git dir SZEDER Gábor
2012-05-09 8:07 ` Johannes Sixt
2012-05-09 20:06 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 13/19] bash prompt: check whether inside the worktree only when necessary SZEDER Gábor
2012-05-09 0:44 ` [PATCH 14/19] bash prompt: use bash builtins to find out current branch during rebase SZEDER Gábor
2012-05-09 0:44 ` [PATCH 15/19] bash prompt: use bash builtins to get detached HEAD abbrev. object name SZEDER Gábor
2012-05-09 0:44 ` [PATCH 16/19] bash prompt: display stash and upstream state even inside the repository SZEDER Gábor
2012-05-09 0:44 ` [PATCH 17/19] bash prompt: use bash builtins to check stash state SZEDER Gábor
2012-05-09 0:44 ` [RFC PATCH 18/19] bash prompt: avoid command substitution when checking for untracked files SZEDER Gábor
2012-05-09 20:32 ` Junio C Hamano
2012-05-09 0:44 ` [PATCH 19/19] bash prompt: alternative git prompt without command substitution SZEDER Gábor
2012-05-09 19:38 ` Andrew Sayers
2012-05-09 22:08 ` SZEDER Gábor
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=4FAA25A7.4020300@viscovery.net \
--to=j.sixt@viscovery.net \
--cc=git@vger.kernel.org \
--cc=szeder@ira.uka.de \
/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).