Re: [PATCH] git-diff: Add --staged as a synonym for --cached.

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

 



On Wed, Nov 12, 2008 at 6:10 AM, Johannes Schindelin
<Johannes.Schindelin@xxxxxx> wrote:
> Just in case anybody thought about creating tree objects on the fly and
> use their SHA-1s: that won't fly, as you can have unmerged entries in the
> index.  So STAGED.. is a _fundamentally_ different thing from HEAD^..

Hmm, I tried it to see, and "git diff --cached branchname" when there
are unmerged entries looks like this (one line):

* Unmerged path /whatever/file

Which is pretty unhelpful anyhow (although I don't know what would be
better).  I can think of several ways to produce the same output,
including using a magic SHA-1 that means "unmerged", or using a
different filemode for unmerged files in the tree object, or actually
including all three versions of the file in the tree object, each with
a different mode.  I admit that sounds pretty gross, though.

> Maybe we could play tricks with a special staged_commit (pretending to be
> a commit with SHA-1 000000... so that git log STAGED.. would do the same
> as plain git log, the rationale being that STAGED is no commit, so ^STAGED
> should be a nop).

I might have imagined STAGED to be a child commit of HEAD (or rather,
its parents should be the same as if you did 'git commit'), but I
don't really know for sure.  In such a case, ^STAGED would definitely
have a meaning.

Have fun,

Avery
--
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]

  Powered by Linux