mirror of
https://github.com/git/git.git
synced 2024-11-05 08:47:56 +01:00
ff58b9aaf8
It makes no sense to suggest "git reset HEAD" since we have
no HEAD commit. This actually used to work but regressed in
f26a0012
.
wt_status_print_cached_header was updated to take the whole
wt_status struct rather than just the reference field.
Previously the various code paths were sometimes sending in
s->reference and sometimes sending in NULL, making the
decision on whether this was an initial commit before we
even got to this function. Now we must check the initial
flag here.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
131 lines
2.3 KiB
Bash
Executable file
131 lines
2.3 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Copyright (c) 2007 Johannes E. Schindelin
|
|
#
|
|
|
|
test_description='git-status'
|
|
|
|
. ./test-lib.sh
|
|
|
|
test_expect_success 'setup' '
|
|
: > tracked &&
|
|
: > modified &&
|
|
mkdir dir1 &&
|
|
: > dir1/tracked &&
|
|
: > dir1/modified &&
|
|
mkdir dir2 &&
|
|
: > dir1/tracked &&
|
|
: > dir1/modified &&
|
|
git add . &&
|
|
|
|
git status >output &&
|
|
|
|
test_tick &&
|
|
git commit -m initial &&
|
|
: > untracked &&
|
|
: > dir1/untracked &&
|
|
: > dir2/untracked &&
|
|
echo 1 > dir1/modified &&
|
|
echo 2 > dir2/modified &&
|
|
echo 3 > dir2/added &&
|
|
git add dir2/added
|
|
'
|
|
|
|
test_expect_success 'status (1)' '
|
|
|
|
grep -e "use \"git rm --cached <file>\.\.\.\" to unstage" output
|
|
|
|
'
|
|
|
|
cat > expect << \EOF
|
|
# On branch master
|
|
# Changes to be committed:
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
#
|
|
# new file: dir2/added
|
|
#
|
|
# Changed but not updated:
|
|
# (use "git add <file>..." to update what will be committed)
|
|
#
|
|
# modified: dir1/modified
|
|
#
|
|
# Untracked files:
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
#
|
|
# dir1/untracked
|
|
# dir2/modified
|
|
# dir2/untracked
|
|
# expect
|
|
# output
|
|
# untracked
|
|
EOF
|
|
|
|
test_expect_success 'status (2)' '
|
|
|
|
git status > output &&
|
|
git diff expect output
|
|
|
|
'
|
|
|
|
cat > expect << \EOF
|
|
# On branch master
|
|
# Changes to be committed:
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
#
|
|
# new file: ../dir2/added
|
|
#
|
|
# Changed but not updated:
|
|
# (use "git add <file>..." to update what will be committed)
|
|
#
|
|
# modified: modified
|
|
#
|
|
# Untracked files:
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
#
|
|
# untracked
|
|
# ../dir2/modified
|
|
# ../dir2/untracked
|
|
# ../expect
|
|
# ../output
|
|
# ../untracked
|
|
EOF
|
|
|
|
test_expect_success 'status with relative paths' '
|
|
|
|
(cd dir1 && git status) > output &&
|
|
git diff expect output
|
|
|
|
'
|
|
|
|
cat > expect << \EOF
|
|
# On branch master
|
|
# Changes to be committed:
|
|
# (use "git reset HEAD <file>..." to unstage)
|
|
#
|
|
# new file: dir2/added
|
|
#
|
|
# Changed but not updated:
|
|
# (use "git add <file>..." to update what will be committed)
|
|
#
|
|
# modified: dir1/modified
|
|
#
|
|
# Untracked files:
|
|
# (use "git add <file>..." to include in what will be committed)
|
|
#
|
|
# dir1/untracked
|
|
# dir2/modified
|
|
# dir2/untracked
|
|
# expect
|
|
# output
|
|
# untracked
|
|
EOF
|
|
|
|
test_expect_success 'status without relative paths' '
|
|
|
|
git config status.relativePaths false
|
|
(cd dir1 && git status) > output &&
|
|
git diff expect output
|
|
|
|
'
|
|
|
|
test_done
|