git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: git@vger.kernel.org
Cc: Olivier Berger <olivier.berger@it-sudparis.eu>,
	Michael Haggerty <mhagger@alum.mit.edu>,
	"Kevin P. Fleming" <kpfleming@digium.com>,
	Chris Hiestand <chiestand@salk.edu>,
	Miklos Vajna <vmiklos@suse.cz>
Subject: [PATCH] contrib/hooks: avoid requiring root access in usage instructions
Date: Fri, 19 Oct 2012 17:31:04 -0700	[thread overview]
Message-ID: <20121020003104.GA26596@elie.Belkin> (raw)

Comments in hooks/post-receive-email suggest:

 For example, on debian the hook is stored in
 /usr/share/git-core/contrib/hooks/post-receive-email:

  chmod a+x post-receive-email
  cd /path/to/your/repository.git
  ln -sf /usr/share/git-core/contrib/hooks/post-receive-email hooks/post-receive

Doing that means changing permissions on a file provided by a package,
which is problematic in a number of ways: the permissions would be
likely to change back in later upgrades, and changing them requires
root access.  Copying the script into each repo that uses it is not
much better, since each copy would be maintained separately and not
benefit from bugfixes in the master copy.

Better to ship the hook with executable permission and remove the
chmod line so enabling the hook becomes a one-step process: just
symlink it into place.

Likewise for the pre-auto-gc-battery hook.

Reported-by: Olivier Berger <olivier.berger@it-sudparis.eu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
From <http://bugs.debian.org/687391>.

Thoughts?
Jonathan

 contrib/hooks/post-receive-email  | 1 -
 contrib/hooks/pre-auto-gc-battery | 1 -
 2 files changed, 2 deletions(-)
 mode change 100644 => 100755 contrib/hooks/pre-auto-gc-battery

diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index 8ca6607a..359f1ad2 100755
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -13,7 +13,6 @@
 # For example, on debian the hook is stored in
 # /usr/share/git-core/contrib/hooks/post-receive-email:
 #
-#  chmod a+x post-receive-email
 #  cd /path/to/your/repository.git
 #  ln -sf /usr/share/git-core/contrib/hooks/post-receive-email hooks/post-receive
 #
diff --git a/contrib/hooks/pre-auto-gc-battery b/contrib/hooks/pre-auto-gc-battery
old mode 100644
new mode 100755
index 1f914c94..9d0c2d19
--- a/contrib/hooks/pre-auto-gc-battery
+++ b/contrib/hooks/pre-auto-gc-battery
@@ -13,7 +13,6 @@
 # For example, if the hook is stored in
 # /usr/share/git-core/contrib/hooks/pre-auto-gc-battery:
 #
-# chmod a+x pre-auto-gc-battery
 # cd /path/to/your/repository.git
 # ln -sf /usr/share/git-core/contrib/hooks/pre-auto-gc-battery \
 #	hooks/pre-auto-gc
-- 
1.8.0.rc2

             reply	other threads:[~2012-10-20  0:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20  0:31 Jonathan Nieder [this message]
2012-10-20  4:19 ` [PATCH] contrib/hooks: avoid requiring root access in usage instructions Junio C Hamano
2012-10-20  7:03   ` Jonathan Nieder

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=20121020003104.GA26596@elie.Belkin \
    --to=jrnieder@gmail.com \
    --cc=chiestand@salk.edu \
    --cc=git@vger.kernel.org \
    --cc=kpfleming@digium.com \
    --cc=mhagger@alum.mit.edu \
    --cc=olivier.berger@it-sudparis.eu \
    --cc=vmiklos@suse.cz \
    /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).