Git development
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Marc Branchaud <marcnarc@xiplink.com>
Cc: "Clemens Buchacher" <drizzd@aon.at>,
	git@vger.kernel.org, "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: Re: [PATCH/RFC] remove #!interpreter line from shell libraries
Date: Mon, 12 Mar 2012 14:17:03 -0500	[thread overview]
Message-ID: <20120312191703.GB21817@burratino> (raw)
In-Reply-To: <4F5E4618.10102@xiplink.com>

Hi,

Marc Branchaud wrote:
> On 12-03-09 02:58 AM, Clemens Buchacher wrote:
>> On Thu, Mar 08, 2012 at 06:14:04AM -0600, Jonathan Nieder wrote:

>>> +++ b/git-mergetool--lib.sh
>>> @@ -1,5 +1,4 @@
>>> -#!/bin/sh
[...]
>> This breaks vim's filetype detection. It can still guess the file type
>> from the .sh extension, but we strip the extension during the build.
>> Although one should typically work with the source files, in the past I
>> did have a look at the installed files on a few occasions.

It seems moot until someone has had time to deal with the --valgrind
fallout Jeff mentioned.  Here are my thoughts anyway.

vim's filetype detection has been broken for me in other ways, too:
when it sees "#!/bin/sh", by default it assumes that this is a script
intended for Solaris's lowest-common-denominator Bourne shell and
decides to annoyingly flag POSIXisms in red.  So I end up needing to
override vim's default heuristics already.

By the way, my mild dislike for the #! line in shell libraries is
actually rooted in functionality, in a way.  Though it would never
happen in git, I have had too many unhappy experiences of shell
libraries with #!/bin/bash at the top that were used in #!/bin/sh
scripts and broke completely.  So that is where the bad association
comes from.

Steering people towards git-sh-setup.sh when they try to edit
git-sh-setup is just a happy side-effect.

[...]
> How about a modeline?  I think the following would work for both emacs and
> vi(m?) (I'm not a vi user, so I might have it wrong):
>
> 	# -*-mode:shell-script-*-   vi: filetype=sh

A modeline becomes a distraction as people work to get the settings
perfect with respect to line length, indentation style, and changes in
supported editors, and to get them applied consistently as new files
are added.

So from a maintainability point of view, it seems wasteful --- better
to ask people to configure their editor to recognize .sh files,
#!/bin/sh, and files starting with "# " or containing "is a shell
library" on the first line once and be done with it.

Of course I can easily be convinced otherwise.

Thanks for some useful observations and for catching the huge holes
in the change description.

Sincerely,
Jonathan

  reply	other threads:[~2012-03-12 19:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08 12:14 [PATCH/RFC] remove #!interpreter line from shell libraries Jonathan Nieder
2012-03-08 12:47 ` Jeff King
2012-03-09  7:58 ` Clemens Buchacher
2012-03-12 18:53   ` Marc Branchaud
2012-03-12 19:17     ` Jonathan Nieder [this message]
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=20120312191703.GB21817@burratino \
    --to=jrnieder@gmail.com \
    --cc=avarab@gmail.com \
    --cc=cmn@elego.de \
    --cc=davvid@gmail.com \
    --cc=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=marcnarc@xiplink.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox