* bugfix, rfc alias.foo = --git-dir /path/to/repo ...
@ 2007-04-12 18:52 Matthias Lederhofer
0 siblings, 0 replies; only message in thread
From: Matthias Lederhofer @ 2007-04-12 18:52 UTC (permalink / raw)
To: git
I found this while playing with alias.foo = --git-dir /path/to/repo
(looking for other problems):
$ git foo
*** glibc detected *** realloc(): invalid pointer: 0x0811d14c ***
[1] 24815 abort git foo
Patch for this problem is below. Now that this is fixed the more
interesting thing is
alias.foo = --git-dir /tmp/foo.git log
alias.bar = --git-dir /tmp/foo.git status
The first one will use the current repository and the second one will
use /tmp/foo.git (because status is no built-in command).
Possible solutions:
(1) allow changing the repository path after reading the config
(2) deny the use of --git-dir in aliases
(3) reexec git for the alias instead of handling commands internally
if --git-dir is used
I'm in favour of (3).
---
fix bug in handle_options
handle_options did not count the number of used arguments
correctly. When --git-dir was used the extra argument was
not added to the number of handled arguments.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
git.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/git.c b/git.c
index 33dd4d3..7def319 100644
--- a/git.c
+++ b/git.c
@@ -66,6 +66,7 @@ static int handle_options(const char*** argv, int* argc)
setenv(GIT_DIR_ENVIRONMENT, (*argv)[1], 1);
(*argv)++;
(*argc)--;
+ handled++;
} else if (!prefixcmp(cmd, "--git-dir=")) {
setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);
} else if (!strcmp(cmd, "--bare")) {
--
1.5.1.1.81.g6aead-dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-04-12 18:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-04-12 18:52 bugfix, rfc alias.foo = --git-dir /path/to/repo Matthias Lederhofer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).