* bug#67240: dev: “make” of Guix fails, non-existent .git/hooks directory
@ 2023-11-17 15:46 Simon Tournier
2024-11-12 7:06 ` Maxim Cournoyer
0 siblings, 1 reply; 3+ messages in thread
From: Simon Tournier @ 2023-11-17 15:46 UTC (permalink / raw)
To: 67240
[-- Attachment #1: Type: text/plain, Size: 876 bytes --]
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:
--8<---------------cut here---------------start------------->8---
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
--8<---------------cut here---------------end--------------->8---
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.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: p.patch --]
[-- Type: text/x-diff, Size: 338 bytes --]
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
[-- Attachment #3: Type: text/plain, Size: 15 bytes --]
Cheers,
simon
^ permalink raw reply related [flat|nested] 3+ messages in thread
* bug#67240: dev: “make” of Guix fails, non-existent .git/hooks directory
2023-11-17 15:46 bug#67240: dev: “make” of Guix fails, non-existent .git/hooks directory Simon Tournier
@ 2024-11-12 7:06 ` Maxim Cournoyer
2024-11-12 19:20 ` Simon Tournier
0 siblings, 1 reply; 3+ messages in thread
From: Maxim Cournoyer @ 2024-11-12 7:06 UTC (permalink / raw)
To: Simon Tournier; +Cc: 67240-done
Hi,
Simon Tournier <zimon.toutoune@gmail.com> writes:
> 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.
[0] https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks.html
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 \
-- git clone https://git.savannah.gnu.org/git/guix.git /tmp/guix
$ 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.
> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#67240: dev: “make” of Guix fails, non-existent .git/hooks directory
2024-11-12 7:06 ` Maxim Cournoyer
@ 2024-11-12 19:20 ` Simon Tournier
0 siblings, 0 replies; 3+ messages in thread
From: Simon Tournier @ 2024-11-12 19:20 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 67240-done
Hi,
On Tue, 12 Nov 2024 at 16:06, Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
>> 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
[...]
>> + 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-12 19:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-17 15:46 bug#67240: dev: “make” of Guix fails, non-existent .git/hooks directory Simon Tournier
2024-11-12 7:06 ` Maxim Cournoyer
2024-11-12 19:20 ` Simon Tournier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).