From: SZEDER Gábor <hidden> Date: 2016-06-15 22:45:15
Printing usage strings of git commands should obviously not depend on
the command being run inside a git repository. However, in case of a
command requiring a repository, the command line options are parsed only
after it is ensured that the command was started inside a repository,
resulting in a 'fatal: Not a git repository' if 'git cmd -h' wasn't
executed inside a repository.
To get around this issue, we will check early for the presence of '-h'
option, and skip ensuring that the command is run inside a repository.
Signed-off-by: SZEDER Gábor <redacted>
---
git.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
From: Johannes Schindelin <hidden> Date: 2016-06-15 22:45:15
Hi,
On Thu, 28 Aug 2008, SZEDER Gábor wrote:
Printing usage strings of git commands should obviously not depend on
the command being run inside a git repository. However, in case of a
command requiring a repository, the command line options are parsed only
after it is ensured that the command was started inside a repository,
resulting in a 'fatal: Not a git repository' if 'git cmd -h' wasn't
executed inside a repository.
To get around this issue, we will check early for the presence of '-h'
option, and skip ensuring that the command is run inside a repository.
You miss the fact that "git grep -h" does not mean "show usage". Oh, and
"git ls-remote -h" neither. Three times's a charm: "git show-ref -h" does
not show the help either.
I am also not quite certain if we should not just tout "git help <cmd>" as
the official way to request help.
Ciao,
Dscho
On 8/29/08, Johannes Schindelin [off-list ref] wrote:
Hi,
On Thu, 28 Aug 2008, SZEDER Gábor wrote:
> Printing usage strings of git commands should obviously not depend on
> the command being run inside a git repository. However, in case of a
> command requiring a repository, the command line options are parsed only
> after it is ensured that the command was started inside a repository,
> resulting in a 'fatal: Not a git repository' if 'git cmd -h' wasn't
> executed inside a repository.
>
> To get around this issue, we will check early for the presence of '-h'
> option, and skip ensuring that the command is run inside a repository.
You miss the fact that "git grep -h" does not mean "show usage". Oh, and
"git ls-remote -h" neither. Three times's a charm: "git show-ref -h" does
not show the help either.
I am also not quite certain if we should not just tout "git help <cmd>" as
the official way to request help.
No we should not (at least to me), usage strings are shorter and don't
require man. As for allowing "git cmd -h" outside repository, I think
Jeff's idea of refactoring setup procedure, setting up if possible but
not barfing, would solve it.
--
Duy
From: SZEDER Gábor <hidden> Date: 2016-06-15 22:45:15
On Fri, Aug 29, 2008 at 01:35:02PM +0200, Johannes Schindelin wrote:
You miss the fact that "git grep -h" does not mean "show usage". Oh, and
"git ls-remote -h" neither. Three times's a charm: "git show-ref -h" does
not show the help either.
you are right with grep and show-ref. However, ls-remote does not
require a repository, so it would not be affected by this patch.
I am also not quite certain if we should not just tout "git help <cmd>" as
the official way to request help.
Well, I would prefer to keep the short usage.
But anyway, having this inconsistency with the -h option across git
commands is bad.
Regards,
Gábor