git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* "man git-checkout", man page is inconsistent between SYNOPSIS and details
@ 2017-09-30  9:27 Robert P. J. Day
  2017-09-30 14:32 ` Kevin Daudt
  0 siblings, 1 reply; 11+ messages in thread
From: Robert P. J. Day @ 2017-09-30  9:27 UTC (permalink / raw)
  To: Git Mailing list


  just noticed that in "man git-checkout", the SYNOPSIS contains the
line:

  git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]

implying that <paths> is optional, but further down in the
DESCRIPTION, one reads:

  git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...

suggesting that <pathspec> is required.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-09-30  9:27 "man git-checkout", man page is inconsistent between SYNOPSIS and details Robert P. J. Day
@ 2017-09-30 14:32 ` Kevin Daudt
  2017-09-30 15:01   ` Robert P. J. Day
  2017-09-30 22:04   ` Robert P. J. Day
  0 siblings, 2 replies; 11+ messages in thread
From: Kevin Daudt @ 2017-09-30 14:32 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

On Sat, Sep 30, 2017 at 05:27:22AM -0400, Robert P. J. Day wrote:
> 
>   just noticed that in "man git-checkout", the SYNOPSIS contains the
> line:
> 
>   git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]
> 
> implying that <paths> is optional, but further down in the
> DESCRIPTION, one reads:
> 
>   git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...
> 
> suggesting that <pathspec> is required.
> 

Hello Robert, thank you for this report.

Git checkout has 2 major modes of operating:

