summaryrefslogtreecommitdiff
path: root/git.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-07-13 06:09:10 (GMT)
committerJunio C Hamano <junkio@cox.net>2006-07-13 06:09:10 (GMT)
commitd3ba675aae3c6c5722ad15cd9d0f3b7634e976ce (patch)
tree94813d10e42424a31cd58ad8eb9f338874cd0d7d /git.c
parenta72f9373c01f9bbebd14af7cec6ff0de4c27c578 (diff)
parent1d0361e806086f6076c221ff5bb40b73643e96c3 (diff)
downloadgit-d3ba675aae3c6c5722ad15cd9d0f3b7634e976ce.zip
git-d3ba675aae3c6c5722ad15cd9d0f3b7634e976ce.tar.gz
git-d3ba675aae3c6c5722ad15cd9d0f3b7634e976ce.tar.bz2
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
Diffstat (limited to 'git.c')
-rw-r--r--git.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/git.c b/git.c
index fee7138..102735a 100644
--- a/git.c
+++ b/git.c
@@ -11,6 +11,7 @@
#include "git-compat-util.h"
#include "exec_cmd.h"
#include "cache.h"
+#include "quote.h"
#include "builtin.h"
@@ -120,6 +121,18 @@ static int handle_alias(int *argcp, const char ***argv)
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*) *
@@ -203,6 +216,18 @@ static void handle_internal_command(int argc, const char **argv, char **envp)
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));
}
}