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

Re: [PATCH/RFD] builtin-revert.c: release index lock when cherry-picking an empty commit

From
Jeff King <peff@peff.net>
Date
Mar 8, 2009, 15:09 UTC
Message-ID
<20090308150944.GA32294@coredump.intra.peff.net>
In-Reply-To
<20090308144240.GA30794@coredump.intra.peff.net>
On Sun, Mar 08, 2009 at 10:42:40AM -0400, Jeff King wrote:
>   2. Have test_run_ canonicalize the snippet by removing trailing
>      newlines.
> [...]
> I think (2) is the most reasonable option of those choices.
And here's what that would look like:
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 7a847ec..276a14d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -273,7 +273,7 @@ test_debug () {
 }
 
 test_run_ () {
-	eval >&3 2>&4 "$1"
+	eval >&3 2>&4 "`echo "$1" | sed -e :a -e '/^ *\n*$/{$d;N;ba' -e '}'`"
 	eval_ret="$?"
 	return 0
 }

That is a truly hideous sed expression, and I would be happy to hear
more readable suggestions (it is based on one from the "sed one-liners"
compilation).

With this applied, t3505 passes for me. However, some other random tests
are broken as a result. It looks like it might be related to an extra
round of '\' expansion.

-Peff
Previous: Jeff KingNext: Junio C Hamano
Message 9 of 21 in “builtin-revert.c: release index lock when cherry-picking an empty commit”
  1. builtin-revert.c: release index lock when cherry-picking an empty commitChris Johnsen, Mar 7, 2009
  2. Johannes SchindelinMar 7, 2009
  3. Chris JohnsenMar 7, 2009
  4. Johannes SchindelinMar 8, 2009
  5. Junio C HamanoMar 8, 2009
  6. Chris JohnsenMar 8, 2009
  7. Junio C HamanoMar 8, 2009
  8. Jeff KingMar 8, 2009
  9. Jeff KingMar 8, 2009
  10. Junio C HamanoMar 8, 2009
  11. Jeff KingMar 10, 2009
  12. Tomas CarneckyMar 10, 2009
  13. Tomas CarneckyMar 10, 2009
  14. Chris JohnsenMar 10, 2009
  15. Jeff KingMar 11, 2009
  16. Mike RalphsonMar 11, 2009
  17. Mike RalphsonMar 11, 2009
  18. Jeff KingMar 22, 2009
  19. Junio C HamanoMar 22, 2009
  20. Jeff KingMar 22, 2009
  21. Brandon CaseyMar 9, 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.