diff options
author | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-03-14 10:29:55 +0100 |
---|---|---|
committer | Daan De Meyer <daan.j.demeyer@gmail.com> | 2024-03-15 17:27:49 +0100 |
commit | 6233a769327d8a1e7247ce741569752ffcf09144 (patch) | |
tree | 6d2068839e3f7a7dc0b20a3fa50faebddf6e0dbd | |
parent | docs: Update HACKING guide with recommended git config (diff) | |
download | systemd-6233a769327d8a1e7247ce741569752ffcf09144.tar.xz systemd-6233a769327d8a1e7247ce741569752ffcf09144.zip |
meson: Rename add-git-hook.sh to git-setup.sh and configure git in it
Let's automatically apply the recommended git config with meson.
-rw-r--r-- | docs/HACKING.md | 2 | ||||
-rw-r--r-- | meson.build | 6 | ||||
-rwxr-xr-x | tools/git-setup.sh (renamed from tools/add-git-hook.sh) | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/docs/HACKING.md b/docs/HACKING.md index ac4d6a69b0..6dc9489124 100644 --- a/docs/HACKING.md +++ b/docs/HACKING.md @@ -15,7 +15,7 @@ Please make sure to follow our [Coding Style](CODING_STYLE) when submitting patches. Also have a look at our [Contribution Guidelines](CONTRIBUTING). To start, run the following commands in the systemd git repository to set up -git correctly: +git correctly (running `meson` will run these commands for you automatically): ```shell $ git config submodule.recurse true diff --git a/meson.build b/meson.build index 078ba822ea..0e5f403484 100644 --- a/meson.build +++ b/meson.build @@ -66,9 +66,9 @@ summary({'build mode' : get_option('mode')}) ##################################################################### # Try to install the git pre-commit hook -add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false) -if add_git_hook_sh.found() - git_hook = run_command(add_git_hook_sh, check : false) +git_setup_sh = find_program('tools/git-setup.sh', required : false) +if git_setup_sh.found() + git_hook = run_command(git_setup_sh, check : false) if git_hook.returncode() == 0 message(git_hook.stdout().strip()) endif diff --git a/tools/add-git-hook.sh b/tools/git-setup.sh index 8cff62e864..2f7be5ccd6 100755 --- a/tools/add-git-hook.sh +++ b/tools/git-setup.sh @@ -4,6 +4,11 @@ set -eu cd "${MESON_SOURCE_ROOT:?}" +if [ -e .git ]; then + git config submodule.recurse true + git config fetch.recurseSubmodules on-demand +fi + if [ ! -f .git/hooks/pre-commit.sample ] || [ -f .git/hooks/pre-commit ]; then exit 2 # not needed fi |