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

[PATCH 3/3] add shebang line to git-mergetool--lib.sh

From
Jeff King <peff@peff.net>
Date
Jan 29, 2010, 10:37 UTC
Message-ID
<20100129103723.GC6025@coredump.intra.peff.net>
In-Reply-To
<20100129102518.GA5875@coredump.intra.peff.net>

Even though this script is expected to be sourced instead of executed on its own, the #!/bin/sh line provides simple documentation about what format the file is in.

In particular, the lack of such a line was confusing the valgrind support of our test scripts, which assumed that any executable without a #!-line should be intercepted and run through valgrind. So during valgrind-enabled tests, any script sourcing this file actually sourced the valgrind interception script instead.

Signed-off-by: Jeff King <peff@peff.net>
---
The valgrind script could perhaps be a bit smarter instead, but checking
#!-lines is nice and simple, and this change makes other programs like
"file" happier, too.

This problem has been around since 21d0ba7 (difftool/mergetool: refactor commands to use git-mergetool--lib, 2009-04-08), released in v1.6.3. But since it is only about our internal tests, and even then only about running them with valgrind enabled, I don't know if it is worth a fix on 'maint'.

 git-mergetool--lib.sh |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index 5b62785..51dd0d6 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -1,3 +1,4 @@
+#!/bin/sh
 # git-mergetool--lib is a library for common merge tool functions
 diff_mode() {
 	test "$TOOL_MODE" = diff
-- 
1.7.0.rc0.41.g538720
Previous: Jeff KingNext: Jonathan Nieder
Message 5 of 13 in “rerere: fix too-short initialization”
  1. rerere: fix too-short initializationJeff King, Jan 28, 2010
  2. 0/3 valgrind bug roundupJeff King, Jan 29, 2010
  3. 1/3 fix memcpy of overlapping areaJeff King, Jan 29, 2010
  4. 2/3 fix off-by-one allocation errorJeff King, Jan 29, 2010
  5. 3/3 add shebang line to git-mergetool--lib.shJeff King, Jan 29, 2010
  6. Do not install shell libraries executableJonathan Nieder, Jan 29, 2010
  7. Junio C HamanoJan 31, 2010
  8. Do not install shell libraries executableJonathan Nieder, Jan 31, 2010
  9. Junio C HamanoJan 31, 2010
  10. Jonathan NiederJan 31, 2010
  11. Junio C HamanoJan 31, 2010
  12. Jonathan NiederJan 31, 2010
  13. Junio C HamanoJan 31, 2010

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.