git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] git: update documentation for --git-dir
@ 2020-01-23  2:16 Heba Waly via GitGitGadget
  2020-01-23  2:35 ` Heba Waly
                   ` (4 more replies)
  0 siblings, 5 replies; 17+ messages in thread
From: Heba Waly via GitGitGadget @ 2020-01-23  2:16 UTC (permalink / raw)
  To: git; +Cc: Heba Waly, Heba Waly

From: Heba Waly <heba.waly@gmail.com>

git --git-dir <path> is a bit confusing and sometimes doesn't work as
the user would expect it to.

For example, if the user runs `git --git-dir=<path> status`, git
will not be able to figure out the work tree path on its own and
will assign the work tree to the user's current work directory.
When this assignment is wrong, then the output will not match the
user's expectations.

This patch updates the documentation to make it clearer.

Signed-off-by: Heba Waly <heba.waly@gmail.com>
---
    [Outreachy] git: update documentation for --git-dir
    
    git --git-dir is a bit confusing and sometimes doesn't work as the user
    would expect it to.
    
    For example, if the user runs git --git-dir=<path> status, git will not
    be able to figure out the work tree path on its own and will assign the
    work tree to the user's current work directory. When this assignment is
    wrong, then the output will not match the user's expectations.
    
    This patch updates the documentation to make it clearer.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/537

 Documentation/git.txt | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index b1597ac002..3b9402c742 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -110,10 +110,15 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	Do not pipe Git output into a pager.
 
 --git-dir=<path>::
-	Set the path to the repository. This can also be controlled by
-	setting the `GIT_DIR` environment variable. It can be an absolute
-	path or relative path to current working directory.
-
+	Set the path to the repository (i.e. the .git folder). This can also be
+	controlled by setting the `GIT_DIR` environment variable. It can be
+	an absolute path or relative path to current working directory.
+
+	Note that --git-dir=<path> is not the same as -C=<path>.
+	It's preferrable to set --work-tree=<path> as well when setting
+	--git-dir to make sure Git will run your command across the correct
+	work tree.
+	
 --work-tree=<path>::
 	Set the path to the working tree. It can be an absolute path
 	or a path relative to the current working directory.

base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
@ 2020-01-23  2:35 ` Heba Waly
  2020-01-23  2:55 ` Emily Shaffer
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 17+ messages in thread
From: Heba Waly @ 2020-01-23  2:35 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: Git Mailing List

On Thu, Jan 23, 2020 at 3:16 PM Heba Waly via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Heba Waly <heba.waly@gmail.com>
>
> git --git-dir <path> is a bit confusing and sometimes doesn't work as
> the user would expect it to.
>
> For example, if the user runs `git --git-dir=<path> status`, git
> will not be able to figure out the work tree path on its own and
> will assign the work tree to the user's current work directory.
> When this assignment is wrong, then the output will not match the
> user's expectations.
>
> This patch updates the documentation to make it clearer.
>
> Signed-off-by: Heba Waly <heba.waly@gmail.com>
> ---
>     [Outreachy] git: update documentation for --git-dir
>
>     git --git-dir is a bit confusing and sometimes doesn't work as the user
>     would expect it to.
>
>     For example, if the user runs git --git-dir=<path> status, git will not
>     be able to figure out the work tree path on its own and will assign the
>     work tree to the user's current work directory. When this assignment is
>     wrong, then the output will not match the user's expectations.
>
>     This patch updates the documentation to make it clearer.
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/537
>
>  Documentation/git.txt | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index b1597ac002..3b9402c742 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -110,10 +110,15 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
>         Do not pipe Git output into a pager.
>
>  --git-dir=<path>::
> -       Set the path to the repository. This can also be controlled by
> -       setting the `GIT_DIR` environment variable. It can be an absolute
> -       path or relative path to current working directory.
> -
> +       Set the path to the repository (i.e. the .git folder). This can also be
> +       controlled by setting the `GIT_DIR` environment variable. It can be
> +       an absolute path or relative path to current working directory.
> +
> +       Note that --git-dir=<path> is not the same as -C=<path>.
> +       It's preferrable to set --work-tree=<path> as well when setting
> +       --git-dir to make sure Git will run your command across the correct
> +       work tree.
> +

I just noticed the whitespace on the last line, will wait for the
patch to be reviewed then include its fix.

>  --work-tree=<path>::
>         Set the path to the working tree. It can be an absolute path
>         or a path relative to the current working directory.
>
> base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
> --
> gitgitgadget

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
  2020-01-23  2:35 ` Heba Waly
@ 2020-01-23  2:55 ` Emily Shaffer
  2020-01-23  6:44   ` Junio C Hamano
  2020-01-23  6:21 ` Junio C Hamano
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 17+ messages in thread
From: Emily Shaffer @ 2020-01-23  2:55 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: git, Heba Waly

