All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: "Jeff King" <peff@peff.net>, "David Aguilar" <davvid@gmail.com>,
	"Carlos Martín Nieto" <cmn@elego.de>,
	"Martin von Zweigbergk" <martin.von.zweigbergk@gmail.com>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH/RFC] remove #!interpreter line from shell libraries
Date: Thu, 8 Mar 2012 06:14:04 -0600	[thread overview]
Message-ID: <20120308121403.GA16493@burratino> (raw)

As explained in v1.7.0-rc1~9 (2009-11-25), even when a script is
expected to be sourced instead of executed on its own, a #!/bin/sh
shebang line can provide useful documentation about what format the
file is in.  However, it is even clearer to include a comment and no
shebang at all, to avoid creating the illusion that the indicated
choice of shell will have any effect at runtime.

Add some text to each of git's shell libraries explaining in what
context the fragment is meant to be sourced and remove the shebangs.

Because these files are not marked executable, removing the #! lines
would not confuse the valgrind support of our test scripts, so this
should be safe.  Noticed by lintian.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
Hi,

This patch has only an aesthetic justification but I think it is
basically good.  Last took a brief visit to the list at [1].  More
context at [2].  I'd be happy for any thoughts you have.

Thanks,
Jonathan

[1] http://thread.gmane.org/gmane.comp.version-control.git/185079/focus=185106
[2] http://bugs.debian.org/368792
    http://thread.gmane.org/gmane.comp.version-control.git/138253/focus=138560

 git-mergetool--lib.sh      |    3 +--
 git-parse-remote.sh        |    4 +++-
 git-rebase--am.sh          |    3 ++-
 git-rebase--interactive.sh |    8 +++-----
 git-rebase--merge.sh       |    4 +++-
 git-sh-i18n.sh             |    5 ++---
 git-sh-setup.sh            |    9 +++------
 7 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/git-mergetool--lib.sh b/git-mergetool--lib.sh
index ed630b20..7a0f499b 100644
--- a/git-mergetool--lib.sh
+++ b/git-mergetool--lib.sh
@@ -1,5 +1,4 @@
-#!/bin/sh
-# git-mergetool--lib is a library for common merge tool functions
+# git-mergetool--lib is a shell library for common merge tool functions
 diff_mode() {
 	test "$TOOL_MODE" = diff
 }
diff --git a/git-parse-remote.sh b/git-parse-remote.sh
index b24119d6..739ff772 100644
--- a/git-parse-remote.sh
+++ b/git-parse-remote.sh
@@ -1,4 +1,6 @@
-#!/bin/sh
+# This is a shell library to calculate the remote repository and
+# upstream branch that should be pulled by "git pull" from the current
+# branch.
 
 # git-ls-remote could be called from outside a git managed repository;
 # this would fail in that case and would issue an error message.
diff --git a/git-rebase--am.sh b/git-rebase--am.sh
index c815a241..5d8d451b 100644
--- a/git-rebase--am.sh
+++ b/git-rebase--am.sh
@@ -1,4 +1,5 @@
-#!/bin/sh
+# This shell script fragment is sourced by git-rebase to implement
+# its default, fast, patch-based, non-interactive mode.
 #
 # Copyright (c) 2010 Junio C Hamano.
 #
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 5812222e..ff00b094 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -1,11 +1,9 @@
-#!/bin/sh
 #
 # Copyright (c) 2006 Johannes E. Schindelin
 
-# SHORT DESCRIPTION
-#
-# This script makes it easy to fix up commits in the middle of a series,
-# and rearrange commits.
+# This shell script fragment is sourced by git-rebase to implement
+# its interactive mode.  "git rebase --interactive" makes it easy
+# to fix up commits in the middle of a series and rearrange commits.
 #
 # The original idea comes from Eric W. Biederman, in
 # http://article.gmane.org/gmane.comp.version-control.git/22407
diff --git a/git-rebase--merge.sh b/git-rebase--merge.sh
index dc599077..0fa0e491 100644
--- a/git-rebase--merge.sh
+++ b/git-rebase--merge.sh
@@ -1,4 +1,6 @@
-#!/bin/sh
+# This shell script fragment is sourced by git-rebase to implement
+# its merge-based non-interactive mode that copes well with renamed
+# files.
 #
 # Copyright (c) 2010 Junio C Hamano.
 #
diff --git a/git-sh-i18n.sh b/git-sh-i18n.sh
index b4575fb3..eff20a08 100644
--- a/git-sh-i18n.sh
+++ b/git-sh-i18n.sh
@@ -1,9 +1,8 @@
-#!/bin/sh
+# This shell library is Git's interface to gettext.sh. See po/README
+# for usage instructions.
 #
 # Copyright (c) 2010 Ævar Arnfjörð Bjarmason
 #
-# This is Git's interface to gettext.sh. See po/README for usage
-# instructions.
 
 # Export the TEXTDOMAIN* data that we need for Git
 TEXTDOMAIN=git
diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 5d8e4e6c..51362d60 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -1,9 +1,6 @@
-#!/bin/sh
-#
-# This is included in commands that either have to be run from the toplevel
-# of the repository, or with GIT_DIR environment variable properly.
-# If the GIT_DIR does not look like the right correct git-repository,
-# it dies.
+# This shell scriplet is meant to be included by other shell scripts
+# to set up some variables pointing at the normal git directories and
+# a few helper shell functions.
 
 # Having this variable in your environment would break scripts because
 # you would cause "cd" to be taken to unexpected places.  If you
-- 
1.7.9.2.792.g4ea66.dirty

             reply	other threads:[~2012-03-08 12:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 12:14 Jonathan Nieder [this message]
2012-03-08 12:47 ` [PATCH/RFC] remove #!interpreter line from shell libraries Jeff King
2012-03-09  7:58 ` Clemens Buchacher
2012-03-12 18:53   ` Marc Branchaud
2012-03-12 19:17     ` Jonathan Nieder
2012-03-13 19:09       ` Clemens Buchacher
2012-03-12 19:50     ` Junio C Hamano
2012-03-12 21:38       ` Clemens Buchacher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120308121403.GA16493@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=cmn@elego.de \
    --cc=davvid@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=martin.von.zweigbergk@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.