Skip to content

Commit 44b0068

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 d26c8dd + e1e791a commit 44b0068

File tree

7 files changed

+26
-55
lines changed

7 files changed

+26
-55
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

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
`microsoft/git` and the Scalar CLI
22
==================================
33

4-
[![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/microsoft/git)
5-
[![Build status](https://github.com/microsoft/git/workflows/CI/badge.svg)](https://github.com/microsoft/git/actions/workflows/main.yml)
4+
[![CI/PR](https://github.com/microsoft/git/actions/workflows/main.yml/badge.svg)](https://github.com/microsoft/git/actions/workflows/main.yml)
5+
[![CI](https://github.com/microsoft/git/actions/workflows/main.yml/badge.svg)](https://github.com/microsoft/git/actions/workflows/main.yml)
66

77
This is `microsoft/git`, a special Git distribution to support monorepo scenarios. If you are _not_
88
working in a monorepo, you are likely searching for

contrib/scalar/t/t9099-scalar.sh

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,6 @@ test_expect_success 'scalar unregister' '
5050
! grep -F "$(pwd)/vanish/src" scalar.repos
5151
'
5252

53-
<<<<<<< HEAD
54-
test_expect_success 'set up repository to clone' '
55-
test_commit first &&
56-
test_commit second &&
57-
test_commit third &&
58-
git switch -c parallel first &&
59-
mkdir -p 1/2 &&
60-
test_commit 1/2/3 &&
61-
git config uploadPack.allowFilter true &&
62-
git config uploadPack.allowAnySHA1InWant true
63-
||||||| parent of 0a71491f41 (scalar: test `scalar clone`)
64-
test_expect_success '`scalar register` & `unregister` with existing repo' '
65-
git init existing &&
66-
scalar register existing &&
67-
git config --get --global --fixed-value \
68-
maintenance.repo "$(pwd)/existing" &&
69-
scalar list >scalar.repos &&
70-
grep -F "$(pwd)/existing" scalar.repos &&
71-
scalar unregister existing &&
72-
test_must_fail git config --get --global --fixed-value \
73-
maintenance.repo "$(pwd)/existing" &&
74-
scalar list >scalar.repos &&
75-
! grep -F "$(pwd)/existing" scalar.repos
76-
=======
7753
test_expect_success 'set up repository to clone' '
7854
test_commit first &&
7955
test_commit second &&
@@ -115,29 +91,6 @@ test_expect_success '`scalar register` & `unregister` with existing repo' '
11591
maintenance.repo "$(pwd)/existing" &&
11692
scalar list >scalar.repos &&
11793
! grep -F "$(pwd)/existing" scalar.repos
118-
>>>>>>> 0a71491f41 (scalar: test `scalar clone`)
119-
'
120-
121-
test_expect_success 'scalar clone' '
122-
second=$(git rev-parse --verify second:second.t) &&
123-
scalar clone "file://$(pwd)" cloned --single-branch &&
124-
(
125-
cd cloned/src &&
126-
127-
git config --get --global --fixed-value maintenance.repo \
128-
"$(pwd)" &&
129-
130-
git for-each-ref --format="%(refname)" refs/remotes/origin/ >actual &&
131-
echo "refs/remotes/origin/parallel" >expect &&
132-
test_cmp expect actual &&
133-
134-
test_path_is_missing 1/2 &&
135-
test_must_fail git rev-list --missing=print $second &&
136-
git rev-list $second &&
137-
git cat-file blob $second >actual &&
138-
echo "second" >expect &&
139-
test_cmp expect actual
140-
)
14194
'
14295

14396
SQ="'"

run-command.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,8 @@ int run_hook_strvec(const char *const *env, const char *name,
13301330

13311331
strvec_push(&hook.args, p);
13321332
strvec_pushv(&hook.args, argv->v);
1333+
if (env)
1334+
strvec_pushv(&hook.env_array, (const char **)env);
13331335
hook.no_stdin = 1;
13341336
hook.trace2_hook_name = name;
13351337

t/helper/test-gvfs-protocol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1747,7 +1747,7 @@ static void handle(int incoming, struct sockaddr *addr, socklen_t addrlen)
17471747
mayhem_child++);
17481748
}
17491749

1750-
cld.argv = cld_argv.v;
1750+
strvec_pushv(&cld.args, cld_argv.v);
17511751
cld.in = incoming;
17521752
cld.out = dup(incoming);
17531753

0 commit comments

Comments
 (0)