On Thu, Jan 23, 2020 at 02:16:51AM +0000, Heba Waly via GitGitGadget wrote:
> From: Heba Waly <heba.waly@gmail.com>
> 
> git --git-dir <path> is a bit confusing and sometimes doesn't work as
> the user would expect it to.
> 
> For example, if the user runs `git --git-dir=<path> status`, git
> will not be able to figure out the work tree path on its own and
> will assign the work tree to the user's current work directory.
> When this assignment is wrong, then the output will not match the
> user's expectations.
> 
> This patch updates the documentation to make it clearer.

One thing Heba doesn't mention here is the effort she spent looking into
how to give a similar hint in the form of an advise() call in cases when
--git-dir is specified but --work-tree is not. While it's possible to
show that kind of hint, it turns out to be tricky to decide whether the
call in question actually wants the worktree. There was also some
concern from Jonathan Tan around whether the hint would interfere with
pre-existing user scripts which use --git-dir; since hints show on
stderr, that interference is likely cosmetic, but still not great.

That left me with a couple questions:

 - Is there a reason the advice library can't check whether it's
   pointing to an interactive shell, along the same lines as deciding
   whether to color output or not?
 - How do we generally worry about changes to stderr output in regard to
   user scripts? Is this as concerning as changes to stdout and return
   code, that is, for plumbing we do not change the format?

> 
> Signed-off-by: Heba Waly <heba.waly@gmail.com>
> ---
>     [Outreachy] git: update documentation for --git-dir
>     
>     git --git-dir is a bit confusing and sometimes doesn't work as the user
>     would expect it to.
>     
>     For example, if the user runs git --git-dir=<path> status, git will not
>     be able to figure out the work tree path on its own and will assign the
>     work tree to the user's current work directory. When this assignment is
>     wrong, then the output will not match the user's expectations.
>     
>     This patch updates the documentation to make it clearer.
> 
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/537
> 
>  Documentation/git.txt | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index b1597ac002..3b9402c742 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -110,10 +110,15 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
>  	Do not pipe Git output into a pager.
>  
>  --git-dir=<path>::
> -	Set the path to the repository. This can also be controlled by
> -	setting the `GIT_DIR` environment variable. It can be an absolute
> -	path or relative path to current working directory.
> -
> +	Set the path to the repository (i.e. the .git folder). This can also be
> +	controlled by setting the `GIT_DIR` environment variable. It can be
> +	an absolute path or relative path to current working directory.
> +
> +	Note that --git-dir=<path> is not the same as -C=<path>.
> +	It's preferrable to set --work-tree=<path> as well when setting
> +	--git-dir to make sure Git will run your command across the correct
> +	work tree.

I feel biased. I want to say, "In many cases, -C=<path> is easier to
understand than --git-dir" instead. :) But my goal with sending this
task to you was "convince people to use -C instead of --git-dir unless
they're really sure" - which may or may not align with the sentiment of
the rest of the list.

 - Emily

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
  2020-01-23  2:35 ` Heba Waly
  2020-01-23  2:55 ` Emily Shaffer
@ 2020-01-23  6:21 ` Junio C Hamano
  2020-01-23  6:41 ` Junio C Hamano
  2020-01-27  2:24 ` [PATCH v2] " Heba Waly via GitGitGadget
  4 siblings, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2020-01-23  6:21 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: git, Heba Waly

"Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:

> For example, if the user runs `git --git-dir=<path> status`, git
> will not be able to figure out the work tree path on its own 

It is not "not be able to figure out".  Specifying GIT_DIR (either
with environment or the --git-dir option) tells Git that the $cwd is
the top of the working tree unless otherwise specified (e.g. with
GIT_WORK_TREE environment).  If you have to say something, saying
"When GIT_DIR is specified, the usual repository discovery is
skipped and the current directory is taken as the top level of the
working tree unless otherwise speciffied" is probably OK.


^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
                   ` (2 preceding siblings ...)
  2020-01-23  6:21 ` Junio C Hamano
@ 2020-01-23  6:41 ` Junio C Hamano
  2020-01-27  2:22   ` Heba Waly
  2020-01-27  2:24 ` [PATCH v2] " Heba Waly via GitGitGadget
  4 siblings, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2020-01-23  6:41 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: git, Heba Waly

"Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  --git-dir=<path>::
> -	Set the path to the repository. This can also be controlled by
> -	setting the `GIT_DIR` environment variable. It can be an absolute
> -	path or relative path to current working directory.
> -
> +	Set the path to the repository (i.e. the .git folder). This can also be

I suspect (i.e. ".git") may be clear enough, but if you must, say
".git directory", not ".git folder", as you mention "current working
directory" later.

> +	controlled by setting the `GIT_DIR` environment variable. It can be
> +	an absolute path or relative path to current working directory.
> +
> +	Note that --git-dir=<path> is not the same as -C=<path>.

Surely, of course.

> +	It's preferrable to set --work-tree=<path> as well when setting
> +	--git-dir to make sure Git will run your command across the correct
> +	work tree.

It does not help the readers that much to say "It's preferrable"
without saying what negative implications there are if they don't
use it, or what positive effect they would observe if they do.

