зеркало из https://github.com/microsoft/git.git
Add and document a global --no-pager option for git.
To keep the change small, this is done by setting GIT_PAGER to "cat". Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Acked-by: Brian Gernhardt <benji@silverinsanity.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
2f82f760e1
Коммит
463a849d00
|
@ -9,7 +9,8 @@ git - the stupid content tracker
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
[verse]
|
[verse]
|
||||||
'git' [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate]
|
'git' [--version] [--exec-path[=GIT_EXEC_PATH]]
|
||||||
|
[-p|--paginate|--no-pager]
|
||||||
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
|
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
|
||||||
[--help] COMMAND [ARGS]
|
[--help] COMMAND [ARGS]
|
||||||
|
|
||||||
|
@ -103,6 +104,9 @@ OPTIONS
|
||||||
-p|--paginate::
|
-p|--paginate::
|
||||||
Pipe all output into 'less' (or if set, $PAGER).
|
Pipe all output into 'less' (or if set, $PAGER).
|
||||||
|
|
||||||
|
--no-pager::
|
||||||
|
Do not pipe git output into a pager.
|
||||||
|
|
||||||
--git-dir=<path>::
|
--git-dir=<path>::
|
||||||
Set the path to the repository. This can also be controlled by
|
Set the path to the repository. This can also be controlled by
|
||||||
setting the GIT_DIR environment variable.
|
setting the GIT_DIR environment variable.
|
||||||
|
|
6
git.c
6
git.c
|
@ -4,7 +4,7 @@
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
|
|
||||||
const char git_usage_string[] =
|
const char git_usage_string[] =
|
||||||
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
|
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
|
||||||
|
|
||||||
static void prepend_to_path(const char *dir, int len)
|
static void prepend_to_path(const char *dir, int len)
|
||||||
{
|
{
|
||||||
|
@ -58,6 +58,10 @@ static int handle_options(const char*** argv, int* argc, int* envchanged)
|
||||||
}
|
}
|
||||||
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
|
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
|
||||||
setup_pager();
|
setup_pager();
|
||||||
|
} else if (!strcmp(cmd, "--no-pager")) {
|
||||||
|
setenv("GIT_PAGER", "cat", 1);
|
||||||
|
if (envchanged)
|
||||||
|
*envchanged = 1;
|
||||||
} else if (!strcmp(cmd, "--git-dir")) {
|
} else if (!strcmp(cmd, "--git-dir")) {
|
||||||
if (*argc < 2) {
|
if (*argc < 2) {
|
||||||
fprintf(stderr, "No directory given for --git-dir.\n" );
|
fprintf(stderr, "No directory given for --git-dir.\n" );
|
||||||
|
|
Загрузка…
Ссылка в новой задаче