all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: emacs-devel@gnu.org
Subject: Re: Why does make run git?
Date: Tue, 15 Aug 2017 13:39:24 -0700	[thread overview]
Message-ID: <7a270049-7aec-6b99-2a88-06379548b339@cs.ucla.edu> (raw)
In-Reply-To: <87zib0lqdo.fsf@lifelogs.com>

[-- Attachment #1: Type: text/plain, Size: 803 bytes --]

Ted Zlatanov wrote:

> I think CONTRIBUTE should mention, right after saying to run autogen.sh,
> that the above requires Git to be installed.

autogen.sh is not supposed to require Git, so let's fix autogen.sh instead.


> 'build-aux/git-hooks/commit-msg' -> '.git/hooks/commit-msg'
> cp: cannot create regular file '.git/hooks/commit-msg': No such file or directory
> ERROR: Job failed: exit code 1
> #+end_src
> 
> So it looks like it assumes that `.git/hooks' exists. I don't know why
> that's not true in the GitLab checkout.

I don't know why either. I wonder what other compatibility mines remain 
unexploded in the GitLab field? Anyway, I installed the attached, which should 
work around this particular problem without having to complicate the 
configuration instructions.

[-- Attachment #2: 0001-Do-not-assume-regular-Git-.git-hooks-dir.txt --]
[-- Type: text/plain, Size: 2045 bytes --]

From e97aebd8fed255507fd17ef37a06b042ebed7e77 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 15 Aug 2017 13:31:03 -0700
Subject: [PATCH] Do not assume regular Git .git/hooks dir
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Apparently Gitlab doesn’t create .git/hooks, like regular Git does.
Problem reported by Ted Zlatanov in:
http://lists.gnu.org/archive/html/emacs-devel/2017-08/msg00380.html
* autogen.sh (git_sample_hook_src): New function.  Use it to work
even if .git/hooks or its samples do not exist.
---
 autogen.sh | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/autogen.sh b/autogen.sh
index 70f9cbd..d454e41 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -327,8 +327,21 @@ sample_hooks=
     cmp -- build-aux/git-hooks/$hook "$hooks/$hook" >/dev/null 2>&1 ||
 	tailored_hooks="$tailored_hooks $hook"
 done
+
+git_sample_hook_src ()
+{
+    hook=$1
+    src=$hooks/$hook.sample
+    if test ! -r "$src"; then
+	case $hook in
+	    applypatch-msg) src=build-aux/git-hooks/commit-msg;;
+	    pre-applypatch) src=build-aux/git-hooks/pre-commit;;
+	esac
+    fi
+}
 for hook in applypatch-msg pre-applypatch; do
-    cmp -- "$hooks/$hook.sample" "$hooks/$hook" >/dev/null 2>&1 ||
+    git_sample_hook_src $hook
+    cmp -- "$src" "$hooks/$hook" >/dev/null 2>&1 ||
 	sample_hooks="$sample_hooks $hook"
 done
 
@@ -336,6 +349,11 @@ sample_hooks=
     if $do_git; then
 	echo "Installing git hooks..."
 
+	if test ! -d "$hooks"; then
+	    printf "mkdir -p -- '%s'\\n" "$hooks"
+	    mkdir -p -- "$hooks" || exit
+	fi
+
 	if test -n "$tailored_hooks"; then
 	    for hook in $tailored_hooks; do
 		dst=$hooks/$hook
@@ -346,8 +364,9 @@ sample_hooks=
 
 	if test -n "$sample_hooks"; then
 	    for hook in $sample_hooks; do
+		git_sample_hook_src $hook
 		dst=$hooks/$hook
-		cp $cp_options -- "$dst.sample" "$dst" || exit
+		cp $cp_options -- "$src" "$dst" || exit
 		chmod -- a-w "$dst" || exit
 	    done
 	fi
-- 
2.7.4


  parent reply	other threads:[~2017-08-15 20:39 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-01  1:19 Why does make run git? Richard Stallman
2017-08-01  3:07 ` Eli Zaretskii
2017-08-01 14:30   ` Richard Stallman
2017-08-01 14:49     ` Tino Calancha
2017-08-02 17:26       ` Richard Stallman
2017-08-02 17:43         ` Radon Rosborough
2017-08-03 19:43           ` Richard Stallman
2017-08-03 20:02             ` Radon Rosborough
2017-08-02 17:56         ` Paul Eggert
2017-08-02 18:31           ` Eli Zaretskii
2017-08-02 18:42             ` Paul Eggert
2017-08-02 19:10               ` Eli Zaretskii
2017-08-02 20:04                 ` Paul Eggert
2017-08-12 16:11                   ` Paul Eggert
2017-08-15 14:18           ` Ted Zlatanov
2017-08-15 15:52             ` Paul Eggert
2017-08-15 16:58               ` Ted Zlatanov
2017-08-15 17:08                 ` Eli Zaretskii
2017-08-15 20:39                 ` Paul Eggert [this message]
2017-08-16 12:30                   ` Andy Moreton
2017-08-16 12:38                     ` Noam Postavsky
2017-08-16 12:49                     ` Andreas Schwab
2017-08-16 14:09                   ` Ted Zlatanov
2017-08-01  3:14 ` Tino Calancha
2017-08-02 17:25   ` Richard Stallman
2017-08-01 15:10 ` Paul Eggert
2017-08-01 15:15   ` Kaushal Modi
2017-08-01 16:01 ` Radon Rosborough
2017-08-02 17:30   ` Richard Stallman

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=7a270049-7aec-6b99-2a88-06379548b339@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=emacs-devel@gnu.org \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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.