summaryrefslogtreecommitdiff
path: root/help.c
AgeCommit message (Collapse)Author
2008-02-25help: respect aliasesJeff King
If we have an alias "foo" defined, then the help text for "foo" (via "git help foo" or "git foo --help") now shows the definition of the alias. Before showing an alias definition, we make sure that there is no git command which would override the alias (so that even though you may have a "log" alias, even though it will not work, we don't want to it supersede "git help log"). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-25help: use parseoptJeff King
This patch converts cmd_help to use parseopt, along with a few style cleanups, including: - enum constants are now ALL_CAPS - parse_help_format returns an enum value rather than setting a global as a side effect Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-18help.c: use 'git_config_string' to get 'help_default_format'.Christian Couder
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-17Merge branch 'cc/browser'Junio C Hamano
* cc/browser: Documentation: add 'git-web--browse.txt' and simplify other docs. git-web--browse: fix misplaced quote in init_browser_path() web--browse: Add a few quotes in 'init_browser_path'. Documentation: instaweb: add 'git-web--browse' information. Adjust .gitignore for 5884f1(Rename 'git-help--browse.sh'...) git-web--browse: do not start the browser with nohup instaweb: use 'git-web--browse' to launch browser. Rename 'git-help--browse.sh' to 'git-web--browse.sh'. help--browse: add '--config' option to check a config option for a browser. help: make 'git-help--browse' usable outside 'git-help'. Conflicts: git-web--browse.sh
2008-02-11help.c: guard config parser from value=NULLJunio C Hamano
help.format configuration expects a string value Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-05Rename 'git-help--browse.sh' to 'git-web--browse.sh'.Christian Couder
Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-05help--browse: add '--config' option to check a config option for a browser.Christian Couder
The value of this new command line option will be used as a key to check the configuration for an help browser. This should remove the last bit in 'git-help--browse' that was specific to 'git-help', so that other git command can use 'git-help--browse'. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-02-05help: make 'git-help--browse' usable outside 'git-help'.Christian Couder
"git-help--browse" helper is to launch a browser of the user's choice to view the HTML version of git documentation for a given command. It used to take the name of a command, convert it to the path of the documentation by prefixing the directory name and appending the ".html" suffix, and start the browser on the path. This updates the division of labor between the caller in help.c and git-help--browser helper. The helper is now responsible for launching a browser of the user's choice on given URLs, and it is the caller's responsibility to tell it the paths to documentation files. This is in preparation to reuse the logic to choose user's preferred browser in instaweb. The helper had a provision for running it without any command name, in which case it showed the toplevel "git(7)" documentation, but the caller in help.c never makes such a call. The helper now exits with a usage message when no path is given. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-16rename git-browse--help to git-help--browseJeff King
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-15Rename git-browse-help helper to git-browse--helpJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-15git-help: add "help.format" config variable.Christian Couder
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-10git-help -i: show info documentation from matching version of gitJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10git-help -i: invoke info with document and node nameJunio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-12-10Merge branch 'master' into cc/helpJunio C Hamano
This is to primarily pull in MANPATH tweak and help.txt formatting fix from the master branch.
2007-12-09git-help: add -w|--web option to display html man page in a browser.Christian Couder
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-08Let git-help prefer man-pages installed with this version of gitSergei Organov
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-04git-help: add -i|--info option to display info page.Christian Couder
"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-02Merge branch 'tt/help'Junio C Hamano
* tt/help: Remove hint to use "git help -a" Make the list of common commands more exclusive
2007-11-14Move #include <sys/select.h> and <sys/ioctl.h> to git-compat-util.h.Johannes Sixt
... 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-14Remove hint to use "git help -a"Theodore Ts'o
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-08Style: place opening brace of a function definition at column 1Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-30include $PATH in generating list of commands for "help -a"Scott R Parish
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-30list_commands(): simplify code by using chdir()Scott R Parish
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-30remove unused/unneeded "pattern" argument of list_commandsScott R Parish
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-30"git" returns 1; "git help" and "git help -a" return 0Scott R Parish
Signed-off-by: Scott R Parish <srp@srparish.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-27help: remove extra blank line after "See 'git --help'" messageJunio C Hamano
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-22On error, do not list all commands, but point to --help optionJari Aalto
- 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-06-07War on whitespaceJunio C Hamano
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-03-27use xrealloc in help.cJames Bowes
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-03-26use xmalloc in git.c and help.cJames Bowes
Signed-off-by: James Bowes <jbowes@dangerouslyinc.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-02-21Mechanical conversion to use prefixcmp()Junio C Hamano
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-11Avoid ugly linewrap in git helpRen,bi(B Scharfe
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>
2006-12-20simplify inclusion of system header files.Junio C Hamano
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-08-31Use xmalloc instead of mallocJonas Fonseca
Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-08-16remove unnecessary initializationsDavid Rientjes
[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-13Merge branch 'mk/rename'Junio C Hamano
2006-08-10Merge branch 'master' into mk/renameJunio C Hamano
* master: git-verify-pack: no need to count errors git-verify-pack: buffer overrun paranoia git-verify-pack: free pack after use and a cleanup git-verify-pack: get rid of while loop git-verify-pack: insist on .idx extension git-verify-pack: more careful path handling git-verify-pack: show usage when no pack was specified Add has_extension() builtin-apply: remove unused increment Fix git-diff A...B combine-diff: use color git-apply: applying a patch to make a symlink shorter. allow diff.renamelimit to be set regardless of -M/-C make --find-copies-harder imply -C find_unique_abbrev() with len=0 should not abbreviate check return value from diff_setup_done() Fix tutorial-2.html Documentation: git-status takes the same options as git-commit Update git-init-db(1) and documentation of core.sharedRepository
2006-08-04builtins: Makefile clean-upJunio C Hamano
This cleans up the build procedure for built-in commands by: - generating mostly redundant definition of BUILT_INS from BUILTIN_OBJS in the Makefile, - renaming a few files to make the above possible, and - sorting the built-in command table in git.c. It might be a good idea to binary search (or perfect hash) the built-in command table, but that can be done later when somebody feels like. Signed-off-by: Junio C Hamano <junkio@cox.net>