git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Anthony Sottile <asottile@umich.edu>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: git add --intent-to-add + git stash "Cannot save the current worktree state"
Date: Thu, 10 Jan 2019 09:45:04 -0800	[thread overview]
Message-ID: <xmqqy37s2yqn.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: CA+dzEBmh4LdN-XFS9y9YKrDMzV_7+QpDzBA2uv9Xi80PgR5NTQ@mail.gmail.com

Anthony Sottile <asottile@umich.edu> writes:

> Minimal reproduction
>
> ```
> git init t
> git -C t commit --allow-empty -m 'initial commit'
> touch t/a
> git -C t add --intent-to-add a
> git -C t stash
> ```
>
> ```
> + git init t
> Initialized empty Git repository in /private/tmp/t/t/.git/
> + git -C t commit --allow-empty -m 'initial commit'
> [master (root-commit) 858132e] initial commit
> + touch t/a
> + git -C t add --intent-to-add a
> + git -C t stash
> error: Entry 'a' not uptodate. Cannot merge.
> Cannot save the current worktree state
> ```

This is one of the well-known fundamental limitations of the design
of "git stash".

States in the index like "it is known that this path would be added
with some contents, but not quite added yet as the final contents
have not been decided (aka intent-to-add)" and "there are
conflicting wishes for the contents for this path and the final
decision has not bee made (aka unmerged)" cannot be left undecided
before getting written to a tree object (hence a commit object that
is used to represent a stash entry).

      parent reply	other threads:[~2019-01-10 17:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 20:46 git add --intent-to-add + git stash "Cannot save the current worktree state" Anthony Sottile
2019-01-09 18:24 ` Johannes Schindelin
2019-01-09 18:36   ` Anthony Sottile
2019-01-10 15:21     ` Johannes Schindelin
2019-01-10 16:16       ` Anthony Sottile
2019-01-10 17:45 ` Junio C Hamano [this message]

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=xmqqy37s2yqn.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=asottile@umich.edu \
    --cc=git@vger.kernel.org \
    /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).