git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Todd Zullinger <tmz@pobox.com>
Cc: Jakub Narebski <jnareb@gmail.com>, git@vger.kernel.org
Subject: Re: [PATCH] Use dashless git commands in setgitperms.perl
Date: Fri, 19 Sep 2008 18:27:20 -0700	[thread overview]
Message-ID: <7v4p4b7gjr.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080920004814.GM2939@inocybe.teonanacatl.org> (Todd Zullinger's message of "Fri, 19 Sep 2008 20:48:14 -0400")

Todd Zullinger <tmz@pobox.com> writes:

> Jakub Narebski wrote:
>> Todd Zullinger wrote:
>> 
>>>  # To save permissions/ownership data, place this script in your .git/hooks
>>>  # directory and enable a `pre-commit` hook with the following lines:
>>>  #      #!/bin/sh
>>> -#     SUBDIRECTORY_OK=1 . git-sh-setup
>>> +#     SUBDIRECTORY_OK=1 . git sh-setup
>>>  #     $GIT_DIR/hooks/setgitperms.perl -r
>>>  #
>>>  # To restore permissions/ownership data, place this script in your .git/hooks
>>>  # directory and enable a `post-merge` and `post-checkout` hook with the
>>>  # following lines:
>>>  #      #!/bin/sh
>>> -#     SUBDIRECTORY_OK=1 . git-sh-setup
>>> +#     SUBDIRECTORY_OK=1 . git sh-setup
>>>  #     $GIT_DIR/hooks/setgitperms.perl -w
>>>  #
>> 
>> The rest is probably O.K., but I don't think this change is good one.
>
> I don't see git-sh-setup in /usr/bin with a default install of git
> 1.6, so without this change, wouldn't the comments be suggesting a
> potentially broken hook configuration?

The patch is wrong on one point, and should be unnecessary.

First of all, you do not understand what "."  does in shell ;-)  That is
the "wrong" part.

About the "unnecessary" part, a hook should run under an environment where
exec-path is already added to the $PATH, so it should be able to find
git-sh-setup just fine without your change.

But I think the politically correct way would be:

	#!/bin/sh
	PATH=$(git --exec-path):$PATH
        SUBDIRECTORY_OK=1 . git-sh-setup
	$GIT_DIR/hooks/setgitperms.perl -r

especially if we envision that somebody may run the script by itself, not
from the hook.

The change to the perl script should not be strictly necessary (because
this is expected to be run from a hook), but to set a better example, I
think it is a good idea to do these s/git-/git / substitutions.

  reply	other threads:[~2008-09-20  1:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-19 23:42 [PATCH] Use dashless git commands in setgitperms.perl Todd Zullinger
2008-09-20  0:02 ` Jakub Narebski
2008-09-20  0:48   ` Todd Zullinger
2008-09-20  1:27     ` Junio C Hamano [this message]
2008-09-22 11:30       ` Todd Zullinger

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=7v4p4b7gjr.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=tmz@pobox.com \
    /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;
as well as URLs for NNTP newsgroup(s).