Re: [PATCH/RFC] remove #!interpreter line from shell libraries

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]