git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 0/3] Fix a few documentation errors around the raw diff output
@ 2022-06-13 12:29 Philippe Blain via GitGitGadget
  2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Philippe Blain via GitGitGadget @ 2022-06-13 12:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Philippe Blain

Here are a few doc fixes for some things that I noticed out while reading
the man pages for 'git diff-files' and 'git diff-index'. These are quite
old!

Philippe Blain (3):
  diff-format.txt: fix ancient copy-paste error
  diff-format.txt: correct misleading wording
  diff-index.txt: update raw output format in examples

 Documentation/diff-format.txt    | 6 +++---
 Documentation/git-diff-index.txt | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)


base-commit: 5699ec1b0aec51b9e9ba5a2785f65970c5a95d84
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1259%2Fphil-blain%2Fdiff-files-doc-fixes-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1259/phil-blain/diff-files-doc-fixes-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1259
-- 
gitgitgadget

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

* [PATCH 1/3] diff-format.txt: fix ancient copy-paste error
  2022-06-13 12:29 [PATCH 0/3] Fix a few documentation errors around the raw diff output Philippe Blain via GitGitGadget
@ 2022-06-13 12:29 ` Philippe Blain via GitGitGadget
  2022-06-13 18:23   ` Junio C Hamano
  2022-06-13 18:26   ` Junio C Hamano
  2022-06-13 12:29 ` [PATCH 2/3] diff-format.txt: correct misleading wording Philippe Blain via GitGitGadget
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 11+ messages in thread
From: Philippe Blain via GitGitGadget @ 2022-06-13 12:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Fix what is probably a copy-paste error dating back all the way to
b6d8f309d9 ([PATCH] diff-raw format update take #2., 2005-05-23).

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/diff-format.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index 7a9c3b6ff4c..b8319eeb41d 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -43,7 +43,7 @@ That is, from the left to the right:
 . a space.
 . sha1 for "src"; 0\{40\} if creation or unmerged.
 . a space.
-. sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree".
+. sha1 for "dst"; 0\{40\} if deletion, unmerged or "look at work tree".
 . a space.
 . status, followed by optional "score" number.
 . a tab or a NUL when `-z` option is used.
-- 
gitgitgadget


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

* [PATCH 2/3] diff-format.txt: correct misleading wording
  2022-06-13 12:29 [PATCH 0/3] Fix a few documentation errors around the raw diff output Philippe Blain via GitGitGadget
  2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
@ 2022-06-13 12:29 ` Philippe Blain via GitGitGadget
  2022-06-13 18:56   ` Junio C Hamano
  2022-06-13 12:29 ` [PATCH 3/3] diff-index.txt: update raw output format in examples Philippe Blain via GitGitGadget
  2022-06-13 18:15 ` [PATCH 0/3] Fix a few documentation errors around the raw diff output Junio C Hamano
  3 siblings, 1 reply; 11+ messages in thread
From: Philippe Blain via GitGitGadget @ 2022-06-13 12:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Near the end of the "Raw output format" section, an example shows the
output of 'git diff-files' for a tracked file modified on disk but not
yet added to the index. However the wording is:

    <sha1> is shown as all 0's if a file is new on the filesystem
    and it is out of sync with the index.

which is confusing since it can be understood to mean that 'file' is a
new, yet untracked file, in which case 'git diff-files' does not care
about it at all.

When this example was introduced all the way back in c64b9b8860
(Reference documentation for the core git commands., 2005-05-05), 'old'
and 'new' referred to the two entities being compared, depending on the
command being used (diff-index, diff-tree or diff-files - which at the
time were diff-cache, diff-tree and show-diff). The wording used at the
time was:

    <new-sha1> is shown as all 0's if new is a file on the
    filesystem and it is out of sync with the cache.

This section was reworked in 81e50eabf0 ([PATCH] The diff-raw
format updates., 2005-05-21) and the mention of the meaning of 'new' and
'old' was removed. Then in f73ae1fc5d (Some typos and light editing of
various manpages, 2005-10-05), the wording was changed to what it is
now.

In addition, in b6d8f309d9 ([PATCH] diff-raw format update take #2.,
2005-05-23), the section was further reworked and did not use '<sha1>'
anymore, making the example the sole user of this token.

Rework the introductory sentence of the example to instead refer to
'sha1 for "dst"', which is what the text description above it uses, and
fix the wording so that we do not mention a "new file".

While at it, also tweak the wording used in the description of the raw
format to explicitely state that all 0's are used for the destination
hash if the working tree is out of sync with the index, instead of the
more vague "look at worktree".

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/diff-format.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
index b8319eeb41d..a3ae8747a22 100644
--- a/Documentation/diff-format.txt
+++ b/Documentation/diff-format.txt
@@ -43,7 +43,7 @@ That is, from the left to the right:
 . a space.
 . sha1 for "src"; 0\{40\} if creation or unmerged.
 . a space.
-. sha1 for "dst"; 0\{40\} if deletion, unmerged or "look at work tree".
+. sha1 for "dst"; 0\{40\} if deletion, unmerged or "work tree out of sync with the index".
 . a space.
 . status, followed by optional "score" number.
 . a tab or a NUL when `-z` option is used.
@@ -69,8 +69,8 @@ percentage of similarity between the source and target of the move or
 copy).  Status letter M may be followed by a score (denoting the
 percentage of dissimilarity) for file rewrites.
 
