git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t2028: fix minor error and issues in newly-added "worktree move" tests

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Mar 5, 2018, 12:48 UTC
Message-ID
<20180305124848.7272-1-szeder.dev@gmail.com>
In-Reply-To
<20180304052647.26614-1-sunshine@sunshineco.com>
Show 13 quoted lines
> Recently-added "git worktree move" tests include a minor error and a few
> small issues. Specifically:
> 
> * checking non-existence of wrong file ("source" instead of
>   "destination")
> 
> * unneeded redirect (">empty")
> 
> * unused variable ("toplevel")
> 
> * restoring a worktree location by means of a separate test somewhat
>   distant from the test which moved it rather than using
>   test_when_finished() to restore it in a self-contained fashion
There is one more issue in these tests.
 
Show 10 quoted lines
> diff --git a/t/t2028-worktree-move.sh b/t/t2028-worktree-move.sh
> index 082368d8c6..d70d13dabe 100755
> --- a/t/t2028-worktree-move.sh
> +++ b/t/t2028-worktree-move.sh
> @@ -75,7 +75,7 @@ test_expect_success 'move worktree' '
>  	git worktree move source destination &&
>  	test_path_is_missing source &&
>  	git worktree list --porcelain | grep "^worktree.*/destination" &&
> -	! git worktree list --porcelain | grep "^worktree.*/source" >empty &&
> +	! git worktree list --porcelain | grep "^worktree.*/source" &&

The main purpose of this test script is to test the 'git worktree' command, but these pipes hide its exit code. Could you please save 'git worktree's output into an intermediate file, and run 'grep' on the file's contents?

This also applies to two other tests in this test script.
Show 31 quoted lines
>  	git -C destination log --format=%s >actual2 &&
>  	echo init >expected2 &&
>  	test_cmp expected2 actual2
> @@ -86,10 +86,10 @@ test_expect_success 'move main worktree' '
>  '
>  
>  test_expect_success 'move worktree to another dir' '
> -	toplevel="$(pwd)" &&
>  	mkdir some-dir &&
>  	git worktree move destination some-dir &&
> -	test_path_is_missing source &&
> +	test_when_finished "git worktree move some-dir/destination destination" &&
> +	test_path_is_missing destination &&
>  	git worktree list --porcelain | grep "^worktree.*/some-dir/destination" &&
>  	git -C some-dir/destination log --format=%s >actual2 &&
>  	echo init >expected2 &&
> @@ -100,10 +100,6 @@ test_expect_success 'remove main worktree' '
>  	test_must_fail git worktree remove .
>  '
>  
> -test_expect_success 'move some-dir/destination back' '
> -	git worktree move some-dir/destination destination
> -'
> -
>  test_expect_success 'remove locked worktree' '
>  	git worktree lock destination &&
>  	test_when_finished "git worktree unlock destination" &&
> -- 
> 2.16.2.660.g709887971b
> 
> 
Previous: Duy NguyenNext: Junio C Hamano
Message 46 of 49 in “nd/worktree-move reboot”
  1. 0/7 nd/worktree-move rebootNguyễn Thái Ngọc Duy, Jan 24, 2018
  2. 1/7 worktree.c: add validate_worktree()Nguyễn Thái Ngọc Duy, Jan 24, 2018
  3. 2/7 worktree.c: add update_worktree_location()Nguyễn Thái Ngọc Duy, Jan 24, 2018
  4. Eric SunshineFeb 2, 2018
  5. Duy NguyenFeb 2, 2018
  6. 3/7 worktree move: new commandNguyễn Thái Ngọc Duy, Jan 24, 2018
  7. Eric SunshineFeb 2, 2018
  8. Eric SunshineFeb 2, 2018
  9. Duy NguyenFeb 5, 2018
  10. Jeff KingFeb 6, 2018
  11. Martin ÅgrenFeb 6, 2018
  12. Duy NguyenFeb 12, 2018
  13. Martin ÅgrenFeb 12, 2018
  14. Duy NguyenFeb 13, 2018
  15. Jeff KingFeb 14, 2018
  16. Duy NguyenFeb 14, 2018
  17. Junio C HamanoFeb 14, 2018
  18. t/known-leaky: add list of known-leaky test scriptsMartin Ågren, Feb 14, 2018
  19. Jeff KingFeb 19, 2018
  20. Martin ÅgrenFeb 20, 2018
  21. Jeff KingFeb 20, 2018
  22. Junio C HamanoFeb 21, 2018
  23. Jeff KingFeb 21, 2018
  24. Kaartic SivaraamFeb 25, 2018
  25. Martin ÅgrenFeb 26, 2018
  26. 4/7 worktree move: accept destination as directoryNguyễn Thái Ngọc Duy, Jan 24, 2018
  27. Eric SunshineFeb 2, 2018
  28. 5/7 worktree move: refuse to move worktrees with submodulesNguyễn Thái Ngọc Duy, Jan 24, 2018
  29. Eric SunshineFeb 2, 2018
  30. 6/7 worktree remove: new commandNguyễn Thái Ngọc Duy, Jan 24, 2018
  31. Eric SunshineFeb 2, 2018
  32. Duy NguyenFeb 12, 2018
  33. 7/7 worktree remove: allow it when $GIT_WORK_TREE is already goneNguyễn Thái Ngọc Duy, Jan 24, 2018
  34. Eric SunshineFeb 2, 2018
  35. Junio C HamanoJan 24, 2018
  36. 0/7 nd/worktree-move rebootNguyễn Thái Ngọc Duy, Feb 12, 2018
  37. 1/7 worktree.c: add validate_worktree()Nguyễn Thái Ngọc Duy, Feb 12, 2018
  38. 2/7 worktree.c: add update_worktree_location()Nguyễn Thái Ngọc Duy, Feb 12, 2018
  39. 4/7 worktree move: accept destination as directoryNguyễn Thái Ngọc Duy, Feb 12, 2018
  40. 5/7 worktree move: refuse to move worktrees with submodulesNguyễn Thái Ngọc Duy, Feb 12, 2018
  41. 6/7 worktree remove: new commandNguyễn Thái Ngọc Duy, Feb 12, 2018
  42. 7/7 worktree remove: allow it when $GIT_WORK_TREE is already goneNguyễn Thái Ngọc Duy, Feb 12, 2018
  43. 3/7 worktree move: new commandNguyễn Thái Ngọc Duy, Feb 12, 2018
  44. t2028: fix minor error and issues in newly-added "worktree move" testsEric Sunshine, Mar 4, 2018
  45. Duy NguyenMar 5, 2018
  46. SZEDER GáborMar 5, 2018
  47. Junio C HamanoMar 5, 2018
  48. Eric SunshineMar 5, 2018
  49. Eric SunshineMar 4, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.