Skip to content

Commit

Permalink
Merge branch 'vr/help-per-platform'
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Jun 21, 2012
2 parents 1966bab + 1cc8af0 commit a88d7aa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ all::
#
# Define GIT_USER_AGENT if you want to change how git identifies itself during
# network interactions. The default is "git/$(GIT_VERSION)".
#
# Define DEFAULT_HELP_FORMAT to "man", "info" or "html"
# (defaults to "man") if you want to have a different default when
# "git help" is called without a parameter specifying the format.

GIT-VERSION-FILE: FORCE
@$(SHELL_PATH) ./GIT-VERSION-GEN
Expand Down Expand Up @@ -1242,6 +1246,7 @@ ifeq ($(uname_S),Windows)
BLK_SHA1 = YesPlease
NO_POSIX_GOODIES = UnfortunatelyYes
NATIVE_CRLF = YesPlease
DEFAULT_HELP_FORMAT = html

CC = compat/vcbuild/scripts/clink.pl
AR = compat/vcbuild/scripts/lib.pl
Expand Down Expand Up @@ -1926,6 +1931,10 @@ GIT_USER_AGENT_CQ = "$(subst ",\",$(subst \,\\,$(GIT_USER_AGENT)))"
GIT_USER_AGENT_CQ_SQ = $(subst ','\'',$(GIT_USER_AGENT_CQ))
BASIC_CFLAGS += -DGIT_USER_AGENT='$(GIT_USER_AGENT_CQ_SQ)'

ifdef DEFAULT_HELP_FORMAT
BASIC_CFLAGS += -DDEFAULT_HELP_FORMAT='"$(DEFAULT_HELP_FORMAT)"'
endif

ALL_CFLAGS += $(BASIC_CFLAGS)
ALL_LDFLAGS += $(BASIC_LDFLAGS)

Expand Down
8 changes: 7 additions & 1 deletion builtin/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include "column.h"
#include "help.h"

#ifndef DEFAULT_HELP_FORMAT
#define DEFAULT_HELP_FORMAT "man"
#endif

static struct man_viewer_list {
struct man_viewer_list *next;
char name[FLEX_ARRAY];
Expand Down Expand Up @@ -445,7 +449,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
setup_git_directory_gently(&nongit);
git_config(git_help_config, NULL);

if (parsed_help_format != HELP_FORMAT_NONE)
if (parsed_help_format == HELP_FORMAT_NONE)
help_format = parse_help_format(DEFAULT_HELP_FORMAT);
else
help_format = parsed_help_format;

alias = alias_lookup(argv[0]);
Expand Down

0 comments on commit a88d7aa

Please sign in to comment.