-<sha1> is shown as all 0's if a file is new on the filesystem
-and it is out of sync with the index.
+The sha1 for "dst" is shown as all 0's if a file on the filesystem
+is out of sync with the index.
 
 Example:
 
-- 
gitgitgadget


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

* [PATCH 3/3] diff-index.txt: update raw output format in examples
  2022-06-13 12:29 [PATCH 0/3] Fix a few documentation errors around the raw diff output Philippe Blain via GitGitGadget
  2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
  2022-06-13 12:29 ` [PATCH 2/3] diff-format.txt: correct misleading wording Philippe Blain via GitGitGadget
@ 2022-06-13 12:29 ` Philippe Blain via GitGitGadget
  2022-06-13 18:59   ` Junio C Hamano
  2022-06-13 18:15 ` [PATCH 0/3] Fix a few documentation errors around the raw diff output Junio C Hamano
  3 siblings, 1 reply; 11+ messages in thread
From: Philippe Blain via GitGitGadget @ 2022-06-13 12:29 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

The two examples in the doc for 'git diff-index' were not updated when
the raw output format was changed in 81e50eabf0 ([PATCH] The diff-raw
format updates., 2005-05-21) (first example) and in b6d8f309d9 ([PATCH]
diff-raw format update take #2., 2005-05-23) and 7cb6ac1e4b (diff:
diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value,
2017-12-03) (second example).

Update the output, inventing some characters to complete the source
hash in the second example. Also correct the destination mode in the
second example, which was wrongly '100664' since the addition of the
example in c64b9b8860 (Reference documentation for the core git
commands., 2005-05-05).

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
 Documentation/git-diff-index.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/git-diff-index.txt b/Documentation/git-diff-index.txt
index 679cae27d9b..c30d8f0da8a 100644
--- a/Documentation/git-diff-index.txt
+++ b/Documentation/git-diff-index.txt
@@ -69,8 +69,8 @@ done an `update-index` to make that effective in the index file.
 matches my working directory. But doing a 'git diff-index' does:
 
   torvalds@ppc970:~/git> git diff-index --cached HEAD
-  -100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        commit.c
-  +100644 blob    4161aecc6700a2eb579e842af0b7f22b98443f74        git-commit.c
+  :100644 000000 4161aecc6700a2eb579e842af0b7f22b98443f74 0000000000000000000000000000000000000000 D	commit.c
+  :000000 100644 0000000000000000000000000000000000000000 4161aecc6700a2eb579e842af0b7f22b98443f74 A	git-commit.c
 
 You can see easily that the above is a rename.
 
@@ -103,7 +103,7 @@ have not actually done a 'git update-index' on it yet - there is no
 "object" associated with the new state, and you get:
 
   torvalds@ppc970:~/v2.6/linux> git diff-index --abbrev HEAD
-  :100644 100664 7476bb... 000000...      kernel/sched.c
+  :100644 100644 7476bb5ba 000000000 M	kernel/sched.c
 
 i.e., it shows that the tree has changed, and that `kernel/sched.c` is
 not up to date and may contain new stuff. The all-zero sha1 means that to
-- 
gitgitgadget

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

* Re: [PATCH 0/3] Fix a few documentation errors around the raw diff output
  2022-06-13 12:29 [PATCH 0/3] Fix a few documentation errors around the raw diff output Philippe Blain via GitGitGadget
                   ` (2 preceding siblings ...)
  2022-06-13 12:29 ` [PATCH 3/3] diff-index.txt: update raw output format in examples Philippe Blain via GitGitGadget