1. Checking out branches (and then update your working tree to match that
  commit.
2. Checking out 1 or more files from a commit.

The first four lines of the synopsis match mode nr. 1. The next two
belong to mode nr. 2.

The pathspec in the synopsis line you are quoting is required, because
that's how you tell git you want mode nr 2. That's why it's not
mentioned between [].  The last section under description explains that
mode. 

Do you feel this distinction needs to be made more clear?

Kevin.

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-09-30 14:32 ` Kevin Daudt
@ 2017-09-30 15:01   ` Robert P. J. Day
  2017-09-30 22:04   ` Robert P. J. Day
  1 sibling, 0 replies; 11+ messages in thread
From: Robert P. J. Day @ 2017-09-30 15:01 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: Git Mailing list

On Sat, 30 Sep 2017, Kevin Daudt wrote:

> On Sat, Sep 30, 2017 at 05:27:22AM -0400, Robert P. J. Day wrote:
> >
> >   just noticed that in "man git-checkout", the SYNOPSIS contains the
> > line:
> >
> >   git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]
> >
> > implying that <paths> is optional, but further down in the
> > DESCRIPTION, one reads:
> >
> >   git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...
> >
> > suggesting that <pathspec> is required.
> >
>
> Hello Robert, thank you for this report.
>
> Git checkout has 2 major modes of operating:
>
> 1. Checking out branches (and then update your working tree to match that
>   commit.
> 2. Checking out 1 or more files from a commit.
>
> The first four lines of the synopsis match mode nr. 1. The next two
> belong to mode nr. 2.
>
> The pathspec in the synopsis line you are quoting is required, because
> that's how you tell git you want mode nr 2. That's why it's not
> mentioned between [].  The last section under description explains that
> mode.
>
> Do you feel this distinction needs to be made more clear?

  hmmmmm ... let me read it again before i answer that.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-09-30 14:32 ` Kevin Daudt
  2017-09-30 15:01   ` Robert P. J. Day
@ 2017-09-30 22:04   ` Robert P. J. Day
  2017-10-01  3:49     ` Junio C Hamano
  1 sibling, 1 reply; 11+ messages in thread
From: Robert P. J. Day @ 2017-09-30 22:04 UTC (permalink / raw)
  To: Kevin Daudt; +Cc: Git Mailing list

On Sat, 30 Sep 2017, Kevin Daudt wrote:

> On Sat, Sep 30, 2017 at 05:27:22AM -0400, Robert P. J. Day wrote:
> >
> >   just noticed that in "man git-checkout", the SYNOPSIS contains
> > the line:
> >
> >   git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]
> >
> > implying that <paths> is optional, but further down in the
> > DESCRIPTION, one reads:
> >
> >   git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...
> >
> > suggesting that <pathspec> is required.
> >
>
> Hello Robert, thank you for this report.
>
> Git checkout has 2 major modes of operating:
>
> 1. Checking out branches (and then update your working tree to match that
>   commit.
> 2. Checking out 1 or more files from a commit.
>
> The first four lines of the synopsis match mode nr. 1. The next two
> belong to mode nr. 2.
>
> The pathspec in the synopsis line you are quoting is required,
> because that's how you tell git you want mode nr 2. That's why it's
> not mentioned between [].  The last section under description
> explains that mode.
>
> Do you feel this distinction needs to be made more clear?

  upon re-examination, not so much more clear, as simply not
self-contradictory. just compare the lines in the SYNOPSIS and the
DESCRIPTION sections:

SYNOPSIS
       ...
       git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]

DESCRIPTION
       ...
       git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...

  those lines clearly represent the same operating mode -- they are
identical in every respect -- but in the first case, paths is
optional, whereas in the second case, it's mandatory.

  it's simply a matter of the forms not matching between the SYNOPSIS
and the DESCRIPTION sections. am i making sense?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-09-30 22:04   ` Robert P. J. Day
@ 2017-10-01  3:49     ` Junio C Hamano
  2017-10-01 10:05       ` Robert P. J. Day
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2017-10-01  3:49 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Kevin Daudt, Git Mailing list

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

>   it's simply a matter of the forms not matching between the SYNOPSIS
> and the DESCRIPTION sections. am i making sense?

I think the whole thing is wrong and the root cause is because the
(relatively newer) description of the "--patch" mode lazily tried to
piggy-back the description of existing "check out from the index or
tree-ish" mode, ending up in a confusing description.

"git checkout [<tree-ish>] -- <pathspec>..." is a way to overwrite
the working tree files with what is in the object store.  When you
give <tree-ish>, the paths that match the <pathspec> are grabbed
from the tree-ish, added to the index, and overwrites the working
tree files.  In this mode, you need to have at least one pathspec
element on the command line, so <pathspec> is mandatory.  With no
pathspec, if <tree-ish> happens to be a commit-ish, then the
operation is "check out the commit, so that we can prepare to make
a new commit as its child".

"git checkout -p/--patch [<tree-ish>]" is quite different.  It can
be used without any <pathspec> to pick and choose from all changes
treewide, but you can use <pathspec> to limit the changes you need
to choose from.

Something like the following may be a good starting point.  As I
didn't spend many brain-cycles to come up with a description for the
"--patch" mode, that paragraph needs a total rewrite on top, but I
think the structure to separate the normal "per-path" checkout mode
and "patch" mode and describe it separately should make it a lot
clearer to see what is being described.

Short of such a fundamental correction,

	git checkout [-p|--patch] [<tree-ish>] -- [<pathspec>...]

would allow you to give none of -p/--patch/<pathspec>, which is
totally a different operation from what is being described in the
text.

 Documentation/git-checkout.txt | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index d6399c0af8..3d88f703e9 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -13,7 +13,8 @@ SYNOPSIS
 'git checkout' [-q] [-f] [-m] [--detach] <commit>
 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
-'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]
+'git checkout' [<tree-ish>] [--] <pathspec>...
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]
 
 DESCRIPTION
 -----------
