tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (c) 2012 SZEDER Gábor
|
|
|
|
#
|
|
|
|
|
|
|
|
test_description='test git-specific bash prompt functions'
|
|
|
|
|
|
|
|
. ./lib-bash.sh
|
|
|
|
|
2012-05-23 04:46:40 +08:00
|
|
|
. "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
|
|
|
|
actual="$TRASH_DIRECTORY/actual"
|
|
|
|
|
|
|
|
test_expect_success 'setup for prompt tests' '
|
|
|
|
mkdir -p subdir/subsubdir &&
|
|
|
|
git init otherrepo &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 1 >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git add file &&
|
|
|
|
test_tick &&
|
|
|
|
git commit -m initial &&
|
|
|
|
git tag -a -m msg1 t1 &&
|
|
|
|
git checkout -b b1 &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 2 >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git commit -m "second b1" file &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 3 >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git commit -m "third b1" file &&
|
|
|
|
git tag -a -m msg2 t2 &&
|
|
|
|
git checkout -b b2 master &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 0 >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git commit -m "second b2" file &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 00 >file &&
|
2013-04-25 17:28:54 +08:00
|
|
|
git commit -m "another b2" file &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo 000 >file &&
|
2013-04-25 17:28:54 +08:00
|
|
|
git commit -m "yet another b2" file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout master
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - from command line (through $__git_dir)' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
__git_dir="$TRASH_DIRECTORY/otherrepo/.git" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - repo as argument' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "otherrepo/.git" >expected &&
|
|
|
|
__gitdir "otherrepo" >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - remote as argument' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "remote" >expected &&
|
|
|
|
__gitdir "remote" >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - .git directory in cwd' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo ".git" >expected &&
|
|
|
|
__gitdir >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - .git directory in parent' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$(pwd -P)/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
cd subdir/subsubdir &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - cwd is a .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "." >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
cd .git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - parent is a .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$(pwd -P)/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
cd .git/refs/heads &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
completion: respect $GIT_DIR
The __gitdir() helper function finds out the path of the git
repository by running 'git rev-parse --git-dir'. However, it has a
shortcut first to avoid the overhead of running a git command in a
subshell when the current directory is at the top of the work tree,
i.e. when it contains a '.git' subdirectory.
If the 'GIT_DIR' environment variable is set then it specifies the
path to the git repository, and the autodetection of the '.git'
directory is not necessary. However, $GIT_DIR is only taken into
acocunt by 'git rev-parse --git-dir', and the check for the '.git'
subdirectory is performed first, so it wins over the path given in
$GIT_DIR.
There are several completion (helper) functions that depend on
__gitdir(), and when the above case triggers the completion script
will do weird things, like offering refs, aliases, or stashes from a
different repository, or displaying wrong or broken prompt, etc.
So check first whether $GIT_DIR is set, and only proceed with checking
the '.git' directory in the current directory if it isn't. 'git
rev-parse' would also check whether the path in $GIT_DIR is a proper
'.git' directory, i.e. 'HEAD', 'refs/', and 'objects/' are present and
accessible, but we don't have to be that thorough for the bash prompt.
And we've lived with an equally permissive check for '.git' in the
current working directory for years anyway.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:35 +08:00
|
|
|
test_expect_success 'gitdir - $GIT_DIR set while .git directory in cwd' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&
|
|
|
|
export GIT_DIR &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - $GIT_DIR set while .git directory in parent' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$TRASH_DIRECTORY/otherrepo/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_DIR="$TRASH_DIRECTORY/otherrepo/.git" &&
|
|
|
|
export GIT_DIR &&
|
|
|
|
cd subdir &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
completion: respect $GIT_DIR
The __gitdir() helper function finds out the path of the git
repository by running 'git rev-parse --git-dir'. However, it has a
shortcut first to avoid the overhead of running a git command in a
subshell when the current directory is at the top of the work tree,
i.e. when it contains a '.git' subdirectory.
If the 'GIT_DIR' environment variable is set then it specifies the
path to the git repository, and the autodetection of the '.git'
directory is not necessary. However, $GIT_DIR is only taken into
acocunt by 'git rev-parse --git-dir', and the check for the '.git'
subdirectory is performed first, so it wins over the path given in
$GIT_DIR.
There are several completion (helper) functions that depend on
__gitdir(), and when the above case triggers the completion script
will do weird things, like offering refs, aliases, or stashes from a
different repository, or displaying wrong or broken prompt, etc.
So check first whether $GIT_DIR is set, and only proceed with checking
the '.git' directory in the current directory if it isn't. 'git
rev-parse' would also check whether the path in $GIT_DIR is a proper
'.git' directory, i.e. 'HEAD', 'refs/', and 'objects/' are present and
accessible, but we don't have to be that thorough for the bash prompt.
And we've lived with an equally permissive check for '.git' in the
current working directory for years anyway.
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:35 +08:00
|
|
|
test_expect_success 'gitdir - non-existing $GIT_DIR' '
|
|
|
|
(
|
|
|
|
GIT_DIR="$TRASH_DIRECTORY/non-existing" &&
|
|
|
|
export GIT_DIR &&
|
|
|
|
test_must_fail __gitdir
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_expect_success 'gitdir - gitfile in cwd' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$(pwd -P)/otherrepo/.git" >expected &&
|
|
|
|
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "rm -f subdir/.git" &&
|
|
|
|
(
|
|
|
|
cd subdir &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - gitfile in parent' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$(pwd -P)/otherrepo/.git" >expected &&
|
|
|
|
echo "gitdir: $TRASH_DIRECTORY/otherrepo/.git" >subdir/.git &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "rm -f subdir/.git" &&
|
|
|
|
(
|
|
|
|
cd subdir/subsubdir &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success SYMLINKS 'gitdir - resulting path avoids symlinks' '
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "$(pwd -P)/otherrepo/.git" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
mkdir otherrepo/dir &&
|
|
|
|
test_when_finished "rm -rf otherrepo/dir" &&
|
|
|
|
ln -s otherrepo/dir link &&
|
|
|
|
test_when_finished "rm -f link" &&
|
|
|
|
(
|
|
|
|
cd link &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__gitdir >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'gitdir - not a git repository' '
|
|
|
|
(
|
|
|
|
cd subdir/subsubdir &&
|
|
|
|
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY" &&
|
|
|
|
export GIT_CEILING_DIRECTORIES &&
|
|
|
|
test_must_fail __gitdir
|
|
|
|
)
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - branch name' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - detached head' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " ((%s...))" $(git log -1 --format="%h" b1^) >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b1^ &&
|
|
|
|
test_when_finished "git checkout master" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - describe detached head - contains' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " ((t2~1))" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b1^ &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_DESCRIBE_STYLE=contains &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - describe detached head - branch' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " ((b1~1))" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b1^ &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_DESCRIBE_STYLE=branch &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - describe detached head - describe' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " ((t1-1-g%s))" $(git log -1 --format="%h" b1^) >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b1^ &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_DESCRIBE_STYLE=describe &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - describe detached head - default' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " ((t2))" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout --detach b1 &&
|
|
|
|
test_when_finished "git checkout master" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - inside .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (GIT_DIR!)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
cd .git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - deep inside .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (GIT_DIR!)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
cd .git/refs/heads &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - inside bare repository' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (BARE:master)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git init --bare bare.git &&
|
|
|
|
test_when_finished "rm -rf bare.git" &&
|
|
|
|
(
|
|
|
|
cd bare.git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - interactive rebase' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (b1|REBASE-i 2/3)" >expected
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
echo "#!$SHELL_PATH" >fake_editor.sh &&
|
|
|
|
cat >>fake_editor.sh <<\EOF &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "exec echo" >"$1"
|
|
|
|
echo "edit $(git log -1 --format="%h")" >>"$1"
|
|
|
|
echo "exec echo" >>"$1"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
EOF
|
|
|
|
test_when_finished "rm -f fake_editor.sh" &&
|
|
|
|
chmod a+x fake_editor.sh &&
|
|
|
|
test_set_editor "$TRASH_DIRECTORY/fake_editor.sh" &&
|
|
|
|
git checkout b1 &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
git rebase -i HEAD^ &&
|
|
|
|
test_when_finished "git rebase --abort"
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - rebase merge' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (b2|REBASE-m 1/3)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b2 &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
test_must_fail git rebase --merge b1 b2 &&
|
|
|
|
test_when_finished "git rebase --abort" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - rebase' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (b2|REBASE 1/3)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b2 &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
test_must_fail git rebase b1 b2 &&
|
|
|
|
test_when_finished "git rebase --abort" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - merge' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (b1|MERGING)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git checkout b1 &&
|
|
|
|
test_when_finished "git checkout master" &&
|
|
|
|
test_must_fail git merge b2 &&
|
|
|
|
test_when_finished "git reset --hard" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - cherry-pick' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master|CHERRY-PICKING)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_must_fail git cherry-pick b1 &&
|
|
|
|
test_when_finished "git reset --hard" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - bisect' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master|BISECTING)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
git bisect start &&
|
|
|
|
test_when_finished "git bisect reset" &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - clean' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - dirty worktree' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master *)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - dirty index' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master +)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
git add -u &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - dirty index and worktree' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master *+)" >expected &&
|
|
|
|
echo "dirty index" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
git add -u &&
|
2013-06-18 04:34:16 +08:00
|
|
|
echo "dirty worktree" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - before root commit' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master #)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
|
|
|
cd otherrepo &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
2013-02-14 04:58:19 +08:00
|
|
|
test_expect_success 'prompt - dirty status indicator - shell variable unset with config disabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
test_config bash.showDirtyState false &&
|
2013-02-14 04:58:19 +08:00
|
|
|
(
|
|
|
|
sane_unset GIT_PS1_SHOWDIRTYSTATE &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:19 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - shell variable unset with config enabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
2013-02-14 04:58:19 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
test_config bash.showDirtyState true &&
|
|
|
|
(
|
|
|
|
sane_unset GIT_PS1_SHOWDIRTYSTATE &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:19 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - shell variable set with config disabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
2013-02-14 04:58:19 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
test_config bash.showDirtyState false &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:19 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - shell variable set with config enabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master *)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
2013-02-14 04:58:19 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
test_config bash.showDirtyState true &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - dirty status indicator - not shown inside .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (GIT_DIR!)" >expected &&
|
|
|
|
echo "dirty" >file &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_when_finished "git reset --hard" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWDIRTYSTATE=y &&
|
|
|
|
cd .git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - stash status indicator - no stash' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWSTASHSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - stash status indicator - stash' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master $)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
echo 2 >file &&
|
|
|
|
git stash &&
|
|
|
|
test_when_finished "git stash drop" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWSTASHSTATE=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - stash status indicator - not shown inside .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (GIT_DIR!)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
echo 2 >file &&
|
|
|
|
git stash &&
|
|
|
|
test_when_finished "git stash drop" &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWSTASHSTATE=y &&
|
|
|
|
cd .git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - untracked files status indicator - no untracked files' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
|
|
|
cd otherrepo &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - untracked files status indicator - untracked files' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master %%)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
2013-02-14 04:58:18 +08:00
|
|
|
test_expect_success 'prompt - untracked files status indicator - shell variable unset with config disabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
2013-02-14 04:58:18 +08:00
|
|
|
test_config bash.showUntrackedFiles false &&
|
|
|
|
(
|
|
|
|
sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:18 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - untracked files status indicator - shell variable unset with config enabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
2013-02-14 04:58:18 +08:00
|
|
|
test_config bash.showUntrackedFiles true &&
|
|
|
|
(
|
|
|
|
sane_unset GIT_PS1_SHOWUNTRACKEDFILES &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:18 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - untracked files status indicator - shell variable set with config disabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master)" >expected &&
|
2013-02-14 04:58:18 +08:00
|
|
|
test_config bash.showUntrackedFiles false &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:18 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - untracked files status indicator - shell variable set with config enabled' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (master %%)" >expected &&
|
2013-02-14 04:58:18 +08:00
|
|
|
test_config bash.showUntrackedFiles true &&
|
|
|
|
(
|
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
2013-02-14 04:58:18 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_expect_success 'prompt - untracked files status indicator - not shown inside .git directory' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf " (GIT_DIR!)" >expected &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
(
|
|
|
|
GIT_PS1_SHOWUNTRACKEDFILES=y &&
|
|
|
|
cd .git &&
|
2013-06-18 04:34:16 +08:00
|
|
|
__git_ps1 >"$actual"
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
) &&
|
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_expect_success 'prompt - format string starting with dash' '
|
2013-06-18 04:34:16 +08:00
|
|
|
printf -- "-master" >expected &&
|
|
|
|
__git_ps1 "-%s" >"$actual" &&
|
tests: add tests for the bash prompt functions in the completion script
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).
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-05-09 08:44:33 +08:00
|
|
|
test_cmp expected "$actual"
|
|
|
|
'
|
|
|
|
|
|
|
|
test_done
|