git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: Andreas Ericsson <ae@op5.se>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-diff: Introduce --index and deprecate --cached.
Date: Fri, 08 Dec 2006 18:24:31 -0800	[thread overview]
Message-ID: <7vac1xg61s.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <20061130115913.EA36C5BA19@nox.op5.se> (Andreas Ericsson's message of "Thu, 30 Nov 2006 12:43:13 +0100")

Andreas Ericsson <ae@op5.se> writes:

> 'git diff --cached' still works, but its use is discouraged
> in the documentation. 'git diff --index' does the same thing
> and is consistent with how 'git apply --index' works.

Although I've applied this long time ago (in git timescale
anyway), this patch and the above rationale is wrong.

'diff --cached' is more in line with how 'apply --cached' works,
not how 'apply --index' works.

With apply, --cached and --index both tell the command to be
aware of the index, but --cached means "operate on the index,
and never look at working tree", while --index means "operate
both on the index and working tree at the same time".  In
particular, the former does not care if the file in the working
tree matches the index, while the latter does.

'diff --cached' is about the tree and the index without looking
at the working tree.  Since there is no mode of operation that
looks at both the index and the working tree in the underlying
diff-index, I made the mistake of applying this patch, but it is
conceivable that we may want to have a 'diff --index' that
compares HEAD, the index and the working tree, perhaps in a
combined diff format.

I think we should revert this patch.

  reply	other threads:[~2006-12-09  2:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-30 11:43 [PATCH] git-diff: Introduce --index and deprecate --cached Andreas Ericsson
2006-12-09  2:24 ` Junio C Hamano [this message]
2006-12-09  2:29   ` Junio C Hamano
  -- strict thread matches above, loose matches on Subject: below --
2020-11-10  7:32 Jake Steward
2021-09-12 21:39 nu ja
2022-06-15  7:58 Ali Almrhbi
2022-12-17 21:48 Bob Swift
2023-10-10  3:46 Russell Nelson

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=7vac1xg61s.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    /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.
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).