Web lists-archives.com

[GSoC] [RFC] git stashing discussing solution approaches

Just had a small discussion on irc about solving
the discussion:

Below are two approaches for solving this problem:

Approach 1) The suggested approach.

Perform an octopus merge of all `stage n` (n>0) unmerged index entries.

a problem with this approach:

1) Octopus merge can fail, and if it does what do we do in that case ?
Solution: store the conflicted state, and restore it when stash is applied.

I am not clear on how would we store the conflicted state (away from
index file).
please provide reference to code or docs that may be helpful to
understand this or is this the part that needs to be implemented for
this project ?

Approach 2) This approach is a shot in dark; not well thought, may
have a lot of problems.

consider a scenario, index file has 20 entries, 5 of which are
unmerged. now you detach those 5 entries from index file and store
them in some other file say `index_unmerged_branch_name`. now index is
no longer unmerged, and user can now do `git stash push`.
later when user does `git stash apply` we put those 5 unmerged entries
back in the index file.

identified problems with this approach:

1) where do you store `index_unmerged_branch_name`? What if the user
has a file that's already named like that?
Solution: we store `index_unmerged_branch_name` in `.git` directory

2) how do you reference that to a specific stash commit? remember that
there can be multiple stashes.
Solution: we put that info in the `.git/log/refs/stash` file telling
it, that this particular stash has a separate
`index_unmerged_branch_name` file.
Although this would require changing format of log file and hence the
code logic to read it. but it could be done.

3) blobs that are referenced in this index may not be referenced by
any tree/commit anymore.
Solution: perhaps we can store the references too.