dev: “make” of Guix fails, non-existent .git/hooks directory

  • Done
  • quality assurance status badge
Details
2 participants
  • Maxim Cournoyer
  • Simon Tournier
Owner
unassigned
Submitted by
Simon Tournier
Severity
normal
S
S
Simon Tournier wrote on 17 Nov 2023 16:46
(address . bug-guix@gnu.org)
87wmug9ybw.fsf@gmail.com
Hi,

On a very fresh install of a system, I have just cloned the Guix
repository then run the dance ./bootstrap, ./configure and make. It
fails because:

Toggle snippet (8 lines)
cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
make[2]: Leaving directory '/home/simon/src/guix/guix'
make[1]: *** [Makefile:6137: all-recursive] Error 1
make[1]: Leaving directory '/home/simon/src/guix/guix'
make: *** [Makefile:4253: all] Error 2

In the file Makefile.am, nothing check that the directory .git/hooks
exists before copying to it. By default, it does not seem created. At
least, it was not with a fresh clone using Git from Guix revision
fc6bdaa.

I propose this patch attached.
Toggle diff (11 lines)
diff --git a/Makefile.am b/Makefile.am
index cbc3191dfc..6e9a22fae5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1170,6 +1170,7 @@ cuirass-jobs: $(GOBJECTS)
# Git auto-configuration.
.git/hooks/pre-push: etc/git/pre-push
$(AM_V_at)if test -d .git; then \
+ mkdir -p .git/hooks; \
cp etc/git/pre-push .git/hooks/pre-push; \
fi
Cheers,
simon
M
M
Maxim Cournoyer wrote on 12 Nov 08:06 +0100
(name . Simon Tournier)(address . zimon.toutoune@gmail.com)(address . 67240-done@debbugs.gnu.org)
87cyj16idu.fsf@gmail.com
Hi,

Simon Tournier <zimon.toutoune@gmail.com> writes:

Toggle quote (18 lines)
> Hi,
>
> On a very fresh install of a system, I have just cloned the Guix
> repository then run the dance ./bootstrap, ./configure and make. It
> fails because:
>
> cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
> make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
> make[2]: Leaving directory '/home/simon/src/guix/guix'
> make[1]: *** [Makefile:6137: all-recursive] Error 1
> make[1]: Leaving directory '/home/simon/src/guix/guix'
> make: *** [Makefile:4253: all] Error 2
>
> In the file Makefile.am, nothing check that the directory .git/hooks
> exists before copying to it. By default, it does not seem created. At
> least, it was not with a fresh clone using Git from Guix revision
> fc6bdaa.

It should, according to [0]:

"When you initialize a new repository with git init, Git populates the
hooks directory with a bunch of example scripts, many of which are
useful by themselves [...]"

I believe 'git clone' calls 'git init' under the hood.


It also appears to do that, even using the older Guix commit you
provided:

$ guix time-machine -q --commit=fc6bdaa -- shell --pure git nss-certs \
$ ls /tmp/guix/.git/
branches/ config description HEAD hooks/ index info/ logs/ objects/ packed-refs refs/

As you can see; the 'hooks' directory is there.

Toggle quote (14 lines)
> I propose this patch attached.
>
> diff --git a/Makefile.am b/Makefile.am
> index cbc3191dfc..6e9a22fae5 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -1170,6 +1170,7 @@ cuirass-jobs: $(GOBJECTS)
> # Git auto-configuration.
> .git/hooks/pre-push: etc/git/pre-push
> $(AM_V_at)if test -d .git; then \
> + mkdir -p .git/hooks; \
> cp etc/git/pre-push .git/hooks/pre-push; \
> fi

If you could come up with a reproducer, I don't mind applying such a
change, but so far it seems unnecessary?

I'm tentatively closing this old report.

--
Thanks,
Maxim
Closed
S
S
Simon Tournier wrote on 12 Nov 20:20 +0100
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 67240-done@debbugs.gnu.org)
87v7wsb6od.fsf@gmail.com
Hi,

On Tue, 12 Nov 2024 at 16:06, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Toggle quote (7 lines)
>> cp: cannot create regular file '.git/hooks/pre-push': No such file or directory
>> make[2]: *** [Makefile:7454: .git/hooks/pre-push] Error 1
>> make[2]: Leaving directory '/home/simon/src/guix/guix'
>> make[1]: *** [Makefile:6137: all-recursive] Error 1
>> make[1]: Leaving directory '/home/simon/src/guix/guix'
>> make: *** [Makefile:4253: all] Error 2

[...]

Toggle quote (6 lines)
>> + mkdir -p .git/hooks; \
>> cp etc/git/pre-push .git/hooks/pre-push; \
>
> If you could come up with a reproducer, I don't mind applying such a
> change, but so far it seems unnecessary?

Bah I barely clone. ;-)

Well, I am not able to reproduce too. Maybe an issue with a clone that
had been completed at once. Anyway.

In all, I think it’s always a good idea to check if the folder
destination exists before copying. It costs almost nothing and it
avoids spurious annoyances, as initially reported.

Cheers,
simon
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 67240@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 67240
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch