Commit Graph

53 Commits

Author SHA1 Message Date
Steffen Prohaska
301de2ab75 help (mingw): Cleaned up whitespace indentation
The separate block for the ShellExecute code is no longer
needed and therefore cleand up.

Also included is minor rewording of the error message if
the HTML page is not found.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-12-30 14:06:02 +01:00
Steffen Prohaska
95da27bdde Merge commit 'mingw/master' into work/merge-mingw
Conflicts:

	help.c
2007-12-21 08:20:13 +01:00
Jeff King
d7e522cffb rename git-browse--help to git-help--browse
The convention for helper scripts has been
git-$TOOL--$HELPER. Since this is a "browse" helper for the
"help" tool, git-help--browse is a more sensible name.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16 12:52:40 -08:00
Junio C Hamano
5b4617c749 Rename git-browse-help helper to git-browse--help
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 22:04:43 -08:00
Christian Couder
70087cdbd3 git-help: add "help.format" config variable.
This config variable makes it possible to choose the default format
used to display help. This format will be used only if no option
like -a|--all|-i|--info|-m|--man|-w|--web is passed to "git-help".

The following values are possible for this variable:

	- "man"  --> "man" program is used
	- "info" --> "info" program is used
	- "web"  --> "git-browse-help" is used

By default we still show help using "man".

This patch also adds -m|--man command line option to use "man"
to allow overriding the "help.format" configuration variable.

Note that this patch also revert some recent changes in
"git-browse-help" because they prevented to look for config
variables in the global configuration file.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-14 21:58:35 -08:00
Steffen Prohaska
7b25739391 Merge commit 'mingw/master' into work/merge-mingw
Conflicts:

	Makefile
	help.c
	  moved msysgit specific code to show_html_page
	  and call show_html_page per default.
2007-12-13 22:38:05 +01:00
Junio C Hamano
a149a1a44a git-help -i: show info documentation from matching version of git
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 01:36:31 -08:00
Junio C Hamano
78d39f98f3 git-help -i: invoke info with document and node name
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10 01:36:31 -08:00
Junio C Hamano
7be2b6e02b Merge branch 'master' into cc/help
This is to primarily pull in MANPATH tweak and help.txt formatting fix
from the master branch.
2007-12-10 01:22:42 -08:00
Christian Couder
5d6491c7c7 git-help: add -w|--web option to display html man page in a browser.
Now when using "git help -w cmd", we will try to show the HTML man
page "git-cmd.html" in your prefered web browser.

To do that "help.c" code will call a new shell script
"git-browse-help".

This currently works only if the HTML versions of the man page
have been installed in $(htmldir) (typically "/usr/share/doc/git-doc"),
so new target to do that is added to "Documentation/Makefile".

The browser to use can be configured using the "web.browser"
config variable.

We try to open a new tab in an existing web browser, if possible.

The code in "git-browse-help" is heavily stolen from "git-mergetool"
by Theodore Y. Ts'o. Thanks.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-09 01:19:44 -08:00
Sergei Organov
8e566f24b3 Let git-help prefer man-pages installed with this version of git
Prepend $(prefix)/share/man to the MANPATH environment variable before
invoking 'man' from help.c:show_man_page().  There may be other git
documentation in the user's MANPATH but the user is asking a specific
instance of git about its own documentation, so we'd better show the
documentation for _that_ instance of git.

Signed-off-by: Sergei Organov <osv@javad.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-08 02:50:54 -08:00
Steffen Prohaska
9467c5ac39 Merge commit 'mingw/master' into work/merge-mingw
Conflicts:

	Makefile
	git-compat-util.h
2007-12-07 00:45:00 +01:00
Christian Couder
df55c9cbc3 git-help: add -i|--info option to display info page.
"git help --info subcommand" will now call "info git-subcommand".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-03 22:15:05 -08:00
Junio C Hamano
8256c6e010 Merge branch 'tt/help'
* tt/help:
  Remove hint to use "git help -a"
  Make the list of common commands more exclusive
2007-12-01 20:05:49 -08:00
Steffen Prohaska
424e2045aa help (mingw): Avoid current working directory when displaying html help
We should specify a working directory to ShellExecute for the
following reason.  ShellExecute uses the current working
directory if not told otherwise.  html.c did not override this
default.  Therefore the current working directory was in use as
long as the browser displaying the HTML help was open.  As long
as a directory is in use, it can't be deleted.

This commit changes help.c to avoid this problem.  The HTML
browser is launched in the root directory "\\".

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-25 17:49:19 +01:00
Steffen Prohaska
e9d8b9207e help: search html documentation relativ to git_exec_dir()
Global gitconfig and templates are searched relativ
to git_exec_dir() to make the installation relocatable.

This commit changes help to do the same for finding
the html documentation.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-18 12:09:42 +01:00
Steffen Prohaska
fcdd78c3c3 Merge commit 'mingw/master' into work/merge-mingw-master
Conflicts:

	git-compat-util.h
	help.c
	pager.c

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-17 12:17:45 +01:00
Steffen Prohaska
16df3f7e4c Merge commit 'mingw/master' into work/merge-mingw-master
Remove getpagesize() from sha1_file.c because is it now
included in git-compat-util.h.

Conflicts:

	Makefile
	compat/mingw.c
	git-compat-util.h

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-16 07:33:14 +01:00
Johannes Sixt
80bbe72b76 Move #include <sys/select.h> and <sys/ioctl.h> to git-compat-util.h.
... since all system headers are pulled in via git-compat-util.h

Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 15:18:39 -08:00
Theodore Ts'o
15f80a539b Remove hint to use "git help -a"
The newbie user will run away screaming when they see all possible
commands.  The expert user will already know about the -a option from
reading the git man page.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-14 14:46:18 -08:00
Johannes Sixt
1c01d23a86 Merge branch 'master' of git://repo.or.cz/alt-git 2007-11-11 20:14:20 +01:00
Steffen Prohaska
9dcfde61ed help: Teach help to try harder to locate help
Help now tries to takes the argument as is and prefixed
with "git-". If no html page is found an error is
reported.

