From cbf280f54ced411020e4526aa2be21cd50aff529 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Tue, 18 Mar 2025 19:52:00 +0800 Subject: [PATCH] git_hooks_client -> hookc --- Makefile | 4 ++-- git_hooks_client/.gitignore | 1 - git_hooks_client/git_hooks_client.c => hookc/hookc.c | 0 git_hooks_deploy.go | 8 ++++---- git_hooks_handle.go | 2 +- hookc/.gitignore | 1 + resources.go | 4 ++-- diff --git a/Makefile b/Makefile index 43e344c1f4cdb4c25d0fa1682160d601067fc39e..55d5dddb0b4dd8519c188ccc1ca9f9c7d19b31f5 100644 --- a/Makefile +++ b/Makefile @@ -5,11 +5,11 @@ .PHONY: clean version.go CFLAGS = -Wall -Wextra -Werror -pedantic -std=c99 -D_GNU_SOURCE -forge: $(filter-out forge,$(wildcard *)) version.go git_hooks_client/*.c git_hooks_client/git_hooks_client +forge: $(filter-out forge,$(wildcard *)) version.go hookc/*.c hookc/hookc go mod vendor go build . -git_hooks_client/git_hooks_client: +hookc/hookc: version.go: printf 'package main\nconst VERSION="%s"\n' $(shell git describe --tags --always --dirty) > $@ diff --git a/git_hooks_client/.gitignore b/git_hooks_client/.gitignore deleted file mode 100644 index 129c0b4e8c659fe8c91dc7863b6d9eec4688bbe6..0000000000000000000000000000000000000000 --- a/git_hooks_client/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/git_hooks_client diff --git a/git_hooks_client/git_hooks_client.c b/hookc/hookc.c rename from git_hooks_client/git_hooks_client.c rename to hookc/hookc.c diff --git a/git_hooks_deploy.go b/git_hooks_deploy.go index b70ccfe72c729d6a7fe85658d5a2b9a2aa0d9056..9965b43ab07fc8dd91b69b88ed984fdc00ed6579 100644 --- a/git_hooks_deploy.go +++ b/git_hooks_deploy.go @@ -18,12 +18,12 @@ err = func() (err error) { var src_fd fs.File var dst_fd *os.File - if src_fd, err = resources_fs.Open("git_hooks_client/git_hooks_client"); err != nil { + if src_fd, err = resources_fs.Open("hookc/hookc"); err != nil { return err } defer src_fd.Close() - if dst_fd, err = os.OpenFile(filepath.Join(config.Hooks.Execs, "git_hooks_client"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755); err != nil { + if dst_fd, err = os.OpenFile(filepath.Join(config.Hooks.Execs, "hookc"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755); err != nil { return err } defer dst_fd.Close() @@ -40,14 +40,14 @@ } // Go's embed filesystems do not store permissions; but in any case, // they would need to be 0o755: - if err = os.Chmod(filepath.Join(config.Hooks.Execs, "git_hooks_client"), 0o755); err != nil { + if err = os.Chmod(filepath.Join(config.Hooks.Execs, "hookc"), 0o755); err != nil { return err } for _, hook_name := range []string{ "pre-receive", } { - if err = os.Symlink(filepath.Join(config.Hooks.Execs, "git_hooks_client"), filepath.Join(config.Hooks.Execs, hook_name)); err != nil { + if err = os.Symlink(filepath.Join(config.Hooks.Execs, "hookc"), filepath.Join(config.Hooks.Execs, hook_name)); err != nil { return err } } diff --git a/git_hooks_handle.go b/git_hooks_handle.go index 7da6c8854677dcc7729b1c85515f67dcc2f0e2eb..178b3c73671015afe81867d5c7516263c9906dad 100644 --- a/git_hooks_handle.go +++ b/git_hooks_handle.go @@ -28,7 +28,7 @@ err_get_fd = errors.New("unable to get file descriptor") err_get_ucred = errors.New("failed getsockopt") ) -// hooks_handle_connection handles a connection from git_hooks_client via the +// hooks_handle_connection handles a connection from hookc via the // unix socket. func hooks_handle_connection(conn net.Conn) { var ctx context.Context diff --git a/hookc/.gitignore b/hookc/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..7348daa8e39e97eed3c06556f29500fc6861712b --- /dev/null +++ b/hookc/.gitignore @@ -0,0 +1 @@ +/hookc diff --git a/resources.go b/resources.go index 63a93af6b18ad3c4acf6a49f1dbe24428454a5b7..41d15d7f36896c1842f40a22fc9f6d9e638798c6 100644 --- a/resources.go +++ b/resources.go @@ -21,7 +21,7 @@ //go:embed *.go go.mod go.sum //go:embed *.scfg //go:embed Makefile //go:embed static/* templates/* scripts/* sql/* -//go:embed git_hooks_client/*.c +//go:embed hookc/*.c //go:embed vendor/* var source_fs embed.FS @@ -30,7 +30,7 @@ "/:/source/", http.FileServer(http.FS(source_fs)), ) -//go:embed templates/* static/* git_hooks_client/git_hooks_client +//go:embed templates/* static/* hookc/hookc var resources_fs embed.FS var templates *template.Template -- 2.48.1