Merge branch 'js/enhanced-version-info'
"git version --build-options" learned to report the host CPU and the exact commit object name the binary was built from. * js/enhanced-version-info: version --build-options: report commit, too, if possible version --build-options: also report host CPU
This commit is contained in:
commit
58d1772c85
13
Makefile
13
Makefile
@ -425,6 +425,9 @@ all::
|
||||
#
|
||||
# to say "export LESS=FRX (and LV=-c) if the environment variable
|
||||
# LESS (and LV) is not set, respectively".
|
||||
#
|
||||
# When cross-compiling, define HOST_CPU as the canonical name of the CPU on
|
||||
# which the built Git will run (for instance "x86_64").
|
||||
|
||||
GIT-VERSION-FILE: FORCE
|
||||
@$(SHELL_PATH) ./GIT-VERSION-GEN
|
||||
@ -1099,6 +1102,12 @@ else
|
||||
BROKEN_PATH_FIX = '/^\# @@BROKEN_PATH_FIX@@$$/d'
|
||||
endif
|
||||
|
||||
ifeq (,$(HOST_CPU))
|
||||
BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(firstword $(subst -, ,$(uname_M)))\""
|
||||
else
|
||||
BASIC_CFLAGS += -DGIT_HOST_CPU="\"$(HOST_CPU)\""
|
||||
endif
|
||||
|
||||
ifneq (,$(INLINE))
|
||||
BASIC_CFLAGS += -Dinline=$(INLINE)
|
||||
endif
|
||||
@ -1897,7 +1906,9 @@ builtin/help.sp builtin/help.s builtin/help.o: EXTRA_CPPFLAGS = \
|
||||
version.sp version.s version.o: GIT-VERSION-FILE GIT-USER-AGENT
|
||||
version.sp version.s version.o: EXTRA_CPPFLAGS = \
|
||||
'-DGIT_VERSION="$(GIT_VERSION)"' \
|
||||
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)'
|
||||
'-DGIT_USER_AGENT=$(GIT_USER_AGENT_CQ_SQ)' \
|
||||
'-DGIT_BUILT_FROM_COMMIT="$(shell GIT_CEILING_DIRECTORIES=\"$(CURDIR)/..\" \
|
||||
git rev-parse -q --verify HEAD || :)"'
|
||||
|
||||
$(BUILT_INS): git$X
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && \
|
||||
|
6
help.c
6
help.c
@ -412,6 +412,12 @@ int cmd_version(int argc, const char **argv, const char *prefix)
|
||||
printf("git version %s\n", git_version_string);
|
||||
|
||||
if (build_options) {
|
||||
printf("cpu: %s\n", GIT_HOST_CPU);
|
||||
if (git_built_from_commit_string[0])
|
||||
printf("built from commit: %s\n",
|
||||
git_built_from_commit_string);
|
||||
else
|
||||
printf("no commit associated with this build\n");
|
||||
printf("sizeof-long: %d\n", (int)sizeof(long));
|
||||
/* NEEDSWORK: also save and output GIT-BUILD_OPTIONS? */
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "strbuf.h"
|
||||
|
||||
const char git_version_string[] = GIT_VERSION;
|
||||
const char git_built_from_commit_string[] = GIT_BUILT_FROM_COMMIT;
|
||||
|
||||
const char *git_user_agent(void)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user