# Bug? git show behaves incorrectly when called on a stash object

3 messages from 2013-03-20 to 2013-03-21. Participants: Kirill Likhodedov, Matthieu Moy.
Thread: https://gitlist.dev/t/33240

## Kirill Likhodedov, 2013-03-20 15:08

Subject: Bug? git show behaves incorrectly when called on a stash object
Message-ID: <AF060B6D-27F7-45BE-9BC3-85FAF3487481@gmail.com>
URL: https://gitlist.dev/e/AF060B6D-27F7-45BE-9BC3-85FAF3487481%40gmail.com

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

## Matthieu Moy, 2013-03-20 15:56

Subject: Re: Bug? git show behaves incorrectly when called on a stash object
Message-ID: <vpqsj3qoyj2.fsf@grenoble-inp.fr>
URL: https://gitlist.dev/e/vpqsj3qoyj2.fsf%40grenoble-inp.fr
In-Reply-To: <AF060B6D-27F7-45BE-9BC3-85FAF3487481@gmail.com>

```
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/

```

## Kirill Likhodedov, 2013-03-21 08:10

Subject: Re: Bug? git show behaves incorrectly when called on a stash object
Message-ID: <813B5421-0876-40B3-8152-9DCA5D234FD7@gmail.com>
URL: https://gitlist.dev/e/813B5421-0876-40B3-8152-9DCA5D234FD7%40gmail.com
In-Reply-To: <vpqsj3qoyj2.fsf@grenoble-inp.fr>

```

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.

```
