[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] How to find identify a stash id

Thanks a lot, Christian, for your quick and detailed answer. Then I will stick to the StashListCommand / reflog approach.

- RÃdiger

On 07.07.2017 14:05, Christian Halstrick wrote:
I don't think you can definitely tell a commit is representing a stash without inspecting the reflog of the refs/stash ref. The objects created by the stash command are standard commits which do have specific commit messages and the multiple commits belonging to the same stash are arranged in a specific topology. This allows you to determine easily that certain commits will not represent a stash (because they don't have the right commit message, because they aranged in the wrong topology). But I guess to find out whether a certain commit really represents a stash you would have to inspect .git/logs/refs/stash. When you create a new stash .git/refs/stash is updated and to find the other stashes you would have to go to the reflog. Take care that a stash can consist of multiple commits (on saving the working tree content, one saving the index content, one for the untracked files).


On Fri, Jul 7, 2017 at 12:55 PM, RÃdiger Herrmann <ruediger.herrmann@xxxxxx> wrote:
Dear JGit developers,

could you recommend a way to determine if a given ObjectId identifies a stash or not? I am aware of the StashListCommand that I could use to see if the list of all stashes contains the object id in question. However, I would prefer to avoid reading and traversing the possibly long list of stashes.

Is there a characteristic of a RevCommit that would clearly identify a stash commit?

jgit-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit