# [GSoC] [RFC] stashing unmerged index entries

2 messages from 2019-04-09 to 2019-04-09. Participants: Kapil Jain, Duy Nguyen.
Thread: https://gitlist.dev/t/50896

## Kapil Jain, 2019-04-09 08:16

Subject: [GSoC] [RFC] stashing unmerged index entries
Message-ID: <CAMknYEMQ6K7j2M1CSv9uCF8aDQK6+PmTJi-XgFNy+McE9f7OsQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAMknYEMQ6K7j2M1CSv9uCF8aDQK6%2BPmTJi-XgFNy%2BMcE9f7OsQ%40mail.gmail.com

```
Reference: https://git.github.io/SoC-2019-Ideas/#teach-git-stash-to-handle-unmerged-index-entries

"When the index is unmerged, git stash refuses to do anything. That is
unnecessary, though, as it could easily craft e.g. an octopus merge of
the various stages. A subsequent git stash apply can detect that
octopus and re-generate the unmerged index."

according to it we take the unmerged entries (caused by conflicted
merge) in index from all stages, and do an octopus merge. how does
this solve the problem, i mean where do those entries go after octopus
merge ? a conflicted merge is still there, do we store the merge
separately ?

```

## Duy Nguyen, 2019-04-09 11:01

Subject: Re: [GSoC] [RFC] stashing unmerged index entries
Message-ID: <CACsJy8AwS0De_xjkTpcU=Crpgen3+OfQRh=CPwZAc6YxCUUc=g@mail.gmail.com>
URL: https://gitlist.dev/e/CACsJy8AwS0De_xjkTpcU%3DCrpgen3%2BOfQRh%3DCPwZAc6YxCUUc%3Dg%40mail.gmail.com
In-Reply-To: <CAMknYEMQ6K7j2M1CSv9uCF8aDQK6+PmTJi-XgFNy+McE9f7OsQ@mail.gmail.com>

```
On Tue, Apr 9, 2019 at 3:16 PM Kapil Jain <jkapil.cs@gmail.com> wrote:
>
> Reference: https://git.github.io/SoC-2019-Ideas/#teach-git-stash-to-handle-unmerged-index-entries
>
> "When the index is unmerged, git stash refuses to do anything. That is
> unnecessary, though, as it could easily craft e.g. an octopus merge of
> the various stages. A subsequent git stash apply can detect that
> octopus and re-generate the unmerged index."
>
> according to it we take the unmerged entries (caused by conflicted
> merge) in index from all stages, and do an octopus merge. how does
> this solve the problem, i mean where do those entries go after octopus
> merge ?

I'm not even into git-stash, but it does sound like it solves the
problem, which is _restoring_ the conflict after you unstash. Since
you have all the unmerged entries in the merge (which is stored in
some stash ref), you can safely destroy all conflicts in worktree and
put it back to a clean state. When people want to apply the stash, you
re-generate the unmerged index from the octopus merge.

> a conflicted merge is still there,

yes, but because you can restore it later now, you can remove the
conflict safely. That's what git-stash is for.

> do we store the merge separately ?
-- 
Duy

```