With this change you can run "git help user-manual".

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-11 17:55:52 +01:00
Junio C Hamano
f3fa183802 Style: place opening brace of a function definition at column 1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-08 15:35:32 -08:00
Steffen Prohaska
69cadd4e60 Merge commit 'mingw/master' into msysgit/merge-mingw-v2
Conflicts:

	Makefile
	RelNotes
	builtin-ls-files.c
	builtin-tag.c
	cache.h
	compat/mingw.c
	config.c
	connect.c
	cpio.sh
	diff.c
	exec_cmd.c
	git-gui/Makefile
	git-gui/lib/commit.tcl
	git-gui/lib/console.tcl
	git-mergetool.sh
	lockfile.c
	path.c
	rsh.c
	run-command.c
	setup.c
	show-index.c
	spawn-pipe.c
	t/Makefile
	t/t0000-basic.sh
	t/t1300-repo-config.sh
	t/t7501-commit.sh
	t/test-lib.sh

    Resolve as follows
    --- Makefile
    - mingw/devel removes
        SHELL_PATH = /bin/sh
        PERL_PATH = /bin/perl

    This looks ok. Both are set early in the Makefile to sensible values.
    mingw accepts to execute /usr/bin/perl.

    - NO_SYMLINKS is no longer needed. Should be auto-detected.

    - According to our 0e2bdc35af
      we want

    NO_R_TO_GCC_LINKER = YesPlease

      take our before their change.

    - Conflict prefix, SCRIPT_SH:
    our 7999f434d7 set prefix =
    their 4a7c98dbaf removes cpio emulator

    resolve to achieve both.

    - Conflict NO_MEMMEM, THREADED_DELTA_SEARCH: take theirs

    --- RelNotes
    take our: removed file

    --- builtin-ls-files.c
    Conflict write_name_quoted: take their change.

    --- builtin-tag.c
    Conflict strip CR

    our 7734ad404c adds strip CR
    their fd17f5b5f7 modifies code to use strbuf

    resolve by removing our code. TODO: we probably need a replacement?

    --- cache.h
    Conflict is_absolute_path()
    our ef5af72062 ifdef
    their 637fc51696 ifndef
    both achieve the same.

    our is a bit more strict but we take their code because we want
    to reduce differences to mingw.

    --- compat/mingw.c
    Conflict at end of file:
    our 194c1dbb5a adds git_exit()

    resolve by taking their first, followed by our.

    --- config.c
    Conflict 'fd ='
    our 0a453a237e merge junio/master
    introduced strange 'fd ='. Resolve by removing 'fd ='.

    --- connect.c
    - Conflict 'host must have at least 2 chars ...' take their code.

    - git_connect(): take their implementation.

    --- cpio.sh
    Accepted their delete file.

    --- diff.c
    Resolve using their implementation.

    --- exec_cmd.c
    Resolve using their implementation.

    --- git-gui/**
    Resolve using our implementation.

    --- git-mergetool.sh
    Resolve using their implementation

    --- lockfile.c
    trivial resolution (empty line removed)

    --- path.c
    Conflict 'tmp': accepting their implementation, trying TMP, TEMP on all platforms.

    --- rsh.c
    Accept their delete file.

    --- run-command.c
    Resolve using their implementation

    --- setup.c
    Resolve using their implementation

    --- show-index.c
    Conflict PRIuMAX
    our 89697a4c15 fix warning
    their 5be507fc95 PRIuMAX

    resolve fixing warning in their code.

    --- spawn-pipe.c
    Conflict environ vs lookup_prog: resolve taking neither

    --- t/Makefile
    our d1f83218dc --no-hardlinks
    their c603988c10 automtically detect symlink support

    Resolve using our --no-hardlinks but removing --no-symlinks.

    --- t/0000-basic.sh
    Resolve using their implementation.

    --- t/t1300-repo-config.sh
    Resolve using their implementation.

    --- t/t7501-commit.sh
    Resolve using their implementation.

    --- t/test-lib.sh
    our d1f83218dc --no-hardlink
    their c603988c10 automatically detect symlink support

    Resolve using our --no-hardlinks but removing --no-symlinks.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-11-05 21:55:44 +01:00
Johannes Sixt
fe77ba9245 Merge branch 'master' of git://repo.or.cz/alt-git.git 2007-11-02 21:31:48 +01:00
Scott R Parish
1eb056905a include $PATH in generating list of commands for "help -a"
Git had previously been using the $PATH for scripts--a previous
patch moved exec'ed commands to also use the $PATH. For consistency
"help -a" should also list commands in the $PATH.

The main commands are still listed from the git_exec_path(), but
the $PATH is walked and other git commands (probably extensions) are
listed.

Signed-off-by: Scott R Parish <srp@srparish.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-29 20:51:37 -07:00
Scott R Parish
0966003c8e list_commands(): simplify code by using chdir()
The current code builds absolute path strings for each file to
stat(), this can easily be avoided by chdir()ing into the directory.

Signed-off-by: Scott R Parish <srp@srparish.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-29 20:51:37 -07:00
Scott R Parish
edb6ddc53e remove unused/unneeded "pattern" argument of list_commands
list_commands() currently accepts and ignores a "pattern" argument,
and then hard codes a prefix as well as some magic numbers. This
hardcodes the prefix inside of the function and removes the magic
numbers.

Signed-off-by: Scott R Parish <srp@srparish.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-29 20:51:37 -07:00
Scott R Parish
3d7e2d857a "git" returns 1; "git help" and "git help -a" return 0
Signed-off-by: Scott R Parish <srp@srparish.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-29 20:51:36 -07:00
Steffen Prohaska
4d2a9e8f60 refactor help.c to git_install_prefix() and make_native_separator()
git_install_prefix() returns the install prefix of msysgit. For
all other architectures it returns "". The path returned contains
slashes.

make_native_separator() takes a unix path (slashes) and converts
the separators in place. On Windows slashes are converted to
backslashes.

All the code was available in help.c and is now moved to path.c.

The new function will be used to located the templates and /etc/gitconfig.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-10-27 11:08:20 +02:00
Junio C Hamano
a238917ba4 help: remove extra blank line after "See 'git --help'" message
The double LF were there only because we gave a list of common
commands.  WIth the list gone, there is no reason to have the
extra blank line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-26 23:26:41 -07:00
Jari Aalto
b5d21a4b68 On error, do not list all commands, but point to --help option
- Remove out call to list_common_cmds_help()
- Send error message to stderr, not stdout.

Signed-off-by: Jari Aalto <jari.aalto@cante.net>
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
2007-10-22 01:57:50 -04:00
Steffen Prohaska
ded3d5f496 help (msysgit): add comment about assumption on _pgmptr 2007-10-04 07:45:31 +02:00
Steffen Prohaska
fc98ff0830 help (msysgit): beautify message telling user that HTML will be display
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-10-02 23:02:11 +02:00
Steffen Prohaska
65230e232c help (msysgit): fix locating html help for paths with spaces
Derive the git installation dir from the executable path
and directly use the Win32 API to open the HTML file. This
avoids the mingw layer and command line escaping problems,
which caused the previous implementation to fail if spaces
were contained in the path to git.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-10-02 23:01:05 +02:00
Steffen Prohaska
803d403a73 help (msysgit): print message telling the user that browser is launched
git doesn't wait until the browser is launched but returns
immediatly. A user may feel more comfortable if he knows
that eventually the help will appear.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-10-01 07:27:20 +02:00
Steffen Prohaska
57bab054a9 help (msysgit): teach git help to open html from /doc/git/html/
Html pages will be opened using the default Windows application
configured for html. This code path is taken for msysgit (mingw).

It is assumed that html pages are installed at /doc/git/html.
This needs to be ensured by the msysgit superproject to make this
patch useful. html pages should be cloned from git.git's main
repo. This is the easiest way to get up-to-date documentation,
without requiring the complete tool chain to generate them
locally.

If html pages are not yet there, you can use the following
commands to get them:

    mkdir -p /doc/git/html
    cd /doc/git/html/
    git init
    git config remote.origin.url git://git.kernel.org/pub/scm/git/git.git
    git config remote.origin.fetch refs/heads/html:refs/remotes/origin/html
    git fetch
    git checkout --track -b html origin/html

and update the html documentation with

    git pull

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
2007-08-12 16:08:57 -07:00
Johannes Sixt
91a4c3a6dd Merge commit '952c8c56380734d45bddf369fe478895672c5a3a' 2007-07-21 16:51:27 +02:00
Junio C Hamano
a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Johannes Sixt
d34a3a1a61 Merge commit 'v1.5.1' 2007-04-06 16:29:46 +02:00
James Bowes
c6e0caa384 use xrealloc in help.c
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-27 16:57:57 -07:00
James Bowes
3301521a25 use xmalloc in git.c and help.c
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-25 18:00:23 -07:00
Johannes Sixt
d5f1c1bbc0 Merge with git://repo.or.cz/git.git#master 2007-02-27 16:15:36 +01:00
Junio C Hamano
cc44c7655f Mechanical conversion to use prefixcmp()
This mechanically converts strncmp() to use prefixcmp(), but only when
the parameters match specific patterns, so that they can be verified
easily.  Leftover from this will be fixed in a separate step, including
idiotic conversions like

    if (!strncmp("foo", arg, 3))

  =>

    if (!(-prefixcmp(arg, "foo")))

This was done by using this script in px.perl

   #!/usr/bin/perl -i.bak -p
   if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) {
           s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|;
   }
   if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) {
           s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|;
   }

and running:

   $ git grep -l strncmp -- '*.c' | xargs perl px.perl

Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-20 22:03:15 -08:00
Johannes Sixt
e1ee0c0e20 Merge v1.5.0. 2007-02-15 12:19:52 +01:00
Ren,bi(B Scharfe
4f75b115d7 Avoid ugly linewrap in git help
Some of the short help texts that are shown e.g. when running 'git'
without any parameters wrap on a 80-column terminal.  They are just
one character over the line.  This patch avoids it by decreasing the
number of spaces around the preceding command name from four to
three (on both sides for symmetry).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-11 12:42:01 -08:00
Johannes Sixt
14cd939112 Make git compile under MinGW.
These changes are courtesy Johannes Schindelin.
2007-01-19 16:21:41 +01:00
Junio C Hamano
85023577a8 simplify inclusion of system header files.
This is a mechanical clean-up of the way *.c files include
system header files.

 (1) sources under compat/, platform sha-1 implementations, and
     xdelta code are exempt from the following rules;

 (2) the first #include must be "git-compat-util.h" or one of
     our own header file that includes it first (e.g. config.h,
     builtin.h, pkt-line.h);

 (3) system headers that are included in "git-compat-util.h"
     need not be included in individual C source files.

 (4) "git-compat-util.h" does not have to include subsystem
     specific header files (e.g. expat.h).

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-12-20 09:51:35 -08:00
Jonas Fonseca
2d7320d0b0 Use xmalloc instead of malloc
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-31 16:24:39 -07:00
David Rientjes
96f1e58f52 remove unnecessary initializations
[jc: I needed to hand merge the changes to the updated codebase,
 so the result needs to be checked.]

Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-15 21:22:20 -07:00