summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Knight <james.d.knight@live.com>2024-08-03 12:31:29 -0400
committerSimon Ser <contact@emersion.fr>2024-08-03 18:37:17 +0200
commit1a70f3ab566f6d939a1e342158e830a38dfe31ac (patch)
tree1c8efe633609362c6409fb8ea45c16724fe5fee1
parentdd4691fc3b202f8d14badee927ce701c358bf4a9 (diff)
downloadswaybg-1a70f3ab566f6d939a1e342158e830a38dfe31ac.tar.gz
swaybg-1a70f3ab566f6d939a1e342158e830a38dfe31ac.tar.bz2
build: avoid git repository discovery when determining version
When attempting to use Git to populate commit/branch information in a version string, it is possible through repository discovery that it uses Git information not relevant to project. For example, if repository content is extract into an interim build location when using an embedded build framework (e.g. Buildroot), the project will not have its Git repository to refer to. When it cannot find its repository, it will look into its parent folders and may find the Git repository of another project and use its branch/commit information. This commit provides an explicit path to the project's Git repository when consider commit/branch information. This will prevent any repository discovery from occurring. Signed-off-by: James Knight <james.d.knight@live.com>
Diffstat (limited to '')
-rw-r--r--meson.build4
1 files changed, 2 insertions, 2 deletions
diff --git a/meson.build b/meson.build
index 0620758..c1917a1 100644
--- a/meson.build
+++ b/meson.build
@@ -40,8 +40,8 @@ scdoc = find_program('scdoc', required: get_option('man-pages'), native: true)
version = '"@0@"'.format(meson.project_version())
if git.found()
- git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false)
- git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
+ git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
+ git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
if git_commit.returncode() == 0 and git_branch.returncode() == 0
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
meson.project_version(),