Re: [PATCH] git-diff: Introduce --index and deprecate --cached.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Ericsson <ae@xxxxxx> 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.

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]