summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2b11e31)
raw | patch | inline | side by side (parent: 2b11e31)
author | Junio C Hamano <junkio@cox.net> | |
Tue, 6 Jun 2006 01:09:40 +0000 (18:09 -0700) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Tue, 6 Jun 2006 01:09:40 +0000 (18:09 -0700) |
This disables alias "foo" from being used for git-foo, and when
we do use alias we check the built-in and then existing command
names first and then alias as the fallback. This avoids the
problem of common commands used in scripts getting clobbered by
user specific aliases.
Signed-off-by: Junio C Hamano <junkio@cox.net>
we do use alias we check the built-in and then existing command
names first and then alias as the fallback. This avoids the
problem of common commands used in scripts getting clobbered by
user specific aliases.
Signed-off-by: Junio C Hamano <junkio@cox.net>
git.c | patch | blob | history |
index 88544724532b61e408cb6bb01caa11b626c7f74c..6db8f2bc23abb328d8d0bed83a581a1cda10e9a4 100644 (file)
--- a/git.c
+++ b/git.c
char *slash = strrchr(cmd, '/');
char git_command[PATH_MAX + 1];
const char *exec_path = NULL;
+ int done_alias = 0;
/*
* Take the basename of argv[0] as the command
if (!strncmp(cmd, "git-", 4)) {
cmd += 4;
argv[0] = cmd;
- handle_alias(&argc, &argv);
handle_internal_command(argc, argv, envp);
die("cannot handle %s internally", cmd);
}
exec_path = git_exec_path();
prepend_to_path(exec_path, strlen(exec_path));
- handle_alias(&argc, &argv);
+ while (1) {
+ /* See if it's an internal command */
+ handle_internal_command(argc, argv, envp);
- /* See if it's an internal command */
- handle_internal_command(argc, argv, envp);
+ /* .. then try the external ones */
+ execv_git_cmd(argv);
- /* .. then try the external ones */
- execv_git_cmd(argv);
+ /* It could be an alias -- this works around the insanity
+ * of overriding "git log" with "git show" by having
+ * alias.log = show
+ */
+ if (done_alias || !handle_alias(&argc, &argv))
+ break;
+ done_alias = 1;
+ }
if (errno == ENOENT)
cmd_usage(0, exec_path, "'%s' is not a git-command", cmd);