If I were writing it, I'd drop "Note that..." and rewrite the three
lines more like...

	Specifying the location of the ".git" directory using this
	option (or GIT_DIR environment variable) turns off the
	repository discovery that tries to find a directory with
	".git" subdirectory (which is how the repository and the
	top-level of the working tree are discovered), and tells Git
	that you are at the top level of the working tree.  If you
	are not at the top-level directory of the working tree, you
	should tell Git where the top-level of the working tree is,
	with the --work-tree=<path> option (or GIT_WORK_TREE
	environment variable)

perhaps.

>  --work-tree=<path>::
>  	Set the path to the working tree. It can be an absolute path
>  	or a path relative to the current working directory.
>
> base-commit: 232378479ee6c66206d47a9be175e3a39682aea6

I do not know if GGG users have control over this, but I'd prefer to
see a "-- " divider before this "base-commit: ..." footer material.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  2:55 ` Emily Shaffer
@ 2020-01-23  6:44   ` Junio C Hamano
  0 siblings, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2020-01-23  6:44 UTC (permalink / raw)
  To: Emily Shaffer; +Cc: Heba Waly via GitGitGadget, git, Heba Waly

Emily Shaffer <emilyshaffer@google.com> writes:

> I feel biased. I want to say, "In many cases, -C=<path> is easier to
> understand than --git-dir" instead. :) But my goal with sending this
> task to you was "convince people to use -C instead of --git-dir unless
> they're really sure" - which may or may not align with the sentiment of
> the rest of the list.

Ahh, OK.  

These two are options for completely different purposes, and I tend
to agree with you that most users when they misuse --git-dir the do
want -C instead.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH] git: update documentation for --git-dir
  2020-01-23  6:41 ` Junio C Hamano
@ 2020-01-27  2:22   ` Heba Waly
  0 siblings, 0 replies; 17+ messages in thread
From: Heba Waly @ 2020-01-27  2:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Heba Waly via GitGitGadget, Git Mailing List

On Thu, Jan 23, 2020 at 7:41 PM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> It is not "not be able to figure out".  Specifying GIT_DIR (either
> with environment or the --git-dir option) tells Git that the $cwd is
> the top of the working tree unless otherwise specified (e.g. with
> GIT_WORK_TREE environment).  If you have to say something, saying
> "When GIT_DIR is specified, the usual repository discovery is
> skipped and the current directory is taken as the top level of the
> working tree unless otherwise speciffied" is probably OK.
>

Ok, I didn't understand it as intentional before, will update that.

> > +     Set the path to the repository (i.e. the .git folder). This can also be
>
> I suspect (i.e. ".git") may be clear enough, but if you must, say
> ".git directory", not ".git folder", as you mention "current working
> directory" later.
>

Fair enough.

> > +     It's preferrable to set --work-tree=<path> as well when setting
> > +     --git-dir to make sure Git will run your command across the correct
> > +     work tree.
>
> It does not help the readers that much to say "It's preferrable"
> without saying what negative implications there are if they don't
> use it, or what positive effect they would observe if they do.

I agree, I couldn't find enough information on the matter to elaborate more.

> If I were writing it, I'd drop "Note that..." and rewrite the three
> lines more like...
>
>         Specifying the location of the ".git" directory using this
>         option (or GIT_DIR environment variable) turns off the
>         repository discovery that tries to find a directory with
>         ".git" subdirectory (which is how the repository and the
>         top-level of the working tree are discovered), and tells Git
>         that you are at the top level of the working tree.  If you
>         are not at the top-level directory of the working tree, you
>         should tell Git where the top-level of the working tree is,
>         with the --work-tree=<path> option (or GIT_WORK_TREE
>         environment variable)
>
> perhaps.

That helped me understand it better also, will use this, thanks.

>
> >  --work-tree=<path>::
> >       Set the path to the working tree. It can be an absolute path
> >       or a path relative to the current working directory.
> >
> > base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
>
> I do not know if GGG users have control over this, but I'd prefer to
> see a "-- " divider before this "base-commit: ..." footer material.

No I don't think I can change this one.

Thanks,
Heba

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v2] git: update documentation for --git-dir
  2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
                   ` (3 preceding siblings ...)
  2020-01-23  6:41 ` Junio C Hamano
