Skip to content

Commit 8d55f6e

Browse files
committed
Merge branch 'pks-meson-fixes' of github.com:pks-gitlab/git-gui
* 'pks-meson-fixes' of github.com:pks-gitlab/git-gui: git-gui: wire up "git-gui--askyesno" with Meson git-gui: massage "git-gui--askyesno" with "generate-script.sh" git-gui: prefer shell at "/bin/sh" with Meson git-gui: fix use of GIT_CEILING_DIRECTORIES Signed-off-by: Johannes Sixt <j6t@kdbg.org>
2 parents d5139f3 + 65d3a12 commit 8d55f6e

File tree

6 files changed

+38
-21
lines changed

6 files changed

+38
-21
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ GIT-GUI-BUILD-OPTIONS
55
GIT-VERSION-FILE
66
git-gui
77
git-gui--askpass
8+
git-gui--askyesno
89
lib/tclIndex

GIT-VERSION-GEN

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,27 @@ DEF_VER=0.21.GITGUI
55
LF='
66
'
77

8-
if test "$#" -ne 2
8+
if test "$#" -lt 2
99
then
10-
echo >&2 "usage: $0 <SOURCE_DIR> <OUTPUT>"
10+
echo >&2 "usage: $0 <SOURCE_DIR> <OUTPUT> [<PARENT_PROJECT_DIR>]"
1111
exit 1
1212
fi
1313

1414
SOURCE_DIR="$1"
1515
OUTPUT="$2"
16+
PARENT_PROJECT_DIR="$3"
1617

1718
# Protect us from reading Git version information outside of the Git directory
1819
# in case it is not a repository itself, but embedded in an unrelated
19-
# repository.
20-
GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
20+
# repository. The PARENT_PROJECT_DIR variable can be used to override this, for
21+
# example when git-gui is included as a subproject.
22+
if test -n "$PARENT_PROJECT_DIR"
23+
then
24+
GIT_CEILING_DIRECTORIES="$PARENT_PROJECT_DIR/.."
25+
else
26+
GIT_CEILING_DIRECTORIES="$SOURCE_DIR/.."
27+
fi
28+
2129
export GIT_CEILING_DIRECTORIES
2230

2331
tree_search ()

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ all::
99
#
1010

1111
GIT-VERSION-FILE: FORCE
12-
@$(SHELL_PATH) ./GIT-VERSION-GEN . $@
12+
@$(SHELL_PATH) ./GIT-VERSION-GEN . $@ "$(PARENT_PROJECT_DIR)"
1313

1414
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
1515
uname_R := $(shell sh -c 'uname -r 2>/dev/null || echo not')
@@ -177,10 +177,13 @@ GIT-GUI-BUILD-OPTIONS: FORCE
177177
git-gui--askpass: git-gui--askpass.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
178178
$(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS
179179

180+
git-gui--askyesno: git-gui--askyesno.sh GIT-GUI-BUILD-OPTIONS generate-script.sh
181+
$(QUIET_GEN)$(SHELL_PATH) generate-script.sh $@ $< ./GIT-GUI-BUILD-OPTIONS
182+
180183
ifdef GITGUI_WINDOWS_WRAPPER
181184
all:: git-gui
182185
endif
183-
all:: $(GITGUI_MAIN) git-gui--askpass lib/tclIndex $(ALL_MSGFILES)
186+
all:: $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex $(ALL_MSGFILES)
184187

185188
install: all
186189
$(QUIET)$(INSTALL_D0)'$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL_D1)
@@ -221,7 +224,7 @@ dist-version: GIT-VERSION-FILE
221224
@sed 's|^GITGUI_VERSION=||' <GIT-VERSION-FILE >$(TARDIR)/version
222225

223226
clean::
224-
$(RM_RF) $(GITGUI_MAIN) git-gui--askpass lib/tclIndex po/*.msg $(PO_TEMPLATE)
227+
$(RM_RF) $(GITGUI_MAIN) git-gui--askpass git-gui--askyesno lib/tclIndex po/*.msg $(PO_TEMPLATE)
225228
$(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
226229
ifdef GITGUI_WINDOWS_WRAPPER
227230
$(RM_RF) git-gui
File renamed without changes.

meson.build

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project('git-gui',
44

55
fs = import('fs')
66

7-
shell = find_program('sh')
7+
shell = find_program('/bin/sh', 'sh')
88
tclsh = find_program('tclsh')
99
wish = find_program('wish')
1010

@@ -34,6 +34,7 @@ version_file = custom_target(
3434
'@INPUT@',
3535
meson.current_source_dir(),
3636
'@OUTPUT@',
37+
get_option('parent_project_dir'),
3738
],
3839
build_always_stale: true,
3940
)
@@ -53,19 +54,21 @@ if target_machine.system() == 'windows'
5354
)
5455
endif
5556

56-
custom_target(
57-
output: 'git-gui--askpass',
58-
input: 'git-gui--askpass.sh',
59-
command: [
60-
shell,
61-
meson.current_source_dir() / 'generate-script.sh',
62-
'@OUTPUT@',
63-
'@INPUT@',
64-
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
65-
],
66-
install: true,
67-
install_dir: get_option('libexecdir') / 'git-core',
68-
)
57+
foreach script : [ 'git-gui--askpass', 'git-gui--askyesno' ]
58+
custom_target(
59+
output: script,
60+
input: script + '.sh',
61+
command: [
62+
shell,
63+
meson.current_source_dir() / 'generate-script.sh',
64+
'@OUTPUT@',
65+
'@INPUT@',
66+
meson.current_build_dir() / 'GIT-GUI-BUILD-OPTIONS',
67+
],
68+
install: true,
69+
install_dir: get_option('libexecdir') / 'git-core',
70+
)
71+
endforeach
6972

7073
custom_target(
7174
input: 'git-gui.sh',

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
option('parent_project_dir', type: 'string', value: '',
2+
description: 'The directory of the parent project. This is used so that the version can be determined even in case git-gui is included as a subtree.')

0 commit comments

Comments
 (0)