git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[GSoC] [RFC] git stashing discussing solution approaches

From
KJKapil Jain <jkapil.cs@gmail.com>
Date
Apr 9, 2019, 11:50 UTC
Message-ID
<CAMknYENOfZKM0H5aznK9VyXzGA_SG+E1v62Jcez4bxnznNyPmw@mail.gmail.com>

Just had a small discussion on irc about solving https://git.github.io/SoC-2019-Ideas/#teach-git-stash-to-handle-unmerged-index-entries the discussion: https://colabti.org/irclogger/irclogger_log/git-devel?date=2019-04-09

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.
Message 1 of 1 in “[GSoC] [RFC] git stashing discussing solution approaches”
  1. Kapil JainApr 9, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.