@ 2020-01-27  2:24 ` Heba Waly via GitGitGadget
  2020-01-27  6:28   ` Johannes Sixt
  2020-01-28  4:24   ` [PATCH v3] " Heba Waly via GitGitGadget
  4 siblings, 2 replies; 17+ messages in thread
From: Heba Waly via GitGitGadget @ 2020-01-27  2:24 UTC (permalink / raw)
  To: git; +Cc: Heba Waly, Heba Waly

From: Heba Waly <heba.waly@gmail.com>

git --git-dir <path> is a bit confusing and sometimes doesn't work as
the user would expect it to.

For example, if the user runs `git --git-dir=<path> status`, git
will skip the repository discovery algorithm and will assign the
work tree to the user's current work directory unless otherwise
specified. When this assignment is wrong, the output will not match
the user's expectations.

This patch updates the documentation to make it clearer.

Signed-off-by: Heba Waly <heba.waly@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
---
    [Outreachy] git: update documentation for --git-dir
    
    git --git-dir is a bit confusing and sometimes doesn't work as the user
    would expect it to.
    
    For example, if the user runs git --git-dir=<path> status, git will not
    be able to figure out the work tree path on its own and will assign the
    work tree to the user's current work directory. When this assignment is
    wrong, then the output will not match the user's expectations.
    
    This patch updates the documentation to make it clearer.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v2
Pull-Request: https://github.com/gitgitgadget/git/pull/537

Range-diff vs v1:

 1:  3ac4b85cdb ! 1:  8a69eecb97 git: update documentation for --git-dir
     @@ -6,14 +6,15 @@
          the user would expect it to.
      
          For example, if the user runs `git --git-dir=<path> status`, git
     -    will not be able to figure out the work tree path on its own and
     -    will assign the work tree to the user's current work directory.
     -    When this assignment is wrong, then the output will not match the
     -    user's expectations.
     +    will skip the repository discovery algorithm and will assign the
     +    work tree to the user's current work directory unless otherwise
     +    specified. When this assignment is wrong, the output will not match
     +    the user's expectations.
      
          This patch updates the documentation to make it clearer.
      
          Signed-off-by: Heba Waly <heba.waly@gmail.com>
     +    Helped-by: Junio C Hamano <gitster@pobox.com>
      
       diff --git a/Documentation/git.txt b/Documentation/git.txt
       --- a/Documentation/git.txt
     @@ -25,16 +26,23 @@
      -	Set the path to the repository. This can also be controlled by
      -	setting the `GIT_DIR` environment variable. It can be an absolute
      -	path or relative path to current working directory.
     --
     -+	Set the path to the repository (i.e. the .git folder). This can also be
     ++	Set the path to the repository (".git" directory). This can also be
      +	controlled by setting the `GIT_DIR` environment variable. It can be
      +	an absolute path or relative path to current working directory.
      +
     -+	Note that --git-dir=<path> is not the same as -C=<path>.
     -+	It's preferrable to set --work-tree=<path> as well when setting
     -+	--git-dir to make sure Git will run your command across the correct
     -+	work tree.
     -+	
     ++	Specifying the location of the ".git" directory using this
     ++	option (or GIT_DIR environment variable) turns off the
     ++	repository discovery that tries to find a directory with
     ++	".git" subdirectory (which is how the repository and the
     ++	top-level of the working tree are discovered), and tells Git
     ++	that you are at the top level of the working tree.  If you
     ++	are not at the top-level directory of the working tree, you
     ++	should tell Git where the top-level of the working tree is,
     ++	with the --work-tree=<path> option (or GIT_WORK_TREE
     ++	environment variable)
     ++
     ++	If you just want to run git as if it was started in <path> then use
     ++	git -C.
     + 
       --work-tree=<path>::
       	Set the path to the working tree. It can be an absolute path
     - 	or a path relative to the current working directory.


 Documentation/git.txt | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index b1597ac002..cf73f501b6 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -110,9 +110,23 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	Do not pipe Git output into a pager.
 
 --git-dir=<path>::
-	Set the path to the repository. This can also be controlled by
-	setting the `GIT_DIR` environment variable. It can be an absolute
-	path or relative path to current working directory.
+	Set the path to the repository (".git" directory). This can also be
+	controlled by setting the `GIT_DIR` environment variable. It can be
+	an absolute path or relative path to current working directory.
+
+	Specifying the location of the ".git" directory using this
+	option (or GIT_DIR environment variable) turns off the
+	repository discovery that tries to find a directory with
+	".git" subdirectory (which is how the repository and the
+	top-level of the working tree are discovered), and tells Git
+	that you are at the top level of the working tree.  If you
+	are not at the top-level directory of the working tree, you
+	should tell Git where the top-level of the working tree is,
+	with the --work-tree=<path> option (or GIT_WORK_TREE
+	environment variable)
+
+	If you just want to run git as if it was started in <path> then use
+	git -C.
 
 --work-tree=<path>::
 	Set the path to the working tree. It can be an absolute path

base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] git: update documentation for --git-dir
  2020-01-27  2:24 ` [PATCH v2] " Heba Waly via GitGitGadget
