git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Kapil Jain <jkapil.cs@gmail.com>
To: git <git@vger.kernel.org>, Thomas Gummerer <t.gummerer@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Duy Nguyen <pclouds@gmail.com>
Subject: [GSoC] [RFC] git stashing discussing solution approaches
Date: Tue, 9 Apr 2019 17:20:36 +0530	[thread overview]
Message-ID: <CAMknYENOfZKM0H5aznK9VyXzGA_SG+E1v62Jcez4bxnznNyPmw@mail.gmail.com> (raw)

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.

                 reply	other threads:[~2019-04-09 11:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMknYENOfZKM0H5aznK9VyXzGA_SG+E1v62Jcez4bxnznNyPmw@mail.gmail.com \
    --to=jkapil.cs@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=t.gummerer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).