@@ -78,10 +79,9 @@ be used to detach HEAD at the tip of the branch (`git checkout
 +
 Omitting <branch> detaches HEAD at the tip of the current branch.
 
-'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::
+'git checkout' [<tree-ish>] [--] <pathspec>...::
 
-	When <paths> or `--patch` are given, 'git checkout' does *not*
-	switch branches.  It updates the named paths in the working tree
+	Updates the named paths in the working tree
 	from the index file or from a named <tree-ish> (most often a
 	commit).  In this case, the `-b` and `--track` options are
 	meaningless and giving either of them results in an error.  The
@@ -89,7 +89,7 @@ Omitting <branch> detaches HEAD at the tip of the current branch.
 	(i.e.  commit, tag or tree) to update the index for the given
 	paths before updating the working tree.
 +
-'git checkout' with <paths> or `--patch` is used to restore modified or
+'git checkout' with <paths> is used to restore modified or
 deleted paths to their original contents from the index or replace paths
 with the contents from a named <tree-ish> (most often a commit-ish).
 +
@@ -101,6 +101,13 @@ specific side of the merge can be checked out of the index by
 using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
 file can be discarded to re-create the original conflicted merge result.
 
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
+	This is similar to the "check out paths to the working tree"
+	mode described above, but lets you use the interactive
+	interface show the "diff" output and choose which hunks to
+	use in the result.
+
+
 OPTIONS
 -------
 -q::

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-10-01  3:49     ` Junio C Hamano
@ 2017-10-01 10:05       ` Robert P. J. Day
  2017-10-02  0:29         ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Robert P. J. Day @ 2017-10-01 10:05 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Kevin Daudt, Git Mailing list

On Sun, 1 Oct 2017, Junio C Hamano wrote:

> "Robert P. J. Day" <rpjday@crashcourse.ca> writes:
>
> >   it's simply a matter of the forms not matching between the SYNOPSIS
> > and the DESCRIPTION sections. am i making sense?
>
> I think the whole thing is wrong and the root cause is because the
> (relatively newer) description of the "--patch" mode lazily tried to
> piggy-back the description of existing "check out from the index or
> tree-ish" mode, ending up in a confusing description...

  ... big snip ...

ok, i'm going to have to digest all that; pretty sure someone else
will need to change the man page to clarify the apparent inconsistency
i was referring to:

  SYNOPSIS
       git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]
  DESCRIPTION
       git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...

and on that note, i'll get back to proofreading.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

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

* Re: "man git-checkout", man page is inconsistent between SYNOPSIS and details
  2017-10-01 10:05       ` Robert P. J. Day
@ 2017-10-02  0:29         ` Junio C Hamano
  2017-10-11  2:39           ` [PATCH] checkout doc: clarify command line args for "checkout paths" mode Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2017-10-02  0:29 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Kevin Daudt, Git Mailing list

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

> ok, i'm going to have to digest all that; pretty sure someone else
> will need to change the man page to clarify the apparent inconsistency
> i was referring to:
>
>   SYNOPSIS
>        git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]
>   DESCRIPTION
>        git checkout [-p|--patch] [<tree-ish>] [--] <pathspec>...

Yes, and a short-version of my answer is that they both are wrong
;-)

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

* [PATCH] checkout doc: clarify command line args for "checkout paths"  mode
  2017-10-02  0:29         ` Junio C Hamano
@ 2017-10-11  2:39           ` Junio C Hamano
  2017-10-11  3:22             ` Jonathan Nieder
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2017-10-11  2:39 UTC (permalink / raw)
  To: Git Mailing list; +Cc: Kevin Daudt, Robert P. J. Day

There are "git checkout [-p][<tree-ish>][--][<paths>...]" in the
SYNOPSIS section, and "git checkout [-p][<tree-ish>][--]<paths>..."
as the header for the section that explains the "check out paths
from index/tree-ish" mode.  It is unclear if we require at least one
path, or it is entirely optional.

Actually, both are wrong.  Without the "-p(atch)" option, you must
have <pathspec> (otherwise, with a commit that is a <tree-ish>, you
would be checking out that commit to build a new history on top of
it).  With it, it is already clear that you are checking out paths,
it is optional.  In other words, you cannot omit both.

The source of the confusion is that -p(atch) is described as if it
is just another "optional" part and its description is lumped
together with the non patch mode, even though the actual end user
experience is vastly different.

Let's split the entry into two, and describe the regular mode and
the patch mode separately.  This allows us to make it clear that the
regular mode MUST be given at least one pathspec, that the patch
mode can be invoked with either '-p' or '--patch' but one of these
must be given, and that the pathspec is entirely optional in the
patch mode.

Also, revamp the explanation of "checkout paths" by removing
extraneous description at the beginning, that says "checking out
paths is not checking out a branch".  Explaining what it is for and
when the user wants to use it upfront is the most direct way to help
the readers.

Noticed-by: Robert P J Day
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---

 * As people burned braincycles discussing this earlier already,
   let's try to tie the loose end to help future readers of the
   manual.

 Documentation/git-checkout.txt | 32 +++++++++++++++++---------------
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index d6399c0af8..8e77a9de49 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -13,7 +13,8 @@ SYNOPSIS
 'git checkout' [-q] [-f] [-m] [--detach] <commit>
 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
-'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]
+'git checkout' [<tree-ish>] [--] <pathspec>...
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]
 
 DESCRIPTION
 -----------
@@ -78,20 +79,13 @@ be used to detach HEAD at the tip of the branch (`git checkout
 +
 Omitting <branch> detaches HEAD at the tip of the current branch.
 
