aboutsummaryrefslogtreecommitdiff
path: root/builtin-help.c
Commit message (Collapse)AuthorAge
* help: fix configured help format taking over command line oneChristian Couder2010-01-09
| | | | | | | | | | Since commit 7c3baa9 (help -a: do not unnecessarily look for a repository, 2009-09-04), the help format that is passed as a command line option is not used if an help format has been configured. This patch fixes that. Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* help: Do not unnecessarily look for a repositoryDavid Aguilar2009-12-01
| | | | | | | | | | | | | | Although 'git help' actually doesn't need to be run inside a git repository and uses no repository-specific information, it looks for a git directory. Searching for a git directory can be annoying in auto-mount environments. With this commit, 'git help' no longer searches for a repository when run without any options. 7c3baa9 originally modified 'git help -a' to not require a repository. This applies the same fix for 'git help'. Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* help -a: do not unnecessarily look for a repositoryJohannes Schindelin2009-10-28
| | | | | | | | | | | | | | | Although 'git help -a' actually doesn't need to be run inside a git repository and uses no repository-specific information, it looks for a git directory. On 'git <TAB><TAB>' the bash completion runs 'git help -a' and unnecessary searching for a git directory can be annoying in auto-mount environments. With this commit, 'git help' no longer searches for a repository when run with the -a option. Reported by Vincent Danjean through http://bugs.debian.org/539273 Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* help -i: properly error out if no info viewer can be foundGerrit Pape2009-10-27
| | | | | | | | | | | With this commit, git help -i <cmd> prints an error message and exits non-zero instead of being silent and exit code 0. Reported by Trent W. Buck through http://bugs.debian.org/537664 Signed-off-by: Gerrit Pape <pape@smarden.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix various sparse warnings in the git source codeLinus Torvalds2009-06-20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a few remaining ones, but this fixes the trivial ones. It boils down to two main issues that sparse complains about: - warning: Using plain integer as NULL pointer Sparse doesn't like you using '0' instead of 'NULL'. For various good reasons, not the least of which is just the visual confusion. A NULL pointer is not an integer, and that whole "0 works as NULL" is a historical accident and not very pretty. A few of these remain: zlib is a total mess, and Z_NULL is just a 0. I didn't touch those. - warning: symbol 'xyz' was not declared. Should it be static? Sparse wants to see declarations for any functions you export. A lack of a declaration tends to mean that you should either add one, or you should mark the function 'static' to show that it's in file scope. A few of these remain: I only did the ones that should obviously just be made static. That 'wt_status_submodule_summary' one is debatable. It has a few related flags (like 'wt_status_use_color') which _are_ declared, and are used by builtin-commit.c. So maybe we'd like to export it at some point, but it's not declared now, and not used outside of that file, so 'static' it is in this patch. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Simplify some 'fprintf(stderr); return -1;' by using 'return error()'Johannes Sixt2009-06-09
| | | | | Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* parse-opts: prepare for OPT_FILENAMEStephen Boyd2009-05-25
| | | | | | | | | | To give OPT_FILENAME the prefix, we pass the prefix to parse_options() which passes the prefix to parse_options_start() which sets the prefix member of parse_opts_ctx accordingly. If there isn't a prefix in the calling context, passing NULL will suffice. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Fix a bunch of pointer declarations (codestyle)Felipe Contreras2009-05-01
| | | | | | | Essentially; s/type* /type */ as per the coding guidelines. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtin-help: silently tolerate unknown keysJohannes Sixt2009-04-24
| | | | | | | | | | | | | | | | | | | | | If for some reason the config file contains a key without a subkey like [man] foo = bar then even a plain git help produces an error message. With this patch such an entry is ignored. Additionally, the warning about unknown sub-keys is removed. It could become annoying if new sub-keys are introduced in the future, and then the configuration is read by an old version of git that does not know about it. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Move computation of absolute paths from Makefile to runtime (in preparation ↵Steffen Prohaska2009-01-26
| | | | | | | | | | | | | | | | | | | for RUNTIME_PREFIX) This commit prepares the Makefile for relocatable binaries (called RUNTIME_PREFIX). Such binaries will be able to be moved together with the system configuration files to a different directory, requiring to compute the prefix at runtime. In a first step, we make all paths relative in the Makefile and teach system_path() to add the prefix instead. We used to compute absolute paths in the Makefile and passed them to C as defines. We now pass relative paths to C and call system_path() to add the prefix at runtime. Signed-off-by: Steffen Prohaska <prohaska@zib.de> Acked-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Replace calls to strbuf_init(&foo, 0) with STRBUF_INIT initializerBrandon Casey2008-10-12
| | | | | | | | | | | Many call sites use strbuf_init(&foo, 0) to initialize local strbuf variable "foo" which has not been accessed since its declaration. These can be replaced with a static initialization using the STRBUF_INIT macro which is just as readable, saves a function call, and takes up fewer lines. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
* builtin-help: fallback to GIT_MAN_VIEWER before manRomain Francoise2008-08-29
| | | | | | | | | In some situations it is useful to be able to switch viewers via the environment, e.g. in Emacs shell buffers. So check the GIT_MAN_VIEWER environment variable and try it before falling back to "man". Signed-off-by: Romain Francoise <romain@orebokech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Make main_cmds and other_cmds local to builtin-help.cAlex Riesen2008-08-28
| | | | | | | These are not used anywhere else. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Remove calculation of the longest command name from where it is not usedAlex Riesen2008-08-28
| | | | | | | | | Just calculate it where it is needed - it is cheap and trivial, as all the lengths are already there (stored when creating the command lists). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Builtin git-help.Miklos Vajna2008-08-02
| | | | | | | | | | | | This patch splits out git-help's functions to builtin-help.c and leaves only functions used by other builtins in help.c. First this removes git-help's functions from libgit which are not interesting for other builtins, second this makes 'git help help' work again. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* builtins: Makefile clean-upJunio C Hamano2006-08-04
| | | | | | | | | | | | | | 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>
* Remove cmd_usage() routine and re-organize the help/usage code.Ramsay Allan Jones2006-08-02
| | | | | | | | | | | | | | | | The cmd_usage() routine was causing warning messages due to a NULL format parameter being passed in three out of four calls. This is a problem if you want to compile with -Werror. A simple solution is to simply remove the GNU __attribute__ format pragma from the cmd_usage() declaration in the header file. The function interface was somewhat muddled anyway, so re-write the code to finesse the problem. [jc: this incidentally revealed that t9100 test assumed that the output from "git help" to be fixed in stone, but this patch lower-cases "Usage" to "usage". Update the test not to rely on "git help" output.] Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Call setup_git_directory() much earlierLinus Torvalds2006-07-29
| | | | | | | | | This changes the calling convention of built-in commands and passes the "prefix" (i.e. pathname of $PWD relative to the project root level) down to them. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git wrapper: add --git-dir=<path> and --bare optionsJohannes Schindelin2006-07-25
| | | | | | | | | | | | | | | | With this, you can say git --bare repack -a -d inside a bare repository, and it will actually work. While at it, also move the --version, --help and --exec-path options to the handle_options() function. While at documenting the new options, also document the --paginate option. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix more typos, primarily in the codePavel Roskin2006-07-10
| | | | | | | | | The only visible change is that git-blame doesn't understand "--compability" anymore, but it does accept "--compatibility" instead, which is already documented. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Fix "git help -a" terminal autosizingLinus Torvalds2006-04-27
| | | | | | | | | | | | | | | | | | When I split out the builtin commands into their own files, I left the include of <sys/ioctl.h> in git.c rather than moving it to the file that needed it (builtin-help.c). Nobody seems to have noticed, because everything still worked, but because the TIOCGWINSZ macro was now no longer defined when compiling the "term_columns()" function, it would no longer automatically notice the terminal size unless your system used the ancient "COLUMNS" environment variable approach. Trivially fixed by just moving the header include to the file that actually needs it. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Split up builtin commands into separate files from git.cLinus Torvalds2006-04-21
Right now it split it into "builtin-log.c" for log-related commands ("log", "show" and "whatchanged"), and "builtin-help.c" for the informational commands (usage printing and "help" and "version"). This just makes things easier to read, I find. Signed-off-by: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Junio C Hamano <junkio@cox.net>