@ 2022-06-13 18:15 ` Junio C Hamano
  3 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2022-06-13 18:15 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget; +Cc: git, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Here are a few doc fixes for some things that I noticed out while reading
> the man pages for 'git diff-files' and 'git diff-index'. These are quite
> old!

Indeed ;-)

>
> Philippe Blain (3):
>   diff-format.txt: fix ancient copy-paste error
>   diff-format.txt: correct misleading wording
>   diff-index.txt: update raw output format in examples
>
>  Documentation/diff-format.txt    | 6 +++---
>  Documentation/git-diff-index.txt | 6 +++---
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
>
> base-commit: 5699ec1b0aec51b9e9ba5a2785f65970c5a95d84
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1259%2Fphil-blain%2Fdiff-files-doc-fixes-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1259/phil-blain/diff-files-doc-fixes-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/1259

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

* Re: [PATCH 1/3] diff-format.txt: fix ancient copy-paste error
  2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
@ 2022-06-13 18:23   ` Junio C Hamano
  2022-06-13 18:26   ` Junio C Hamano
  1 sibling, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2022-06-13 18:23 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget; +Cc: git, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> Fix what is probably a copy-paste error dating back all the way to
> b6d8f309d9 ([PATCH] diff-raw format update take #2., 2005-05-23).

This indeed is an improvement.

"src" can legitimately be "0\{40\}" for a creation patch, e.g. when
the stat information is stale, but we can argue that it falls into
"look at work tree" case to justify removal of "creation", and use
the space to add "deletion".

> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> ---
>  Documentation/diff-format.txt | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
> index 7a9c3b6ff4c..b8319eeb41d 100644
> --- a/Documentation/diff-format.txt
> +++ b/Documentation/diff-format.txt
> @@ -43,7 +43,7 @@ That is, from the left to the right:
>  . a space.
>  . sha1 for "src"; 0\{40\} if creation or unmerged.
>  . a space.
> -. sha1 for "dst"; 0\{40\} if creation, unmerged or "look at work tree".
> +. sha1 for "dst"; 0\{40\} if deletion, unmerged or "look at work tree".
>  . a space.
>  . status, followed by optional "score" number.
>  . a tab or a NUL when `-z` option is used.

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

* Re: [PATCH 1/3] diff-format.txt: fix ancient copy-paste error
  2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
  2022-06-13 18:23   ` Junio C Hamano
@ 2022-06-13 18:26   ` Junio C Hamano
  2022-06-14 12:20     ` Philippe Blain
  1 sibling, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2022-06-13 18:26 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget; +Cc: git, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> Fix what is probably a copy-paste error dating back all the way to