-'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::
-
-	When <paths> or `--patch` are given, 'git checkout' does *not*
-	switch branches.  It updates the named paths in the working tree
-	from the index file or from a named <tree-ish> (most often a
-	commit).  In this case, the `-b` and `--track` options are
-	meaningless and giving either of them results in an error.  The
-	<tree-ish> argument can be used to specify a specific tree-ish
-	(i.e.  commit, tag or tree) to update the index for the given
-	paths before updating the working tree.
-+
-'git checkout' with <paths> or `--patch` is used to restore modified or
-deleted paths to their original contents from the index or replace paths
-with the contents from a named <tree-ish> (most often a commit-ish).
+'git checkout' [<tree-ish>] [--] <pathspec>...::
+	Restore modified or deleted paths in the working tree by
+	replacing with their original contents from the index, or
+	the contents from a named <tree-ish> (most often a
+	commit-ish). When a <tree-ish> is given, the paths that
+	match the <pathspec> are updated both in the index and in
+	the working tree.
 +
 The index may contain unmerged entries because of a previous failed merge.
 By default, if you try to check out such an entry from the index, the
@@ -101,6 +95,14 @@ specific side of the merge can be checked out of the index by
 using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
 file can be discarded to re-create the original conflicted merge result.
 
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
+	This is similar to the "check out paths to the working tree
+	from either the index or from a tree-ish" mode described
+	above, but lets you use the interactive interface to show
+	the "diff" output and choose which hunks to use in the
+	result.
+
+
 OPTIONS
 -------
 -q::
-- 
2.15.0-rc0-211-g82b28a23bd


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

