SZEDER Gábor <szeder.dev@xxxxxxxxx> writes: >> I recall the discussion around the meaning of `-C ""` when that >> command line option was introduced. The conclusion was that the >> zero-length argument should mean "this directory" since that's how `cd >> ""` behaves. However, I don't think that behavior ever got documented, > > Although it's not documented (but see the patch below), we do > explicitly test it since 6a536e2076 (git: treat "git -C '<path>'" as a > no-op when <path> is empty, 2015-03-06) and e.g. our completion script > relies on this behavior. > >> and it's not necessarily obvious. An alternative would be to default >> 'indir' to ".", which should give the same result and be easily >> understood. > > That's fine for me as well. I find the "an empty string is the same as a dot and means the current directory" a bit counter-intuitive, but as long as we have kept Git working that way for this long, we should document it, too. For the tests in the patch in question, I think "-C ." is a good thing to use. Thanks. Will queue. > --- >8 --- > > Subject: [PATCH] Document that 'git -C ""' works and doesn't change directory > > It's been behaving so since 6a536e2076 (git: treat "git -C '<path>'" > as a no-op when <path> is empty, 2015-03-06). > > Signed-off-by: SZEDER Gábor <szeder.dev@xxxxxxxxx> > --- > Documentation/git.txt | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/Documentation/git.txt b/Documentation/git.txt > index f9b09db89b..a9deca0acb 100644 > --- a/Documentation/git.txt > +++ b/Documentation/git.txt > @@ -57,7 +57,8 @@ help ...`. > Run as if git was started in '<path>' instead of the current working > directory. When multiple `-C` options are given, each subsequent > non-absolute `-C <path>` is interpreted relative to the preceding `-C > - <path>`. > + <path>`. If '<path>' is present but empty, e.g. `-C ""`, then the > + current working directory is left unchanged. > + > This option affects options that expect path name like `--git-dir` and > `--work-tree` in that their interpretations of the path names would be