* BUG: git --bare log HEAD @ 2007-01-19 12:02 Han-Wen Nienhuys 2007-01-20 0:52 ` [PATCH] Do not verify filenames in a bare repository Johannes Schindelin 0 siblings, 1 reply; 4+ messages in thread From: Han-Wen Nienhuys @ 2007-01-19 12:02 UTC (permalink / raw) To: git of course, when --bare is used, then HEAD is not ambiguous. [lilydev@haring .git]$ git --bare log HEAD fatal: ambiguous argument 'HEAD': both revision and filename Use '--' to separate filenames from revisions -- Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Do not verify filenames in a bare repository 2007-01-19 12:02 BUG: git --bare log HEAD Han-Wen Nienhuys @ 2007-01-20 0:52 ` Johannes Schindelin 2007-01-20 0:56 ` Junio C Hamano 0 siblings, 1 reply; 4+ messages in thread From: Johannes Schindelin @ 2007-01-20 0:52 UTC (permalink / raw) To: Han-Wen Nienhuys; +Cc: git For example, it makes no sense to check the presence of a file named "HEAD" when calling "git log HEAD" in a bare repository. Noticed by Han-Wen Nienhuys. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> --- On Fri, 19 Jan 2007, Han-Wen Nienhuys wrote: > of course, when --bare is used, then HEAD is not ambiguous. > > > [lilydev@haring .git]$ git --bare log HEAD > fatal: ambiguous argument 'HEAD': both revision and filename > Use '--' to separate filenames from revisions Note that it would still fail in your case, since saying "--bare" does not get picked up if the current directory is named ".git". I was close to sending a patch which sets the environment variable "GIT_IS_BARE" when calling git with "--bare", and checking that, but decided against it: it is more likely you are about to shoot yourself in the foot, because real bare repositories are not named ".git". setup.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/setup.c b/setup.c index cc97f9f..7181560 100644 --- a/setup.c +++ b/setup.c @@ -95,6 +95,9 @@ void verify_non_filename(const char *prefix, const char *arg) const char *name; struct stat st; + if (is_bare_repository()) + return; + if (*arg == '-') return; /* flag */ name = prefix ? prefix_filename(prefix, strlen(prefix), arg) : arg; -- 1.5.0.rc1.g38843-dirty ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not verify filenames in a bare repository 2007-01-20 0:52 ` [PATCH] Do not verify filenames in a bare repository Johannes Schindelin @ 2007-01-20 0:56 ` Junio C Hamano 2007-01-20 1:05 ` Johannes Schindelin 0 siblings, 1 reply; 4+ messages in thread From: Junio C Hamano @ 2007-01-20 0:56 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git This feels very sane. Thanks. A handful tests to make sure it catches the cases wants to catch and it does not hiccup with the cases it shouldn't catch would be appropriate, though. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not verify filenames in a bare repository 2007-01-20 0:56 ` Junio C Hamano @ 2007-01-20 1:05 ` Johannes Schindelin 0 siblings, 0 replies; 4+ messages in thread From: Johannes Schindelin @ 2007-01-20 1:05 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Hi, On Fri, 19 Jan 2007, Junio C Hamano wrote: > This feels very sane. Thanks. I changed my mind. A saner check would be if the current directory starts with GIT_DIR, so that even (cd .git; git show HEAD) still works. > A handful tests to make sure it catches the cases wants to catch and it > does not hiccup with the cases it shouldn't catch would be appropriate, > though. Sure. I'll resend in a few minutes. Ciao, Dscho ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-01-20 1:06 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2007-01-19 12:02 BUG: git --bare log HEAD Han-Wen Nienhuys 2007-01-20 0:52 ` [PATCH] Do not verify filenames in a bare repository Johannes Schindelin 2007-01-20 0:56 ` Junio C Hamano 2007-01-20 1:05 ` Johannes Schindelin
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.