@ 2020-01-27  6:28   ` Johannes Sixt
  2020-01-28  4:17     ` Heba Waly
  2020-01-28  4:24   ` [PATCH v3] " Heba Waly via GitGitGadget
  1 sibling, 1 reply; 17+ messages in thread
From: Johannes Sixt @ 2020-01-27  6:28 UTC (permalink / raw)
  To: Heba Waly; +Cc: Heba Waly via GitGitGadget, git

Am 27.01.20 um 03:24 schrieb Heba Waly via GitGitGadget:
> diff --git a/Documentation/git.txt b/Documentation/git.txt
> index b1597ac002..cf73f501b6 100644
> --- a/Documentation/git.txt
> +++ b/Documentation/git.txt
> @@ -110,9 +110,23 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
>  	Do not pipe Git output into a pager.
>  
>  --git-dir=<path>::
> -	Set the path to the repository. This can also be controlled by
> -	setting the `GIT_DIR` environment variable. It can be an absolute
> -	path or relative path to current working directory.
> +	Set the path to the repository (".git" directory). This can also be
> +	controlled by setting the `GIT_DIR` environment variable. It can be
> +	an absolute path or relative path to current working directory.
> +
> +	Specifying the location of the ".git" directory using this
> +	option (or GIT_DIR environment variable) turns off the
> +	repository discovery that tries to find a directory with
> +	".git" subdirectory (which is how the repository and the
> +	top-level of the working tree are discovered), and tells Git
> +	that you are at the top level of the working tree.  If you
> +	are not at the top-level directory of the working tree, you
> +	should tell Git where the top-level of the working tree is,
> +	with the --work-tree=<path> option (or GIT_WORK_TREE
> +	environment variable)
> +
> +	If you just want to run git as if it was started in <path> then use
> +	git -C.

Does this render well? Judging by the precedent set by the descriptions
of -C and -c options earlier in this file, continuation paragraphs
should not be indented and separated by a line with just a plus sign
instead of an empty line.

-- Hannes

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] git: update documentation for --git-dir
  2020-01-27  6:28   ` Johannes Sixt
@ 2020-01-28  4:17     ` Heba Waly
  2020-01-28  7:33       ` Jeff King
  0 siblings, 1 reply; 17+ messages in thread
From: Heba Waly @ 2020-01-28  4:17 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: Heba Waly via GitGitGadget, Git Mailing List

On Mon, Jan 27, 2020 at 7:29 PM Johannes Sixt <j6t@kdbg.org> wrote:
>
> Does this render well? Judging by the precedent set by the descriptions
> of -C and -c options earlier in this file, continuation paragraphs
> should not be indented and separated by a line with just a plus sign
> instead of an empty line.

It doesn't render well, thanks for pointing it out, will send an
updated version.

Thanks,
Heba

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v3] git: update documentation for --git-dir
  2020-01-27  2:24 ` [PATCH v2] " Heba Waly via GitGitGadget
  2020-01-27  6:28   ` Johannes Sixt
@ 2020-01-28  4:24   ` Heba Waly via GitGitGadget
  2020-01-28 19:22     ` Junio C Hamano
  2020-01-30  1:14     ` [PATCH v4] " Heba Waly via GitGitGadget
  1 sibling, 2 replies; 17+ messages in thread
From: Heba Waly via GitGitGadget @ 2020-01-28  4:24 UTC (permalink / raw)
  To: git; +Cc: Heba Waly, Heba Waly

From: Heba Waly <heba.waly@gmail.com>

git --git-dir <path> is a bit confusing and sometimes doesn't work as
the user would expect it to.

For example, if the user runs `git --git-dir=<path> status`, git
will skip the repository discovery algorithm and will assign the
work tree to the user's current work directory unless otherwise
specified. When this assignment is wrong, the output will not match
the user's expectations.

This patch updates the documentation to make it clearer.

Signed-off-by: Heba Waly <heba.waly@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
---
    [Outreachy] git: update documentation for --git-dir
    
    git --git-dir is a bit confusing and sometimes doesn't work as the user
    would expect it to.
    
    For example, if the user runs git --git-dir=<path> status, git will not
    be able to figure out the work tree path on its own and will assign the
    work tree to the user's current work directory. When this assignment is
    wrong, then the output will not match the user's expectations.
    
    This patch updates the documentation to make it clearer.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/537

Range-diff vs v2:

 1:  8a69eecb97 ! 1:  2a1404f1b3 git: update documentation for --git-dir
     @@ -29,20 +29,20 @@
      +	Set the path to the repository (".git" directory). This can also be
      +	controlled by setting the `GIT_DIR` environment variable. It can be
      +	an absolute path or relative path to current working directory.
     -+
     -+	Specifying the location of the ".git" directory using this
     -+	option (or GIT_DIR environment variable) turns off the
     -+	repository discovery that tries to find a directory with
     -+	".git" subdirectory (which is how the repository and the
     -+	top-level of the working tree are discovered), and tells Git
     -+	that you are at the top level of the working tree.  If you
     -+	are not at the top-level directory of the working tree, you
     -+	should tell Git where the top-level of the working tree is,
     -+	with the --work-tree=<path> option (or GIT_WORK_TREE
     -+	environment variable)
     -+
     -+	If you just want to run git as if it was started in <path> then use
     -+	git -C.
     +++
     ++Specifying the location of the ".git" directory using this
     ++option (or GIT_DIR environment variable) turns off the
     ++repository discovery that tries to find a directory with
     ++".git" subdirectory (which is how the repository and the
     ++top-level of the working tree are discovered), and tells Git
     ++that you are at the top level of the working tree.  If you
     ++are not at the top-level directory of the working tree, you
     ++should tell Git where the top-level of the working tree is,
     ++with the --work-tree=<path> option (or GIT_WORK_TREE
     ++environment variable)
     +++
     ++If you just want to run git as if it was started in <path> then use
     ++git -C.
       
       --work-tree=<path>::
       	Set the path to the working tree. It can be an absolute path


 Documentation/git.txt | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index b1597ac002..c21e33aa10 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -110,9 +110,23 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	Do not pipe Git output into a pager.
 
 --git-dir=<path>::
-	Set the path to the repository. This can also be controlled by
-	setting the `GIT_DIR` environment variable. It can be an absolute
-	path or relative path to current working directory.
+	Set the path to the repository (".git" directory). This can also be
+	controlled by setting the `GIT_DIR` environment variable. It can be
+	an absolute path or relative path to current working directory.
++
+Specifying the location of the ".git" directory using this
+option (or GIT_DIR environment variable) turns off the
+repository discovery that tries to find a directory with
+".git" subdirectory (which is how the repository and the
+top-level of the working tree are discovered), and tells Git
+that you are at the top level of the working tree.  If you
+are not at the top-level directory of the working tree, you
+should tell Git where the top-level of the working tree is,
+with the --work-tree=<path> option (or GIT_WORK_TREE
+environment variable)
++
+If you just want to run git as if it was started in <path> then use
+git -C.
 
 --work-tree=<path>::
 	Set the path to the working tree. It can be an absolute path

base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] git: update documentation for --git-dir
  2020-01-28  4:17     ` Heba Waly
