Re: Stash missing, but not. Can apply, but not drop or list the stash.

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

 



mattjackets wrote:
> I have a strange stash problem.  There is a single stash in the repo.
> 
> git stash apply 0  --  works, but results in a conflict.

The correct form is 'git stash apply stash@{0}'

'git stash apply 0' is doing the right thing for the wrong reason.
For example, 'git stash apply 1' would not do the right thing.

This is unrelated to your issue, but it seems you have uncovered
a flaw which should be fixed.

In git stash, when your command line above is used, eventually
the following command is executed:

    git rev-parse --revs-only --no-flags --default refs/stash 0

'git rev-parse' fails to resolve revision "0" and prints out nothing
and then falls back to printing the revision of "refs/stash". This
is not what is desired by stash.

Either rev-parse needs to error out in this case, or 'git stash' needs
to be changed so that '--default refs/stash' is not used here. Possibly,
something like what is done inside drop_stash().

>  Lets just go
> ahead and drop the stash...
> 
> git stash list  --  shows nothing.  huh?  Lets go ahead with the drop
> anyway and hope it works...
> 
> $ git stash drop stash@{0}
> fatal: Log .git/logs/refs/stash is empty.
> stash@{0}: not a valid stashed state
> 
> sure enough, .git/logs/refs/stash is empty

Right, it must exist since you actually got the error message
'fatal: Log .git/logs/refs/stash is empty', but it contains
nothing. Not sure how that happened.

> git stash clear  --  does nothing

It correctly removes .git/refs/stash for me.

> I'm at a loss.  I can apply the stash cleanly to older revisions, and
> gitk still shows the stash branch.  How can I fix this?  is it safe to
> simply delete the stash branch as if it was any other branch?

In this case yes it would be safe to just do 'rm .git/refs/stash', but
like I said, 'git stash clear' worked for me.

-brandon

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