]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: Rename add-git-hook.sh to git-setup.sh and configure git in it
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Mar 2024 09:29:55 +0000 (10:29 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 15 Mar 2024 16:27:49 +0000 (17:27 +0100)
Let's automatically apply the recommended git config with meson.

docs/HACKING.md
meson.build
tools/git-setup.sh [moved from tools/add-git-hook.sh with 74% similarity]

index ac4d6a69b049f94d86607476da972db44109a927..6dc9489124694b465da03411d6d02e20ca9f40df 100644 (file)
@@ -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
index 078ba822ea15dbf259d3e48ee7af01cfae6b23c1..0e5f40348483d71a2501cdd702ae50a88e437080 100644 (file)
@@ -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
similarity index 74%
rename from tools/add-git-hook.sh
rename to tools/git-setup.sh
index 8cff62e864da9c9a1733b775d1743fe2aa7ca95c..2f7be5ccd693f4806e254654e0226515f7630804 100755 (executable)
@@ -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