@ 2020-01-28  7:33       ` Jeff King
  2020-01-28 10:40         ` Heba Waly
  0 siblings, 1 reply; 17+ messages in thread
From: Jeff King @ 2020-01-28  7:33 UTC (permalink / raw)
  To: Heba Waly; +Cc: Johannes Sixt, Heba Waly via GitGitGadget, Git Mailing List

On Tue, Jan 28, 2020 at 05:17:49PM +1300, Heba Waly wrote:

> On Mon, Jan 27, 2020 at 7:29 PM Johannes Sixt <j6t@kdbg.org> wrote:
> >
> > Does this render well? Judging by the precedent set by the descriptions
> > of -C and -c options earlier in this file, continuation paragraphs
> > should not be indented and separated by a line with just a plus sign
> > instead of an empty line.
> 
> It doesn't render well, thanks for pointing it out, will send an
> updated version.

One tool that might help as you do documentation patches: there's a
doc-diff script that shows the rendered differences.

Try:

  cd Documentation
  ./doc-diff HEAD^ HEAD

(on a branch with your patch at the tip). It was originally written to
investigate changes to the markup, etc, but I find it's useful just for
looking at any documentation patch, because it takes you right to the
part that changed. :)

-Peff

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v2] git: update documentation for --git-dir
  2020-01-28  7:33       ` Jeff King
@ 2020-01-28 10:40         ` Heba Waly
  0 siblings, 0 replies; 17+ messages in thread
From: Heba Waly @ 2020-01-28 10:40 UTC (permalink / raw)
  To: Jeff King; +Cc: Johannes Sixt, Heba Waly via GitGitGadget, Git Mailing List

On Tue, Jan 28, 2020 at 8:33 PM Jeff King <peff@peff.net> wrote:
>
> One tool that might help as you do documentation patches: there's a
> doc-diff script that shows the rendered differences.
>
> Try:
>
>   cd Documentation
>   ./doc-diff HEAD^ HEAD
>
> (on a branch with your patch at the tip). It was originally written to
> investigate changes to the markup, etc, but I find it's useful just for
> looking at any documentation patch, because it takes you right to the
> part that changed. :)
>

Nice, thank you for the tip :)

Heba

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] git: update documentation for --git-dir
  2020-01-28  4:24   ` [PATCH v3] " Heba Waly via GitGitGadget
@ 2020-01-28 19:22     ` Junio C Hamano
  2020-01-29 12:10       ` Heba Waly
  2020-01-30  1:14     ` [PATCH v4] " Heba Waly via GitGitGadget
  1 sibling, 1 reply; 17+ messages in thread
From: Junio C Hamano @ 2020-01-28 19:22 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: git, Heba Waly

"Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:

>  --git-dir=<path>::
> -	Set the path to the repository. This can also be controlled by
> -	setting the `GIT_DIR` environment variable. It can be an absolute
> -	path or relative path to current working directory.
> +	Set the path to the repository (".git" directory). This can also be
> +	controlled by setting the `GIT_DIR` environment variable. It can be
> +	an absolute path or relative path to current working directory.
> ++
> +Specifying the location of the ".git" directory using this
> +option (or GIT_DIR environment variable) turns off the

Consistently quote, like `GIT_DIR`, here?

