Re: Test t2028 failes

2018-04-03 Thread Jens Krüger

Am 03.04.2018 um 10:47 schrieb Eric Sunshine:

On Tue, Apr 3, 2018 at 4:42 AM, Jens Krüger  wrote:

Maybe, the attached patch may help. On my machine(s) it helped.
   git worktree list --porcelain >out &&
   grep "^worktree.*/destination" out &&
- ! grep "^worktree.*/source" out &&
+ ! grep "^worktree.*/source$" out &&


Our emails crossed. I suggested the same in my response (although I'd
add the '$' anchor to both grep's, not just the one).


I think so, that both of grep commands needs the '$' anchor.

Thanks, for your help.


Re: Test t2028 failes

2018-04-03 Thread Eric Sunshine
On Tue, Apr 3, 2018 at 4:42 AM, Jens Krüger  wrote:
> Maybe, the attached patch may help. On my machine(s) it helped.
>   git worktree list --porcelain >out &&
>   grep "^worktree.*/destination" out &&
> - ! grep "^worktree.*/source" out &&
> + ! grep "^worktree.*/source$" out &&

Our emails crossed. I suggested the same in my response (although I'd
add the '$' anchor to both grep's, not just the one).


Re: Test t2028 failes

2018-04-03 Thread Eric Sunshine
On Tue, Apr 3, 2018 at 4:38 AM, Jens Krüger  wrote:
> Am 03.04.2018 um 10:16 schrieb Eric Sunshine:
>> Using the "out" file you attached, can you show the output of these
>> commands?
>>  grep "^worktree.*/destination" out
>>  echo $?
>>  grep "^worktree.*/source" out
>>  echo $?
>> I'd expect the first $? to report 0 and the second 1 in a working
>> installation.
>
> Both of them return 0, but I guess I found the problem. The second
> 'grep' call returned the following output:
>
> worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move
> worktree /home/jkrueger/sources/git/t/trash
> directory.t2028-worktree-move/elsewhere
> worktree /home/jkrueger/sources/git/t/trash
> directory.t2028-worktree-move/some-dir/destination
>
> If I move my checkout into another directory not containing 'source' in
> the path it will work.

Okay, thanks for diagnosing the problem. We can fix the test by
tightening the regex to also anchor with '$' so that it won't be
fooled like that.


Re: Test t2028 failes

2018-04-03 Thread Jens Krüger

Am 03.04.2018 um 10:16 schrieb Eric Sunshine:

On Tue, Apr 3, 2018 at 4:01 AM, Jens Krüger  wrote:

The actual2 file does not exists, if I call the ./t2028-worktree-move.sh
with the '-v -i' options, only without any option or with '-v' option.


The content of the various files looks correct, and absence of
"actual2" implies that one of the grep's failed, which is very odd
considering that "out" has the expected content.

Using the "out" file you attached, can you show the output of these commands?

 grep "^worktree.*/destination" out
 echo $?
 grep "^worktree.*/source" out
 echo $?

I'd expect the first $? to report 0 and the second 1 in a working installation.

Also, are you using an unusual 'grep'? What does "command -v grep" report?



Maybe, the attached patch may help. On my machine(s) it helped.
diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
index 5d5b3632ba..65c7311865 100755
--- a/t/t2028-worktree-move.sh
+++ b/t/t2028-worktree-move.sh
@@ -77,7 +77,7 @@ test_expect_success 'move worktree' '
 	test_path_is_missing source &&
 	git worktree list --porcelain >out &&
 	grep "^worktree.*/destination" out &&
-	! grep "^worktree.*/source" out &&
+	! grep "^worktree.*/source$" out &&
 	git -C destination log --format=%s >actual2 &&
 	echo init >expected2 &&
 	test_cmp expected2 actual2


Re: Test t2028 failes

2018-04-03 Thread Jens Krüger

Am 03.04.2018 um 10:16 schrieb Eric Sunshine:

On Tue, Apr 3, 2018 at 4:01 AM, Jens Krüger  wrote:

The actual2 file does not exists, if I call the ./t2028-worktree-move.sh
with the '-v -i' options, only without any option or with '-v' option.


The content of the various files looks correct, and absence of
"actual2" implies that one of the grep's failed, which is very odd
considering that "out" has the expected content.

Using the "out" file you attached, can you show the output of these commands?

 grep "^worktree.*/destination" out
 echo $?
 grep "^worktree.*/source" out
 echo $?

I'd expect the first $? to report 0 and the second 1 in a working installation.



Both of them return 0, but I guess I found the problem. The second
'grep' call returned the following output:

worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move
worktree /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/elsewhere
worktree /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/some-dir/destination


If I move my checkout into another directory not containing 'source' in
the path it will work.


Also, are you using an unusual 'grep'? What does "command -v grep" report?



alias grep='grep --color=auto'


Re: Test t2028 failes

2018-04-03 Thread Eric Sunshine
On Tue, Apr 3, 2018 at 4:01 AM, Jens Krüger  wrote:
> The actual2 file does not exists, if I call the ./t2028-worktree-move.sh
> with the '-v -i' options, only without any option or with '-v' option.

The content of the various files looks correct, and absence of
"actual2" implies that one of the grep's failed, which is very odd
considering that "out" has the expected content.

Using the "out" file you attached, can you show the output of these commands?

grep "^worktree.*/destination" out
echo $?
grep "^worktree.*/source" out
echo $?

I'd expect the first $? to report 0 and the second 1 in a working installation.

Also, are you using an unusual 'grep'? What does "command -v grep" report?


Re: Test t2028 failes

2018-04-03 Thread Jens Krüger

The actual2 file does not exists, if I call the ./t2028-worktree-move.sh
with the '-v -i' options, only without any option or with '-v' option.

Am 03.04.2018 um 08:58 schrieb Eric Sunshine:

On Tue, Apr 3, 2018 at 2:33 AM, Jens Krüger  wrote:

*** t2028-worktree-move.sh ***
not ok 12 - move worktree
#
#   toplevel="$(pwd)" &&
#   git worktree move source destination &&
#   test_path_is_missing source &&
#   git worktree list --porcelain >out &&
#   grep "^worktree.*/destination" out &&
#   ! grep "^worktree.*/source" out &&
#   git -C destination log --format=%s >actual2 &&
#   echo init >expected2 &&
#   test_cmp expected2 actual2
#


Thanks for the report. Can you paste the relevant output (which
should/might include an error message) from running the test with:

./t2028-worktree-move.sh -v -i

and show an "ls -l" of t/trash directory.t2028-worktree-move
directory, as well as paste the content of files "out" and "actual2"
in that directory?

insgesamt 28
drwxr-xr-x 2 jkrueger jkrueger 4096 Apr  3 09:25 abc
-rw-r--r-- 1 jkrueger jkrueger  155 Apr  3 09:25 actual
drwxr-xr-x 2 jkrueger jkrueger 4096 Apr  3 09:25 destination
drwxr-xr-x 2 jkrueger jkrueger 4096 Apr  3 09:25 elsewhere
-rw-r--r-- 1 jkrueger jkrueger7 Apr  3 09:25 expected
-rw-r--r-- 1 jkrueger jkrueger5 Apr  3 09:25 init.t
-rw-r--r-- 1 jkrueger jkrueger  463 Apr  3 09:25 out
Initialized empty Git repository in /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/.git/
expecting success: 
test_commit init &&
git worktree add source &&
git worktree list --porcelain >out &&
grep "^worktree" out >actual &&
cat <<-EOF >expected &&
worktree $(pwd)
worktree $(pwd)/source
EOF
test_cmp expected actual

[master (root-commit) 2519212] init
 Author: A U Thor 
 1 file changed, 1 insertion(+)
 create mode 100644 init.t
Preparing source (identifier source)
HEAD is now at 2519212 init
ok 1 - setup

expecting success: 
test_must_fail git worktree lock .

fatal: The main working tree cannot be locked or unlocked
ok 2 - lock main worktree

expecting success: 
git worktree lock --reason hahaha source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked

ok 3 - lock linked worktree

expecting success: 
rm .git/worktrees/source/locked &&
git worktree add elsewhere &&
git -C elsewhere worktree lock --reason hahaha ../source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked

Preparing elsewhere (identifier elsewhere)
HEAD is now at 2519212 init
ok 4 - lock linked worktree from another worktree

expecting success: 
test_must_fail git worktree lock source &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked

fatal: 'source' is already locked, reason: hahaha
ok 5 - lock worktree twice

expecting success: 
test_must_fail git -C source worktree lock . &&
echo hahaha >expected &&
test_cmp expected .git/worktrees/source/locked

fatal: '.' is already locked, reason: hahaha
ok 6 - lock worktree twice (from the locked worktree)

expecting success: 
test_must_fail git worktree unlock .

fatal: The main working tree cannot be locked or unlocked
ok 7 - unlock main worktree

expecting success: 
git worktree unlock source &&
test_path_is_missing .git/worktrees/source/locked

ok 8 - unlock linked worktree

expecting success: 
test_must_fail git worktree unlock source &&
test_path_is_missing .git/worktrees/source/locked

fatal: 'source' is not locked
ok 9 - unlock worktree twice

expecting success: 
mkdir abc &&
test_must_fail git worktree move abc def

fatal: 'abc' is not a working tree
ok 10 - move non-worktree

expecting success: 
git worktree lock source &&
test_when_finished "git worktree unlock source" &&
test_must_fail git worktree move source destination

fatal: cannot move a locked working tree
ok 11 - move locked worktree

expecting success: 
toplevel="$(pwd)" &&
git worktree move source destination &&
test_path_is_missing source &&
git worktree list --porcelain >out &&
grep "^worktree.*/destination" out &&
! grep "^worktree.*/source" out &&
git -C destination log --format=%s >actual2 &&
echo init >expected2 &&
test_cmp expected2 actual2

worktree /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/destination
worktree /home/jkrueger/sources/git/t/trash directory.t2028-worktree-move
worktree /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/destination
worktree /home/jkrueger/sources/git/t/trash 
directory.t2028-worktree-move/elsewhere
not ok 12 - move worktree

Re: Test t2028 failes

2018-04-03 Thread Eric Sunshine
On Tue, Apr 3, 2018 at 2:33 AM, Jens Krüger  wrote:
> *** t2028-worktree-move.sh ***
> not ok 12 - move worktree
> #
> #   toplevel="$(pwd)" &&
> #   git worktree move source destination &&
> #   test_path_is_missing source &&
> #   git worktree list --porcelain >out &&
> #   grep "^worktree.*/destination" out &&
> #   ! grep "^worktree.*/source" out &&
> #   git -C destination log --format=%s >actual2 &&
> #   echo init >expected2 &&
> #   test_cmp expected2 actual2
> #

Thanks for the report. Can you paste the relevant output (which
should/might include an error message) from running the test with:

   ./t2028-worktree-move.sh -v -i

and show an "ls -l" of t/trash directory.t2028-worktree-move
directory, as well as paste the content of files "out" and "actual2"
in that directory?


Test t2028 failes

2018-04-03 Thread Jens Krüger

Test 2028 failes:

Git version: 2.17.0 (checked out from github repository)

OS: Debian9(9.4), Debian 8 (8.10) and xubuntu 14.04(14.04.5 LTS)

gcc: gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
 gcc (Debian 4.9.2-10+deb8u1) 4.9.2
 gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4


configure generated with:

autoreconf

build with:

./configure
make

test running:

make test

Error:

*** t2028-worktree-move.sh ***
ok 1 - setup
ok 2 - lock main worktree
ok 3 - lock linked worktree
ok 4 - lock linked worktree from another worktree
ok 5 - lock worktree twice
ok 6 - lock worktree twice (from the locked worktree)
ok 7 - unlock main worktree
ok 8 - unlock linked worktree
ok 9 - unlock worktree twice
ok 10 - move non-worktree
ok 11 - move locked worktree
not ok 12 - move worktree
#
#   toplevel="$(pwd)" &&
#   git worktree move source destination &&
#   test_path_is_missing source &&
#   git worktree list --porcelain >out &&
#   grep "^worktree.*/destination" out &&
#   ! grep "^worktree.*/source" out &&
#   git -C destination log --format=%s >actual2 &&
#   echo init >expected2 &&
#   test_cmp expected2 actual2
#
ok 13 - move main worktree
ok 14 - move worktree to another dir
ok 15 - remove main worktree
ok 16 - remove locked worktree
ok 17 - remove worktree with dirty tracked file
ok 18 - remove worktree with untracked file
ok 19 - force remove worktree with untracked file
ok 20 - remove missing worktree
ok 21 - NOT remove missing-but-locked worktree
# failed 1 among 21 test(s)
1..21