* Re: [PATCH] checkout doc: clarify command line args for "checkout paths" mode
  2017-10-11  2:39           ` [PATCH] checkout doc: clarify command line args for "checkout paths" mode Junio C Hamano
@ 2017-10-11  3:22             ` Jonathan Nieder
  2017-10-11  5:02               ` Junio C Hamano
  0 siblings, 1 reply; 11+ messages in thread
From: Jonathan Nieder @ 2017-10-11  3:22 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing list, Kevin Daudt, Robert P. J. Day

Hi,

Junio C Hamano wrote:

[...]
> The source of the confusion is that -p(atch) is described as if it
> is just another "optional" part and its description is lumped
> together with the non patch mode, even though the actual end user
> experience is vastly different.

Makes sense.  This should have been done as part of b831deda
(2010-06-01), but better late than never.

Let's see how the patch goes...

[...]
>  Documentation/git-checkout.txt | 32 +++++++++++++++++---------------
>  1 file changed, 17 insertions(+), 15 deletions(-)
> 
> diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
> index d6399c0af8..8e77a9de49 100644
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -13,7 +13,8 @@ SYNOPSIS
>  'git checkout' [-q] [-f] [-m] [--detach] <commit>
>  'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
>  'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
> +'git checkout' [<tree-ish>] [--] <pathspec>...
> -'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]
> +'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]

This file is inconsistent about <commit> versus <commit-ish>, <paths>
versus <pathspec>, etc.

On the subject of <commit> versus <commit-ish>, nowadays <commit> is
almost always preferable.  Git commands consistently accept a tag
pointing to a commit where a commit is expected, so emphasizing that
feature by calling it a commit-ish only adds distraction.  That's not
what this patch is about, though.

Even for this particular form, the current file is inconsistent about
whether to call the arguments '<paths>...' or '<pathspec>...'.
"<paths>..." is even more strange when I think about it for a moment,
since it is the plural of the plural of path --- i.e., it implies that
each argument names multiple paths.  Why does this patch use
<pathspec> for the --no-patch case and <paths> for the --patch case?


>  DESCRIPTION
>  -----------
> @@ -78,20 +79,13 @@ be used to detach HEAD at the tip of the branch (`git checkout
>  +
>  Omitting <branch> detaches HEAD at the tip of the current branch.
>  
> +'git checkout' [<tree-ish>] [--] <pathspec>...::
> +	Restore modified or deleted paths in the working tree by
> +	replacing with their original contents from the index, or
> +	the contents from a named <tree-ish> (most often a

This sentence is hard to read:

- "Restore ... in" reads oddly, as though this is an art conservation
  project that takes place in the working tree.  Is the intent that
  the command will bring the content of those paths back to the
  working tree, or something else?

- "replacing with" reads a little briskly and informally.  In this
  context, "replacing them with" will work better.

- "their original contents from" also reads oddly.  "Their original
  content from" would be fine, meaning their original content as
  obtained from.  I was tempted to read this as "The original contents
  of", but that was a misreading.

- Similarly, "the contents from" perhaps should be "the content of".

Stepping back, what problem is this solving in the original text?
It said

	When <paths> or --patch are given, git checkout does *not*
	switch branches. It updates the named paths in the working
	tree from the index file or from a named <tree-ish> (most
	often a commit). In this case, the -b and --track options are
	meaningless and giving either of them results in an error. The
	<tree-ish> argument can be used to specify a specific tree-ish
	(i.e. commit, tag or tree) to update the index for the given
	paths before updating the working tree.

The "or --patch" would have to go, of course.  Is the problem that
the description focuses too much on what this form does not do?
To fix that, it could say

	Replace matching paths in the working tree with content
	from the index or the named tree (most often a commit).  The
	<tree-ish> argument can be used to specify a specific tree,
	commit, or tag that will be used to update the entries for
	matching paths in the index before updating the working tree.

One thing that doesn't tell is what happens to files that are present
in the worktree but deleted in the index or the named tree.  Does "git
checkout" delete them?  I remember wishing that it would but don't
remember whether it does, so it's probably worth mentioning the
manpage giving an answer.

... aha, now I see the next paragraph where this text came from.  I
still think I like my example text based on the first paragraph
better. :)

[...]
> @@ -101,6 +95,14 @@ specific side of the merge can be checked out of the index by
>  using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
>  file can be discarded to re-create the original conflicted merge result.
>  
> +'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
> +	This is similar to the "check out paths to the working tree
> +	from either the index or from a tree-ish" mode described
> +	above, but lets you use the interactive interface to show
> +	the "diff" output and choose which hunks to use in the
> +	result.

s/use/apply/, perhaps.

The options section explains --patch again.  Maybe that should point
back to here to avoid some duplication.

Thanks,
Jonathan

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