> +repository discovery that tries to find a directory with
> +".git" subdirectory (which is how the repository and the
> +top-level of the working tree are discovered), and tells Git
> +that you are at the top level of the working tree.  If you
> +are not at the top-level directory of the working tree, you
> +should tell Git where the top-level of the working tree is,
> +with the --work-tree=<path> option (or GIT_WORK_TREE

Likewise.  We may probably want to say `--work-tree=<path>` inside a
bq pair, and definitely `GIT_WORK_TREE` inside a bq pair.

> +environment variable)
> ++
> +If you just want to run git as if it was started in <path> then use
> +git -C.

This is the best part of this patch, I would think.  But you said
<path> in the "if" part of this "if--then", so (unless your Git
magically can read users' minds some magic), I'd expect to see the
same <path> to appear somewhere in the "then" part.

	If you just want to run git as if it was started in `<path>`
	then use `git -C <path>`.

perhaps?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH v3] git: update documentation for --git-dir
  2020-01-28 19:22     ` Junio C Hamano
@ 2020-01-29 12:10       ` Heba Waly
  0 siblings, 0 replies; 17+ messages in thread
From: Heba Waly @ 2020-01-29 12:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Heba Waly via GitGitGadget, Git Mailing List

On Wed, Jan 29, 2020 at 8:22 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> "Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> >  --git-dir=<path>::
> > -     Set the path to the repository. This can also be controlled by
> > -     setting the `GIT_DIR` environment variable. It can be an absolute
> > -     path or relative path to current working directory.
> > +     Set the path to the repository (".git" directory). This can also be
> > +     controlled by setting the `GIT_DIR` environment variable. It can be
> > +     an absolute path or relative path to current working directory.
> > ++
> > +Specifying the location of the ".git" directory using this
> > +option (or GIT_DIR environment variable) turns off the
>
> Consistently quote, like `GIT_DIR`, here?
>

Ok

