git-meta icon indicating copy to clipboard operation
git-meta copied to clipboard

git meta stash pop should not drop item in case of conflict

Open shijinglu opened this issue 5 years ago • 1 comments

As vanilla git says:

pop [--index] [-q|--quiet] [] Remove a single stashed state from the stash list and apply it on top of the current working tree state, i.e., do the inverse operation of git stash push. The working directory must match the index. Applying the state can fail with conflicts; in this case, it is not removed from the stash list. You need to resolve the conflicts by hand and call git stash drop manually afterwards.

shijinglu avatar Jan 10 '20 16:01 shijinglu

I don't think this can be fixed easily, because NodeGit.Stash.apply does not return the code it promised to:

> NodeGit.Repository.open('/Users/abc/workspace/twosigma/big-mono/s123').then(function (repo){
... NodeGit.Stash.apply(repo, 0, null).then( function(result){
..... console.log(" result = " + result);
..... });
... })
Promise { _55: 0, _87: null, _28: [] }
>  result = undefined

Supposedly, it should return something like

result = 0, 1, -13 etc

We need this code so we can tell if there is a conflict at applying: https://github.com/libgit2/libgit2/blob/HEAD/include/git2/stash.h#L182

shijinglu avatar Jan 15 '20 21:01 shijinglu