From: Jeff King <peff@peff.net>
To: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: Re: [PATCH] Allow an alias to start with "-p"
Date: Tue, 25 Jul 2006 01:03:12 -0400 [thread overview]
Message-ID: <20060725050312.GA5618@coredump.intra.peff.net> (raw)
In-Reply-To: <Pine.LNX.4.63.0607241408170.29667@wbgn013.biozentrum.uni-wuerzburg.de>
On Mon, Jul 24, 2006 at 02:10:45PM +0200, Johannes Schindelin wrote:
> @@ -264,6 +289,7 @@ int main(int argc, const char **argv, ch
> 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);
> }
I believe this change is the source of the breakage in tests.
GIT_DIR=foo git-init-db no longer works because handle_alias
unconditionally calls setup_git_directory_gently(), which thinks that if
GIT_DIR is set, it must exist.
This can be fixed by giving precedence to the internal command over
alias checking. This makes sense, anyway, since later in the function,
we give precedence to internal commands in the "git init-db" form.
Patch is below (wow, that +++ is kind of ugly!).
-Peff
+++
git: choose internal commands over aliases for git-*
This is especially important because some commands (like init-db) don't
require a working GIT_DIR, and alias expansion tries to look at it. It
also matches the behavior of "git cmd".
Signed-off-by: Jeff King <peff@peff.net>
---
git.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/git.c b/git.c
index 8d7c644..68ce826 100644
--- a/git.c
+++ b/git.c
@@ -289,8 +289,8 @@ int main(int argc, const char **argv, ch
if (!strncmp(cmd, "git-", 4)) {
cmd += 4;
argv[0] = cmd;
- handle_alias(&argc, &argv);
handle_internal_command(argc, argv, envp);
+ handle_alias(&argc, &argv);
die("cannot handle %s internally", cmd);
}
--
1.4.2.rc1.gc470-dirty
next prev parent reply other threads:[~2006-07-25 5:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-18 23:25 [PATCH] Allow an alias to start with "-p" Johannes Schindelin
2006-07-24 6:32 ` Junio C Hamano
2006-07-24 12:10 ` Johannes Schindelin
2006-07-25 0:36 ` Junio C Hamano
2006-07-25 6:27 ` Johannes Schindelin
2006-07-25 5:03 ` Jeff King [this message]
2006-07-25 6:18 ` Johannes Schindelin
2006-07-25 20:34 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060725050312.GA5618@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox