git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug? git show behaves incorrectly when called on a stash object
@ 2013-03-20 15:08 Kirill Likhodedov
  2013-03-20 15:56 ` Matthieu Moy
  0 siblings, 1 reply; 3+ messages in thread
From: Kirill Likhodedov @ 2013-03-20 15:08 UTC (permalink / raw)
  To: git

Hi,

I experience difference in behavior between `git stash show stash@{0}` and `git show stash@{0}`:

-----------------------------------------------------

# git stash show --name-status stash@{0}
A       a
M       conflict.js
# git show --name-status stash@{0}
commit 05aa170746dc4e060f10710a92aed4592276f2d4
Merge: 737f544 7c2160f
Author: Kirill Likhodedov <Kirill.Likhodedov@gmail.com>
Date:   Wed Mar 20 18:56:28 2013 +0400

   WIP on master: 737f544 master

MM      conflict.js

-----------------------------------------------------

The first gives the correct result, while the second doesn't show the addition.
Is it a bug, or I'm just missing something?

Thanks a lot!
Kirill.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug? git show behaves incorrectly when called on a stash object
  2013-03-20 15:08 Bug? git show behaves incorrectly when called on a stash object Kirill Likhodedov
@ 2013-03-20 15:56 ` Matthieu Moy
  2013-03-21  8:10   ` Kirill Likhodedov
  0 siblings, 1 reply; 3+ messages in thread
From: Matthieu Moy @ 2013-03-20 15:56 UTC (permalink / raw)
  To: Kirill Likhodedov; +Cc: git

Kirill Likhodedov <kirill.likhodedov@gmail.com> writes:

> The first gives the correct result, while the second doesn't show the addition.
> Is it a bug, or I'm just missing something?

stash objects are commits with 2 parents (ie. merge commits). One commit
is the HEAD you stashed from, and the other is the saved state of the
index. I'm not sure from the doc what the semantics of --name-status is
for merge commits, but it seems it shows only files modified in both
parents.

Use git show --first-parent --name-status, it should do what you expect
(or -m instead of --first-parent).

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Bug? git show behaves incorrectly when called on a stash object
  2013-03-20 15:56 ` Matthieu Moy
@ 2013-03-21  8:10   ` Kirill Likhodedov
  0 siblings, 0 replies; 3+ messages in thread
From: Kirill Likhodedov @ 2013-03-21  8:10 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: git


On 20.03.2013, at 19:56, Matthieu Moy wrote:

> stash objects are commits with 2 parents (ie. merge commits). One commit
> is the HEAD you stashed from, and the other is the saved state of the
> index.
...
> Use git show --first-parent --name-status, it should do what you expect

Thanks a lot for clarifying that. It is actually mentioned in git help stash, but I've missed this.
With "--first-parent" I get the expected result. Thanks for your help.

> I'm not sure from the doc what the semantics of --name-status is
> for merge commits, but it seems it shows only files modified in both
> parents.

I think I've found the reason of this behavior.
git help show mentiones that:
> It also presents the merge commit in a special
> format as produced by git diff-tree --cc.
And git help diff-tree says that --cc implies -c, while -c "lists only files which were modified from all parents".

-- Kirill.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-21  8:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-20 15:08 Bug? git show behaves incorrectly when called on a stash object Kirill Likhodedov
2013-03-20 15:56 ` Matthieu Moy
2013-03-21  8:10   ` Kirill Likhodedov

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).