Skip to content

Commit a88d7aa

Browse files
committed
Merge branch 'vr/help-per-platform'
We used to always default to "man" format even on platforms where "man" viewer is not widely available. * vr/help-per-platform: help: use HTML as the default help format on Windows
2 parents 1966bab + 1cc8af0 commit a88d7aa

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ all::
299299
#
300300
# Define GIT_USER_AGENT if you want to change how git identifies itself during
301301
# network interactions. The default is "git/$(GIT_VERSION)".
302+
#
303+
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
304+
# (defaults to "man") if you want to have a different default when
305+
# "git help" is called without a parameter specifying the format.
302306

303307
GIT-VERSION-FILE: FORCE
304308
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -1242,6 +1246,7 @@ ifeq ($(uname_S),Windows)
12421246
BLK_SHA1 = YesPlease
12431247
NO_POSIX_GOODIES = UnfortunatelyYes
12441248
NATIVE_CRLF = YesPlease
1249+
DEFAULT_HELP_FORMAT = html
12451250

12461251
CC = compat/vcbuild/scripts/clink.pl
12471252
AR = compat/vcbuild/scripts/lib.pl
@@ -1926,6 +1931,10 @@ GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
19261931
GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
19271932
BASIC_CFLAGS += -DGIT_USER_AGENT='$(GIT_USER_AGENT_CQ_SQ)'
19281933

1934+
ifdef DEFAULT_HELP_FORMAT
1935+
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
1936+
endif
1937+
19291938
ALL_CFLAGS += $(BASIC_CFLAGS)
19301939
ALL_LDFLAGS += $(BASIC_LDFLAGS)
19311940

builtin/help.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
#include "column.h"
1313
#include "help.h"
1414

15+
#ifndef DEFAULT_HELP_FORMAT
16+
#define DEFAULT_HELP_FORMAT "man"
17+
#endif
18+
1519
static struct man_viewer_list {
1620
struct man_viewer_list *next;
1721
char name[FLEX_ARRAY];
@@ -445,7 +449,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
445449
setup_git_directory_gently(&nongit);
446450
git_config(git_help_config, NULL);
447451

448-
if (parsed_help_format != HELP_FORMAT_NONE)
452+
if (parsed_help_format == HELP_FORMAT_NONE)
453+
help_format = parse_help_format(DEFAULT_HELP_FORMAT);
454+
else
449455
help_format = parsed_help_format;
450456

451457
alias = alias_lookup(argv[0]);

0 commit comments

Comments
 (0)