> > +repository discovery that tries to find a directory with
> > +".git" subdirectory (which is how the repository and the
> > +top-level of the working tree are discovered), and tells Git
> > +that you are at the top level of the working tree.  If you
> > +are not at the top-level directory of the working tree, you
> > +should tell Git where the top-level of the working tree is,
> > +with the --work-tree=<path> option (or GIT_WORK_TREE
>
> Likewise.  We may probably want to say `--work-tree=<path>` inside a
> bq pair, and definitely `GIT_WORK_TREE` inside a bq pair.
>

Ok

> > +environment variable)
> > ++
> > +If you just want to run git as if it was started in <path> then use
> > +git -C.
>
> This is the best part of this patch, I would think.  But you said
> <path> in the "if" part of this "if--then", so (unless your Git
> magically can read users' minds some magic), I'd expect to see the
> same <path> to appear somewhere in the "then" part.
>

By <path> here I'm referring to the path parameter of git --git-dir=<path>.
And by mentioning `git -C` without any parameters, my intention is to point the
user to scroll up and read about git -C and its parameters. Given that was
confusing to you, I don't mind stating the command in its simplest form as
you suggested: `git -C <path>`

>         If you just want to run git as if it was started in `<path>`
>         then use `git -C <path>`.
>
> perhaps?

Thanks,
Heba

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [PATCH v4] git: update documentation for --git-dir
  2020-01-28  4:24   ` [PATCH v3] " Heba Waly via GitGitGadget
  2020-01-28 19:22     ` Junio C Hamano
@ 2020-01-30  1:14     ` Heba Waly via GitGitGadget
  2020-01-30 18:26       ` Junio C Hamano
  1 sibling, 1 reply; 17+ messages in thread
From: Heba Waly via GitGitGadget @ 2020-01-30  1:14 UTC (permalink / raw)
  To: git; +Cc: Heba Waly, Heba Waly

From: Heba Waly <heba.waly@gmail.com>

git --git-dir <path> is a bit confusing and sometimes doesn't work as
the user would expect it to.

For example, if the user runs `git --git-dir=<path> status`, git
will skip the repository discovery algorithm and will assign the
work tree to the user's current work directory unless otherwise
specified. When this assignment is wrong, the output will not match
the user's expectations.

This patch updates the documentation to make it clearer.

Signed-off-by: Heba Waly <heba.waly@gmail.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
---
    [Outreachy] git: update documentation for --git-dir
    
    git --git-dir is a bit confusing and sometimes doesn't work as the user
    would expect it to.
    
    For example, if the user runs git --git-dir=<path> status, git will skip
    the repository discovery algorithm and will assign the work tree to the
    user's current work directory unless otherwise specified. When this
    assignment is wrong, the output will not match the user's expectations.
    
    This patch updates the documentation to make it clearer.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-537%2FHebaWaly%2Fgit_dir_doc-v4
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-537/HebaWaly/git_dir_doc-v4
Pull-Request: https://github.com/gitgitgadget/git/pull/537

Range-diff vs v3:

 1:  2a1404f1b3 ! 1:  e27f150c4b git: update documentation for --git-dir
     @@ -31,18 +31,18 @@
      +	an absolute path or relative path to current working directory.
      ++
      +Specifying the location of the ".git" directory using this
     -+option (or GIT_DIR environment variable) turns off the
     ++option (or `GIT_DIR` environment variable) turns off the
      +repository discovery that tries to find a directory with
      +".git" subdirectory (which is how the repository and the
      +top-level of the working tree are discovered), and tells Git
      +that you are at the top level of the working tree.  If you
      +are not at the top-level directory of the working tree, you
      +should tell Git where the top-level of the working tree is,
     -+with the --work-tree=<path> option (or GIT_WORK_TREE
     ++with the `--work-tree=<path>` option (or `GIT_WORK_TREE`
      +environment variable)
      ++
     -+If you just want to run git as if it was started in <path> then use
     -+git -C.
     ++If you just want to run git as if it was started in `<path>` then use
     ++`git -C <path>`.
       
       --work-tree=<path>::
       	Set the path to the working tree. It can be an absolute path


 Documentation/git.txt | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/Documentation/git.txt b/Documentation/git.txt
index b1597ac002..41374f24fa 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -110,9 +110,23 @@ foo.bar= ...`) sets `foo.bar` to the empty string which `git config
 	Do not pipe Git output into a pager.
 
 --git-dir=<path>::
-	Set the path to the repository. This can also be controlled by
-	setting the `GIT_DIR` environment variable. It can be an absolute
-	path or relative path to current working directory.
+	Set the path to the repository (".git" directory). This can also be
+	controlled by setting the `GIT_DIR` environment variable. It can be
+	an absolute path or relative path to current working directory.
++
+Specifying the location of the ".git" directory using this
+option (or `GIT_DIR` environment variable) turns off the
+repository discovery that tries to find a directory with
+".git" subdirectory (which is how the repository and the
+top-level of the working tree are discovered), and tells Git
+that you are at the top level of the working tree.  If you
+are not at the top-level directory of the working tree, you
+should tell Git where the top-level of the working tree is,
+with the `--work-tree=<path>` option (or `GIT_WORK_TREE`
+environment variable)
++
+If you just want to run git as if it was started in `<path>` then use
+`git -C <path>`.
 
 --work-tree=<path>::
 	Set the path to the working tree. It can be an absolute path

base-commit: 232378479ee6c66206d47a9be175e3a39682aea6
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [PATCH v4] git: update documentation for --git-dir
  2020-01-30  1:14     ` [PATCH v4] " Heba Waly via GitGitGadget
@ 2020-01-30 18:26       ` Junio C Hamano
  0 siblings, 0 replies; 17+ messages in thread
From: Junio C Hamano @ 2020-01-30 18:26 UTC (permalink / raw)
  To: Heba Waly via GitGitGadget; +Cc: git, Heba Waly

"Heba Waly via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Range-diff vs v3:
>
>  1:  2a1404f1b3 ! 1:  e27f150c4b git: update documentation for --git-dir
>      @@ -31,18 +31,18 @@
>       +	an absolute path or relative path to current working directory.
>       ++
>       +Specifying the location of the ".git" directory using this
>      -+option (or GIT_DIR environment variable) turns off the
>      ++option (or `GIT_DIR` environment variable) turns off the
>       +repository discovery that tries to find a directory with
>       +".git" subdirectory (which is how the repository and the
>       +top-level of the working tree are discovered), and tells Git
>       +that you are at the top level of the working tree.  If you
>       +are not at the top-level directory of the working tree, you
>       +should tell Git where the top-level of the working tree is,
>      -+with the --work-tree=<path> option (or GIT_WORK_TREE
>      ++with the `--work-tree=<path>` option (or `GIT_WORK_TREE`
>       +environment variable)
>       ++
>      -+If you just want to run git as if it was started in <path> then use
>      -+git -C.
>      ++If you just want to run git as if it was started in `<path>` then use
>      ++`git -C <path>`.

Will replace and queue.  Thanks.        

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2020-01-30 18:26 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-23  2:16 [PATCH] git: update documentation for --git-dir Heba Waly via GitGitGadget
2020-01-23  2:35 ` Heba Waly
2020-01-23  2:55 ` Emily Shaffer
2020-01-23  6:44   ` Junio C Hamano
2020-01-23  6:21 ` Junio C Hamano
2020-01-23  6:41 ` Junio C Hamano
2020-01-27  2:22   ` Heba Waly
2020-01-27  2:24 ` [PATCH v2] " Heba Waly via GitGitGadget
2020-01-27  6:28   ` Johannes Sixt
2020-01-28  4:17     ` Heba Waly
2020-01-28  7:33       ` Jeff King
2020-01-28 10:40         ` Heba Waly
2020-01-28  4:24   ` [PATCH v3] " Heba Waly via GitGitGadget
2020-01-28 19:22     ` Junio C Hamano
2020-01-29 12:10       ` Heba Waly
2020-01-30  1:14     ` [PATCH v4] " Heba Waly via GitGitGadget
2020-01-30 18:26       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).