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

Re: [PATCH 1/6] t3404 & t3411: undo copy&paste

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 27, 2009, 21:01 UTC
Message-ID
<7v7i4g31lj.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<alpine.DEB.1.00.0901271845380.3586@pacific.mpi-cbg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 5 quoted lines
> Rather than copying and pasting, which is prone to lead to fixes
> missing in one version, move the fake-editor generator to t/t3404/.
>
> While at it, fix a typo that causes head-scratching: use
> ${SHELL_PATH-/bin/sh} instead of $SHELL_PATH.
I've learned to be cautious whenever I see "while at it".
Show 10 quoted lines
> diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh
> new file mode 100644
> index 0000000..8c8caab
> --- /dev/null
> +++ b/t/lib-rebase.sh
> @@ -0,0 +1,36 @@
> +#!/bin/sh
> +
> +set_fake_editor () {
> +	echo "#!${SHELL_PATH-/bin_sh}" >fake-editor.sh

It is unclear why you would want to do this. It was unclear what "typo" you were referring to in your commit log message, either.

The tests are supposed to run under the shell the user specified, so if there is a case you found that $SHELL_PATH is unset, that is a bug we would want to fix, and ${SHELL_PATH-/bin/sh} is sweeping the problem under the rug to make it harder to fix, isn't it?

I would understand if it were
	${SHELL_PATH?"SHELL_PATH Not Set --- bug in tests?"}
though.
Besides, it's /bin/sh, not /bin_sh ;-)
Show 24 quoted lines
> +	cat >> fake-editor.sh <<\EOF
> +case "$1" in
> +*/COMMIT_EDITMSG)
> +	test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1"
> +	test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1"
> +	exit
> +	;;
> +esac
> +test -z "$EXPECT_COUNT" ||
> +	test "$EXPECT_COUNT" = $(sed -e '/^#/d' -e '/^$/d' < "$1" | wc -l) ||
> +	exit
> +test -z "$FAKE_LINES" && exit
> +grep -v '^#' < "$1" > "$1".tmp
> +rm -f "$1"
> +cat "$1".tmp
> +action=pick
> +for line in $FAKE_LINES; do
> +	case $line in
> +	squash|edit)
> +		action="$line";;
> +	*)
> +		echo sed -n "${line}s/^pick/$action/p"
> +		sed -n "${line}p" < "$1".tmp
> +		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"

I looked at the output from this and wondered what these "sed -n" shown in the "-v" output were about last night. I do think it is a good idea to show what edit was done to the insn stream, but I suspect it may be easier to read the output if you did this instead:

> +		sed -n "${line}p" < "$1".tmp
> +		sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1"
> +		sed -n "${line}s/^pick/$action/p" < "$1".tmp
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 5 of 30 in “Heads up: rebase -i -p will be made sane again”
  1. Johannes SchindelinJan 27, 2009
  2. Stephen HabermanJan 27, 2009
  3. 0/6 Simplifications of some 'rebase' testsJohannes Schindelin, Jan 27, 2009
  4. 1/6 t3404 & t3411: undo copy&pasteJohannes Schindelin, Jan 27, 2009
  5. Junio C HamanoJan 27, 2009
  6. Johannes SchindelinJan 27, 2009
  7. Junio C HamanoJan 27, 2009
  8. Johannes SchindelinJan 27, 2009
  9. 0/6 rebase simplificationsJohannes Schindelin, Jan 27, 2009
  10. Junio C HamanoJan 27, 2009
  11. Johannes SchindelinJan 27, 2009
  12. 1/6 t3404 & t3411: undo copy&pasteJohannes Schindelin, Jan 27, 2009
  13. 2/6 lib-rebase.sh: Document what set_fake_editor() doesJohannes Schindelin, Jan 27, 2009
  14. 3/6 test-lib.sh: introduce test_commit() and test_merge() helpersJohannes Schindelin, Jan 27, 2009
  15. 4/6 Simplify t3410Johannes Schindelin, Jan 27, 2009
  16. 5/6 Simplify t3411Johannes Schindelin, Jan 27, 2009
  17. 6/6 Simplify t3412Johannes Schindelin, Jan 27, 2009
  18. 2/6 lib-rebase.sh: Document what set_fake_editor() doesJohannes Schindelin, Jan 27, 2009
  19. Junio C HamanoJan 27, 2009
  20. Johannes SchindelinJan 27, 2009
  21. 3/6 lib-rebase.sh: introduce test_commit() and test_merge() helpersJohannes Schindelin, Jan 27, 2009
  22. Junio C HamanoJan 27, 2009
  23. 4/6 Simplify t3410Johannes Schindelin, Jan 27, 2009
  24. 5/6 Simplify t3411Johannes Schindelin, Jan 27, 2009
  25. 6/6 Simplify t3412Johannes Schindelin, Jan 27, 2009
  26. Johannes SchindelinJan 27, 2009
  27. Johannes SchindelinJan 28, 2009
  28. Stephen HabermanJan 28, 2009
  29. Johannes SchindelinJan 28, 2009
  30. Stephen HabermanJan 28, 2009

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.