> b6d8f309d9 ([PATCH] diff-raw format update take #2., 2005-05-23).

I'll retitle and rewrite the message like so:

    diff-format.txt: dst can be 0* SHA-1 when path is deleted, too
    
    "dst" can legitimately be "0\{40\}" for a creation patch, e.g. when
    the stat information is stale, but it falls into "look at work tree"
    case.  The original description in b6d8f309 ([PATCH] diff-raw format
    update take #2., 2005-05-23) forgot that deletion also makes the
    "dst" 0* SHA-1.
    
    Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thanks.

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

* Re: [PATCH 2/3] diff-format.txt: correct misleading wording
  2022-06-13 12:29 ` [PATCH 2/3] diff-format.txt: correct misleading wording Philippe Blain via GitGitGadget
@ 2022-06-13 18:56   ` Junio C Hamano
  2022-06-14 12:31     ` Philippe Blain
  0 siblings, 1 reply; 11+ messages in thread
From: Junio C Hamano @ 2022-06-13 18:56 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget; +Cc: git, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> Near the end of the "Raw output format" section, an example shows the
> output of 'git diff-files' for a tracked file modified on disk but not
> yet added to the index. However the wording is:
>
>     <sha1> is shown as all 0's if a file is new on the filesystem
>     and it is out of sync with the index.
>
> which is confusing since it can be understood to mean that 'file' is a
> new, yet untracked file, in which case 'git diff-files' does not care
> about it at all.

I do not think such an understanding is sensible, as "untracked
file" cannot be "out of sync with the index", because even its stale
version wouldn't be in the index if it is untracked.

But I agree that not all people are sensible, and it would be nicer
if the documentation helped them, too ;-)

> When this example was introduced all the way back in c64b9b8860
> (Reference documentation for the core git commands., 2005-05-05), 'old'
> and 'new' referred to the two entities being compared, depending on the
> command being used (diff-index, diff-tree or diff-files - which at the
> time were diff-cache, diff-tree and show-diff). The wording used at the
> time was:
>
>     <new-sha1> is shown as all 0's if new is a file on the
>     filesystem and it is out of sync with the cache.

Yeah, I remember this version of wording.

> Rework the introductory sentence of the example to instead refer to
> 'sha1 for "dst"', which is what the text description above it uses, and
> fix the wording so that we do not mention a "new file".

That's good.  We may need to upgrade them to 'object name' to wean
ourselves away from SHA-1 but that should be a separate topic.

> While at it, also tweak the wording used in the description of the raw
> format to explicitely state that all 0's are used for the destination
> hash if the working tree is out of sync with the index, instead of the
> more vague "look at worktree".

I am not sure if that is a good idea.  Those who understand what the
"work tree out of sync with" phrase mean would understand "look at
work tree" but the reverse would not be true.

The other hunk about "new" -> "dst" is a good change regardless, but
even there, "out of sync with" may need to be rewritten to make it
easier to understand.  Is it different from "the index does not know
the exact value (hence you need to look in the working tree if you
really cared to find it out, perhaps with hash-object)"?

Thanks.

> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
> ---
>  Documentation/diff-format.txt | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
> index b8319eeb41d..a3ae8747a22 100644
> --- a/Documentation/diff-format.txt
> +++ b/Documentation/diff-format.txt
> @@ -43,7 +43,7 @@ That is, from the left to the right:
>  . a space.
>  . sha1 for "src"; 0\{40\} if creation or unmerged.
>  . a space.
> -. sha1 for "dst"; 0\{40\} if deletion, unmerged or "look at work tree".
> +. sha1 for "dst"; 0\{40\} if deletion, unmerged or "work tree out of sync with the index".
>  . a space.
>  . status, followed by optional "score" number.
>  . a tab or a NUL when `-z` option is used.
> @@ -69,8 +69,8 @@ percentage of similarity between the source and target of the move or
>  copy).  Status letter M may be followed by a score (denoting the
>  percentage of dissimilarity) for file rewrites.
>  
> -<sha1> is shown as all 0's if a file is new on the filesystem
> -and it is out of sync with the index.
> +The sha1 for "dst" is shown as all 0's if a file on the filesystem
> +is out of sync with the index.
>  
>  Example:

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

* Re: [PATCH 3/3] diff-index.txt: update raw output format in examples
  2022-06-13 12:29 ` [PATCH 3/3] diff-index.txt: update raw output format in examples Philippe Blain via GitGitGadget
@ 2022-06-13 18:59   ` Junio C Hamano
  0 siblings, 0 replies; 11+ messages in thread
From: Junio C Hamano @ 2022-06-13 18:59 UTC (permalink / raw)
  To: Philippe Blain via GitGitGadget; +Cc: git, Philippe Blain

"Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:

> From: Philippe Blain <levraiphilippeblain@gmail.com>
>
> The two examples in the doc for 'git diff-index' were not updated when
> the raw output format was changed in 81e50eabf0 ([PATCH] The diff-raw
> format updates., 2005-05-21) (first example) and in b6d8f309d9 ([PATCH]
> diff-raw format update take #2., 2005-05-23) and 7cb6ac1e4b (diff:
> diff_aligned_abbrev: remove ellipsis after abbreviated SHA-1 value,
> 2017-12-03) (second example).
>
> Update the output, inventing some characters to complete the source
> hash in the second example. Also correct the destination mode in the
> second example, which was wrongly '100664' since the addition of the
> example in c64b9b8860 (Reference documentation for the core git
> commands., 2005-05-05).
>
> Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>


Thanks.

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

* Re: [PATCH 1/3] diff-format.txt: fix ancient copy-paste error
  2022-06-13 18:26   ` Junio C Hamano
@ 2022-06-14 12:20     ` Philippe Blain
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Blain @ 2022-06-14 12:20 UTC (permalink / raw)
  To: Junio C Hamano, Philippe Blain via GitGitGadget; +Cc: git

Hi Junio,

Le 2022-06-13 à 14:26, Junio C Hamano a écrit :
> "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> From: Philippe Blain <levraiphilippeblain@gmail.com>
>>
>> Fix what is probably a copy-paste error dating back all the way to
>> b6d8f309d9 ([PATCH] diff-raw format update take #2., 2005-05-23).
> 
> I'll retitle and rewrite the message like so:
> 
>     diff-format.txt: dst can be 0* SHA-1 when path is deleted, too
>     
>     "dst" can legitimately be "0\{40\}" for a creation patch, e.g. when
>     the stat information is stale, but it falls into "look at work tree"
>     case.  The original description in b6d8f309 ([PATCH] diff-raw format
>     update take #2., 2005-05-23) forgot that deletion also makes the
>     "dst" 0* SHA-1.
>     
>     Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
>     Signed-off-by: Junio C Hamano <gitster@pobox.com>
> 
> Thanks.
> 

OK, that makes sense. I hadn't thought of the case you are mentioning here
(new file added to the index and then modified).

Thanks,

Philippe.

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

* Re: [PATCH 2/3] diff-format.txt: correct misleading wording
  2022-06-13 18:56   ` Junio C Hamano
@ 2022-06-14 12:31     ` Philippe Blain
  0 siblings, 0 replies; 11+ messages in thread
From: Philippe Blain @ 2022-06-14 12:31 UTC (permalink / raw)
  To: Junio C Hamano, Philippe Blain via GitGitGadget; +Cc: git



Le 2022-06-13 à 14:56, Junio C Hamano a écrit :
> "Philippe Blain via GitGitGadget" <gitgitgadget@gmail.com> writes:
> 
>> From: Philippe Blain <levraiphilippeblain@gmail.com>
>>
>> Near the end of the "Raw output format" section, an example shows the
>> output of 'git diff-files' for a tracked file modified on disk but not
>> yet added to the index. However the wording is:
>>
>>     <sha1> is shown as all 0's if a file is new on the filesystem
>>     and it is out of sync with the index.
>>
>> which is confusing since it can be understood to mean that 'file' is a
>> new, yet untracked file, in which case 'git diff-files' does not care
>> about it at all.
> 
> I do not think such an understanding is sensible, as "untracked
> file" cannot be "out of sync with the index", because even its stale
> version wouldn't be in the index if it is untracked.
> 
> But I agree that not all people are sensible, and it would be nicer
> if the documentation helped them, too ;-)

Well, call me not sensible then ;) When I read that, I had trouble understanding
what was meant precisely because I had what you wrote in mind.

> 
>> When this example was introduced all the way back in c64b9b8860
>> (Reference documentation for the core git commands., 2005-05-05), 'old'
>> and 'new' referred to the two entities being compared, depending on the
>> command being used (diff-index, diff-tree or diff-files - which at the
>> time were diff-cache, diff-tree and show-diff). The wording used at the
>> time was:
>>
>>     <new-sha1> is shown as all 0's if new is a file on the
>>     filesystem and it is out of sync with the cache.
> 
> Yeah, I remember this version of wording.
> 
>> Rework the introductory sentence of the example to instead refer to
>> 'sha1 for "dst"', which is what the text description above it uses, and
>> fix the wording so that we do not mention a "new file".
> 
> That's good.  We may need to upgrade them to 'object name' to wean
> ourselves away from SHA-1 but that should be a separate topic.
> 
>> While at it, also tweak the wording used in the description of the raw
>> format to explicitely state that all 0's are used for the destination
>> hash if the working tree is out of sync with the index, instead of the
>> more vague "look at worktree".
> 
> I am not sure if that is a good idea.  Those who understand what the
> "work tree out of sync with" phrase mean would understand "look at
> work tree" but the reverse would not be true.

I'm not sure I agree. Even looking at it from a grammatical perspective,
"the hash is all zero if a path is unmerged, is a deletion or is out of sync
with the index" makes more sense to me than "the hash is all zero if a path is 
unmerged, is a deletion or "look at worktree""...

> 
> The other hunk about "new" -> "dst" is a good change regardless, but
> even there, "out of sync with" may need to be rewritten to make it
> easier to understand.  Is it different from "the index does not know
> the exact value (hence you need to look in the working tree if you
> really cared to find it out, perhaps with hash-object)"?

I think it's clear what is meant, I don't think we need to change it.

Thanks,

Philippe.

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

end of thread, other threads:[~2022-06-14 12:39 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13 12:29 [PATCH 0/3] Fix a few documentation errors around the raw diff output Philippe Blain via GitGitGadget
2022-06-13 12:29 ` [PATCH 1/3] diff-format.txt: fix ancient copy-paste error Philippe Blain via GitGitGadget
2022-06-13 18:23   ` Junio C Hamano
2022-06-13 18:26   ` Junio C Hamano
2022-06-14 12:20     ` Philippe Blain
2022-06-13 12:29 ` [PATCH 2/3] diff-format.txt: correct misleading wording Philippe Blain via GitGitGadget
2022-06-13 18:56   ` Junio C Hamano
2022-06-14 12:31     ` Philippe Blain
2022-06-13 12:29 ` [PATCH 3/3] diff-index.txt: update raw output format in examples Philippe Blain via GitGitGadget
2022-06-13 18:59   ` Junio C Hamano
2022-06-13 18:15 ` [PATCH 0/3] Fix a few documentation errors around the raw diff output 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).