Skip to content

Commit a7d9680

Browse files
vdyeldennington
authored andcommitted
Merge pull request microsoft#472 from vdye/ms/macos-build-options
Fixes for MacOS release build & build options
2 parents 8a6c060 + feb5f7a commit a7d9680

File tree

5 files changed

+25
-7
lines changed

5 files changed

+25
-7
lines changed

.github/workflows/build-git-installers.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,9 @@ jobs:
354354
cp git/git-$VERSION.tar.gz git/git-manpages-$VERSION.tar.gz git_osx_installer/build/ ||
355355
die "Could not copy .tar.gz files"
356356
357+
GIT_BUILT_FROM_COMMIT=$(gunzip -c git/git-$VERSION.tar.gz | git get-tar-commit-id) ||
358+
die "Could not determine commit for build"
359+
357360
# drop the -isysroot `GIT_SDK` hack
358361
sed -i .bak -e 's/ -isysroot .(SDK_PATH)//' git_osx_installer/Makefile || die "Could not drop the -isysroot hack"
359362
@@ -371,6 +374,7 @@ jobs:
371374
372375
PATH=/usr/local/bin:$PATH \
373376
make -C git_osx_installer \
377+
GIT_BUILT_FROM_COMMIT=$GIT_BUILT_FROM_COMMIT \
374378
OSX_VERSION=10.15 C_INCLUDE_PATH="$C_INCLUDE_PATH" V=1 image ||
375379
die "Build failed"
376380

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/fuzz-pack-headers
44
/fuzz-pack-idx
55
/GIT-BUILD-OPTIONS
6+
/GIT-BUILT-FROM-COMMIT
67
/GIT-CFLAGS
78
/GIT-LDFLAGS
89
/GIT-PREFIX

Makefile

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ all::
389389
# Define GIT_USER_AGENT if you want to change how git identifies itself during
390390
# network interactions. The default is "git/$(GIT_VERSION)".
391391
#
392+
# Define GIT_BUILT_FROM_COMMIT if you want to force the commit hash identified
393+
# in 'git version --build-options' to a specific value. The default is the
394+
# commit hash of the current HEAD.
395+
#
392396
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
393397
# (defaults to "man") if you want to have a different default when
394398
# "git help" is called without a parameter specifying the format.
@@ -2155,6 +2159,15 @@ GIT-USER-AGENT: FORCE
21552159
echo '$(GIT_USER_AGENT_SQ)' >GIT-USER-AGENT; \
21562160
fi
21572161

2162+
GIT_BUILT_FROM_COMMIT = $(eval GIT_BUILT_FROM_COMMIT := $$(shell \
2163+
GIT_CEILING_DIRECTORIES="$$(CURDIR)/.." \
2164+
git rev-parse -q --verify HEAD 2>/dev/null))$(GIT_BUILT_FROM_COMMIT)
2165+
GIT-BUILT-FROM-COMMIT: FORCE
2166+
@if test x'$(GIT_BUILT_FROM_COMMIT)' != x"`cat GIT-BUILT-FROM-COMMIT 2>/dev/null`" ; then \
2167+
echo >&2 " * new built-from commit"; \
2168+
echo '$(GIT_BUILT_FROM_COMMIT)' >GIT-BUILT-FROM-COMMIT; \
2169+
fi
2170+
21582171
ifdef DEFAULT_HELP_FORMAT
21592172
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
21602173
endif
@@ -2279,13 +2292,11 @@ PAGER_ENV_CQ_SQ = $(subst ','\'',$(PAGER_ENV_CQ))
22792292
pager.sp pager.s pager.o: EXTRA_CPPFLAGS = \
22802293
-DPAGER_ENV='$(PAGER_ENV_CQ_SQ)'
22812294

2282-
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
2295+
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT GIT-BUILT-FROM-COMMIT
22832296
version.sp version.s version.o: EXTRA_CPPFLAGS = \
22842297
'-DGIT_VERSION="$(GIT_VERSION)"' \
22852298
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
2286-
'-DGIT_BUILT_FROM_COMMIT="$(shell \
2287-
GIT_CEILING_DIRECTORIES="$(CURDIR)/.." \
2288-
git rev-parse -q --verify HEAD 2>/dev/null)"'
2299+
'-DGIT_BUILT_FROM_COMMIT="$(GIT_BUILT_FROM_COMMIT)"'
22892300

22902301
$(BUILT_INS): git$X
22912302
$(QUIET_BUILT_IN)$(RM) $@ && \
@@ -3307,7 +3318,7 @@ dist: git-archive$(X) configure
33073318
@$(MAKE) -C git-gui TARDIR=../.dist-tmp-dir/git-gui dist-version
33083319
./git-archive --format=tar \
33093320
$(GIT_ARCHIVE_EXTRA_FILES) \
3310-
--prefix=$(GIT_TARNAME)/ HEAD^{tree} > $(GIT_TARNAME).tar
3321+
--prefix=$(GIT_TARNAME)/ HEAD > $(GIT_TARNAME).tar
33113322
@$(RM) -r .dist-tmp-dir
33123323
gzip -f -9 $(GIT_TARNAME).tar
33133324

contrib/scalar/scalar.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,6 +939,8 @@ static int cmd_clone(int argc, const char **argv)
939939

940940
/* common-main already logs `argv` */
941941
trace2_def_repo(the_repository);
942+
trace2_data_intmax("scalar", the_repository, "unattended",
943+
is_unattended());
942944

943945
if (!branch && !(branch = remote_default_branch(url))) {
944946
res = error(_("failed to get default branch for '%s'"), url);

contrib/scalar/scalar.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ SYNOPSIS
99
--------
1010
[verse]
1111
scalar clone [--single-branch] [--branch <main-branch>] [--full-clone]
12-
[--local-cache-path <path>] [--cache-server-url <url>]
13-
<url> [<enlistment>]
12+
[--local-cache-path <path>] [--cache-server-url <url>]
13+
<url> [<enlistment>]
1414
scalar list
1515
scalar register [<enlistment>]
1616
scalar unregister [<enlistment>]

0 commit comments

Comments
 (0)