* Re: [PATCH] checkout doc: clarify command line args for "checkout paths" mode
  2017-10-11  3:22             ` Jonathan Nieder
@ 2017-10-11  5:02               ` Junio C Hamano
  2017-10-11  5:16                 ` Jonathan Nieder
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2017-10-11  5:02 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: Git Mailing list, Kevin Daudt, Robert P. J. Day

Jonathan Nieder <jrnieder@gmail.com> writes:

>> +'git checkout' [<tree-ish>] [--] <pathspec>...
>> -'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]
>> +'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]
> ...
> Even for this particular form, the current file is inconsistent about
> whether to call the arguments '<paths>...' or '<pathspec>...'.
> "<paths>..." is even more strange when I think about it for a moment,
> since it is the plural of the plural of path --- i.e., it implies that
> each argument names multiple paths.  Why does this patch use
> <pathspec> for the --no-patch case and <paths> for the --patch case?

No particular reason, other than "the original had <paths>, which
was inherited by the line that was minimally modified, while the
line I typed anew has more preferrable <pathspec>" ;-)

>>  DESCRIPTION
>>  -----------
>> @@ -78,20 +79,13 @@ be used to detach HEAD at the tip of the branch (`git checkout
>>  +
>>  Omitting <branch> detaches HEAD at the tip of the current branch.
>>  
>> +'git checkout' [<tree-ish>] [--] <pathspec>...::
>> +	Restore modified or deleted paths in the working tree by
>> +	replacing with their original contents from the index, or
>> +	the contents from a named <tree-ish> (most often a
>
> This sentence is hard to read:
>
> - "Restore ... in" reads oddly, as though this is an art conservation
>   project that takes place in the working tree.  Is the intent that
>   the command will bring the content of those paths back to the
>   working tree, or something else?

The "restore" was taken from the sentence that was buried in the
paragraph removed by this patch.  I think the original used the
word, fully intending to evoke "an art conservation project"
connotation---after all, the user made a mess in the working tree
and a known-to-be-good copy stored in the index or tree is used to
restore the working tree copy.

> To fix that, it could say
>
> 	Replace matching paths in the working tree with content
> 	from the index or the named tree (most often a commit).  The
> 	<tree-ish> argument can be used to specify a specific tree,
> 	commit, or tag that will be used to update the entries for
> 	matching paths in the index before updating the working tree.

It could (and it was what my earlier draft said), but I found it
less clear than necessary.  It does not matter the data goes from
tree-ish to index and then to the working tree, and a more important
thing is to say both are updated from the tree-ish, for example.

> ... aha, now I see the next paragraph where this text came from.  I
> still think I like my example text based on the first paragraph
> better. :)

And I already said the reason why I started from that and improved
it.

>> @@ -101,6 +95,14 @@ specific side of the merge can be checked out of the index by
>>  using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
>>  file can be discarded to re-create the original conflicted merge result.
>>  
>> +'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
>> +	This is similar to the "check out paths to the working tree
>> +	from either the index or from a tree-ish" mode described
>> +	above, but lets you use the interactive interface to show
>> +	the "diff" output and choose which hunks to use in the
>> +	result.
>
> s/use/apply/, perhaps.

That might sound technically more accurate, but when we consider
that this application is done in reverse, it is probably not such a
good idea to say "apply" here.  The user chooses which one to use,
and the way it is "used" is by applying the hunk in reverse.
"choose the preimage of which hunks to use in the result" may be
more technically accurate, but it is a mouthful.  I dunno.

The interactive UI explains it by saying

	Discard this hunk from worktree?

which is probably the easiest explanation.

> The options section explains --patch again.  Maybe that should point
> back to here to avoid some duplication.

here is another attempt, this time to avoid "Restore" and <paths>...


 Documentation/git-checkout.txt | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index d6399c0af8..088266e7e9 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -13,7 +13,8 @@ SYNOPSIS
 'git checkout' [-q] [-f] [-m] [--detach] <commit>
 'git checkout' [-q] [-f] [-m] [[-b|-B|--orphan] <new_branch>] [<start_point>]
 'git checkout' [-f|--ours|--theirs|-m|--conflict=<style>] [<tree-ish>] [--] <paths>...
-'git checkout' [-p|--patch] [<tree-ish>] [--] [<paths>...]
+'git checkout' [<tree-ish>] [--] <pathspec>...
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<paths>...]
 
 DESCRIPTION
 -----------
