From: Junio C Hamano Date: Thu, 13 Jul 2006 06:09:10 +0000 (-0700) Subject: Merge branch 'ml/trace' X-Git-Tag: v1.4.2-rc1~26 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/d3ba675aae3c6c5722ad15cd9d0f3b7634e976ce?ds=inline;hp=-c Merge branch 'ml/trace' * ml/trace: test-lib: unset GIT_TRACE GIT_TRACE: fix a mixed declarations and code warning GIT_TRACE: show which built-in/external commands are executed --- d3ba675aae3c6c5722ad15cd9d0f3b7634e976ce diff --combined Documentation/git.txt index d00cc3ea52,4b140b8216..ce3058182f --- a/Documentation/git.txt +++ b/Documentation/git.txt @@@ -478,7 -478,7 +478,7 @@@ Configuration Mechanis Starting from 0.99.9 (actually mid 0.99.8.GIT), `.git/config` file is used to hold per-repository configuration options. It is a -simple text file modelled after `.ini` format familiar to some +simple text file modeled after `.ini` format familiar to some people. Here is an example: ------------ @@@ -615,6 -615,13 +615,13 @@@ git Diff gitlink:git-diff-files[1]; gitlink:git-diff-tree[1] + other + ~~~~~ + 'GIT_TRACE':: + If this variable is set git will print `trace:` messages on + stderr telling about alias expansion, built-in command + execution and external command execution. + Discussion[[Discussion]] ------------------------ include::README[] diff --combined git.c index fee71383c6,27989da77c..102735af6c --- a/git.c +++ b/git.c @@@ -11,6 -11,7 +11,7 @@@ #include "git-compat-util.h" #include "exec_cmd.h" #include "cache.h" + #include "quote.h" #include "builtin.h" @@@ -120,6 -121,18 +121,18 @@@ static int handle_alias(int *argcp, con if (!strcmp(alias_command, new_argv[0])) die("recursive alias: %s", alias_command); + if (getenv("GIT_TRACE")) { + int i; + fprintf(stderr, "trace: alias expansion: %s =>", + alias_command); + for (i = 0; i < count; ++i) { + fputc(' ', stderr); + sq_quote_print(stderr, new_argv[i]); + } + fputc('\n', stderr); + fflush(stderr); + } + /* insert after command name */ if (*argcp > 1) { new_argv = realloc(new_argv, sizeof(char*) * @@@ -188,8 -201,7 +201,8 @@@ static void handle_internal_command(in { "stripspace", cmd_stripspace }, { "update-index", cmd_update_index }, { "update-ref", cmd_update_ref }, - { "fmt-merge-msg", cmd_fmt_merge_msg } + { "fmt-merge-msg", cmd_fmt_merge_msg }, + { "prune", cmd_prune }, }; int i; @@@ -203,6 -215,18 +216,18 @@@ struct cmd_struct *p = commands+i; if (strcmp(p->cmd, cmd)) continue; + + if (getenv("GIT_TRACE")) { + int i; + fprintf(stderr, "trace: built-in: git"); + for (i = 0; i < argc; ++i) { + fputc(' ', stderr); + sq_quote_print(stderr, argv[i]); + } + putc('\n', stderr); + fflush(stderr); + } + exit(p->fn(argc, argv, envp)); } } @@@ -252,11 -276,6 +277,11 @@@ int main(int argc, const char **argv, c cmd = *++argv; argc--; + if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) { + setup_pager(); + continue; + } + if (strncmp(cmd, "--", 2)) break; diff --combined t/test-lib.sh index b0d7990a66,c3d3984b33..470a909891 --- a/t/test-lib.sh +++ b/t/test-lib.sh @@@ -9,8 -9,6 +9,8 @@@ LC_ALL= PAGER=cat TZ=UTC export LANG LC_ALL PAGER TZ +EDITOR=: +VISUAL=: unset AUTHOR_DATE unset AUTHOR_EMAIL unset AUTHOR_NAME @@@ -28,11 -26,11 +28,12 @@@ unset GIT_DI unset GIT_EXTERNAL_DIFF unset GIT_INDEX_FILE unset GIT_OBJECT_DIRECTORY + unset GIT_TRACE unset SHA1_FILE_DIRECTORIES unset SHA1_FILE_DIRECTORY export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME +export EDITOR VISUAL # Each test should start with something like this, after copyright notices: #