git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Denton Liu <liu.denton@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] builtin/diff: fix incorrect comment
Date: Wed, 17 Jun 2020 11:07:16 -0700	[thread overview]
Message-ID: <xmqqzh91va5n.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <a9aea5dbb821544eea636bc5de9fe8185bb603fb.1592219700.git.liu.denton@gmail.com> (Denton Liu's message of "Mon, 15 Jun 2020 07:15:07 -0400")

Denton Liu <liu.denton@gmail.com> writes:

> A comment in cmd_diff() states that if one tree-ish and no blobs are
> provided, it would provide a diff between the tree and the cache. This
> is incorrect because a diff happens between the tree-ish and the working
> tree. Remove the `--cached` in the comment so that the correct behavior
> is shown.

Perhaps "diff-index [--cached]" is more appropriate, then?  After
all, "git diff --cached HEAD" would be N=1 M=0 case, no?

> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
>  builtin/diff.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/diff.c b/builtin/diff.c
> index 8537b17bd5..1ebab58c55 100644
> --- a/builtin/diff.c
> +++ b/builtin/diff.c
> @@ -276,7 +276,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
>  	 *	compare a blob with a working tree file.
>  	 *
>  	 * N=1, M=0:
> -	 *      tree vs cache (diff-index --cached)
> +	 *      tree vs files (diff-index)
>  	 *
>  	 * N=2, M=0:
>  	 *      tree vs tree (diff-tree)

  reply	other threads:[~2020-06-17 18:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-15 11:15 [PATCH] builtin/diff: fix incorrect comment Denton Liu
2020-06-17 18:07 ` Junio C Hamano [this message]
2020-06-18 10:43 ` [PATCH v2] builtin/diff: update usage comment Denton Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzh91va5n.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).