@@ -78,20 +79,13 @@ be used to detach HEAD at the tip of the branch (`git checkout
 +
 Omitting <branch> detaches HEAD at the tip of the current branch.
 
-'git checkout' [-p|--patch] [<tree-ish>] [--] <pathspec>...::
+'git checkout' [<tree-ish>] [--] <pathspec>...::
 
-	When <paths> or `--patch` are given, 'git checkout' does *not*
-	switch branches.  It updates the named paths in the working tree
-	from the index file or from a named <tree-ish> (most often a
-	commit).  In this case, the `-b` and `--track` options are
-	meaningless and giving either of them results in an error.  The
-	<tree-ish> argument can be used to specify a specific tree-ish
-	(i.e.  commit, tag or tree) to update the index for the given
-	paths before updating the working tree.
-+
-'git checkout' with <paths> or `--patch` is used to restore modified or
-deleted paths to their original contents from the index or replace paths
-with the contents from a named <tree-ish> (most often a commit-ish).
+	Overwrite paths in the working tree by replacing with the
+	contents in the index or in the <tree-ish> (most often a
+	commit).  When a <tree-ish> is given, the paths that
+	match the <pathspec> are updated both in the index and in
+	the working tree.
 +
 The index may contain unmerged entries because of a previous failed merge.
 By default, if you try to check out such an entry from the index, the
@@ -101,6 +95,14 @@ specific side of the merge can be checked out of the index by
 using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
 file can be discarded to re-create the original conflicted merge result.
 
+'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
+	This is similar to the "check out paths to the working tree
+	from either the index or from a tree-ish" mode described
+	above, but lets you use the interactive interface to show
+	the "diff" output and choose which hunks to use in the
+	result.  See below for the descriptoin of `--patch` option.
+
+
 OPTIONS
 -------
 -q::

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

* Re: [PATCH] checkout doc: clarify command line args for "checkout paths" mode
  2017-10-11  5:02               ` Junio C Hamano
@ 2017-10-11  5:16                 ` Jonathan Nieder
  0 siblings, 0 replies; 11+ messages in thread
From: Jonathan Nieder @ 2017-10-11  5:16 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Git Mailing list, Kevin Daudt, Robert P. J. Day

Junio C Hamano wrote:

> here is another attempt, this time to avoid "Restore" and <paths>...
>
>  Documentation/git-checkout.txt | 30 ++++++++++++++++--------------
>  1 file changed, 16 insertions(+), 14 deletions(-)

Thanks.  I find this one easier to read indeed.

[...]
> --- a/Documentation/git-checkout.txt
> +++ b/Documentation/git-checkout.txt
> @@ -13,7 +13,8 @@ SYNOPSIS
[...]
> @@ -101,6 +95,14 @@ specific side of the merge can be checked out of the index by
>  using `--ours` or `--theirs`.  With `-m`, changes made to the working tree
>  file can be discarded to re-create the original conflicted merge result.
>  
> +'git checkout' (-p|--patch) [<tree-ish>] [--] [<pathspec>...]::
> +	This is similar to the "check out paths to the working tree
> +	from either the index or from a tree-ish" mode described
> +	above, but lets you use the interactive interface to show
> +	the "diff" output and choose which hunks to use in the
> +	result.  See below for the descriptoin of `--patch` option.

nit: s/descriptoin/description/

With that tweak,
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>

Thanks.

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

end of thread, other threads:[~2017-10-11  5:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-30  9:27 "man git-checkout", man page is inconsistent between SYNOPSIS and details Robert P. J. Day
2017-09-30 14:32 ` Kevin Daudt
2017-09-30 15:01   ` Robert P. J. Day
2017-09-30 22:04   ` Robert P. J. Day
2017-10-01  3:49     ` Junio C Hamano
2017-10-01 10:05       ` Robert P. J. Day
2017-10-02  0:29         ` Junio C Hamano
2017-10-11  2:39           ` [PATCH] checkout doc: clarify command line args for "checkout paths" mode Junio C Hamano
2017-10-11  3:22             ` Jonathan Nieder
2017-10-11  5:02               ` Junio C Hamano
2017-10-11  5:16                 ` Jonathan Nieder

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).