Re: [PATCH] Add --show-touched option to show "diff --git" line when contents are unchanged

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

 



Junio C Hamano <gitster@xxxxxxxxx> writes:

> Matthieu Moy <Matthieu.Moy@xxxxxxx> writes:
>
>>> "git-status $args" on the other hand is a preview of "what would
>>> happen if I say 'git-commit $args'", and in order to compute
>>> that, you would fundamentally need to be able to write into the
>>> object store.  In a special case of giving empty $args it can be
>>> read-only.
>>
>> Can you give an example where it _could_ not be read-only?
>
> Think of what "git commit -a" would have to do.

I don't know whether it was a typo, but we're not talking about
"commit", but "status".

> It needs to hash and deposit a new object for blobs that have been
> modified. Where do those new blob object go?

git-status _does_ hash and deposit new objects, but it doesn't _need_
to. It can very well show you what "commit -a" would do without
actually doing it.

A trivial (and very stupid, yes) way to do this would be

cp -r . /tmp/git/
cd /tmp/git
git-status -a

There's no visible side-effects for the user.

IIRC, git-status -a does actually "git-add" the modified objects, but
does so in a temporary index, so I believe the objects you leave in
the objects database are not pointed to by anyone (indeed, I just
checked, git-fsck --unreachable shows the dangling blob), and are not
really useful (but will probably be used later when you run commit or
add).

> Maybe in a theoretical ideal world, you might prefer to
> reverting back to the stat-dirty original index to make
> git-status appear a read-only operation, with continued degraded
> performance.  You are welcome to reimplement it that way, and
> the patch should be trivial (while git-commit.sh is still a
> script, at least) but that is not what we did.

You still didn't understand my point about the difference between
user-specification and internal behavior. I'm very happy with
git-status updating the stat information in the index, since it is not
suppose to have user-visible side effects (it has with the current
empty-diff-for-touched-files behavior of git-diff).

Now, at that point, if I still didn't manage to show you the
difference between user-visible behavior and implementation, I believe
I have no better thing to do than giving up.

-- 
Matthieu
-
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