{"thread":{"id":"50900","subject":"[GSoC] [RFC] git stashing discussing solution approaches","startedAt":"2019-04-09T11:50:50Z","lastAt":"2019-04-09T11:50:50Z","messageCount":1,"participants":["Kapil Jain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"373485","messageId":"CAMknYENOfZKM0H5aznK9VyXzGA_SG+E1v62Jcez4bxnznNyPmw@mail.gmail.com","threadId":"50900","inReplyTo":null,"subject":"[GSoC] [RFC] git stashing discussing solution approaches","fromName":"Kapil Jain","fromEmail":"jkapil.cs@gmail.com","sentAt":"2019-04-09T11:50:36Z","receivedAt":"2019-04-09T11:50:50Z","isPatch":false,"sender":{"key":"jkapil.cs@gmail.com","avatar":null},"body":"Just had a small discussion on irc about solving\nhttps://git.github.io/SoC-2019-Ideas/#teach-git-stash-to-handle-unmerged-index-entries\nthe discussion:\nhttps://colabti.org/irclogger/irclogger_log/git-devel?date=2019-04-09\n\nBelow are two approaches for solving this problem:\n\nApproach 1) The suggested approach.\n\nPerform an octopus merge of all `stage n` (n>0) unmerged index entries.\n\na problem with this approach:\n\n1) Octopus merge can fail, and if it does what do we do in that case ?\nSolution: store the conflicted state, and restore it when stash is applied.\n\nI am not clear on how would we store the conflicted state (away from\nindex file).\nplease provide reference to code or docs that may be helpful to\nunderstand this or is this the part that needs to be implemented for\nthis project ?\n\n\nApproach 2) This approach is a shot in dark; not well thought, may\nhave a lot of problems.\n\nconsider a scenario, index file has 20 entries, 5 of which are\nunmerged. now you detach those 5 entries from index file and store\nthem in some other file say `index_unmerged_branch_name`. now index is\nno longer unmerged, and user can now do `git stash push`.\nlater when user does `git stash apply` we put those 5 unmerged entries\nback in the index file.\n\nidentified problems with this approach:\n\n1) where do you store `index_unmerged_branch_name`? What if the user\nhas a file that's already named like that?\nSolution: we store `index_unmerged_branch_name` in `.git` directory\n\n2) how do you reference that to a specific stash commit? remember that\nthere can be multiple stashes.\nSolution: we put that info in the `.git/log/refs/stash` file telling\nit, that this particular stash has a separate\n`index_unmerged_branch_name` file.\nAlthough this would require changing format of log file and hence the\ncode logic to read it. but it could be done.\n\n3) blobs that are referenced in this index may not be referenced by\nany tree/commit anymore.\nSolution: perhaps we can store the references too.\n"}]}