git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Uwe Kleine-König" <uwe@kleine-koenig.org>
Cc: git@vger.kernel.org, Jakub Wilk <jwilk@debian.org>
Subject: Re: git add -N vs. git stash
Date: Mon, 08 Aug 2022 10:30:57 -0700	[thread overview]
Message-ID: <xmqqh72mskvi.fsf@gitster.g> (raw)
In-Reply-To: <20220808163954.tnozlrv7nyx63imu@pengutronix.de> ("Uwe Kleine-König"'s message of "Mon, 8 Aug 2022 18:39:54 +0200")

Uwe Kleine-König <uwe@kleine-koenig.org> writes:

> I'd say that's not a feature, is it?

I think that is a sign that "add -N" came much later than "stash",
and whoever added the former was not a heavy user of "stash" ;-)

As the state of the "tracked files in the working tree" and "staged
contents in the index" are both stored as tree objects, I think the
necessary fix would involve

 - record the contents of the "intent-to-add" paths to the tree
   object for the working tree.

 - record the fact that the "intent-to-add" paths are "not in the
   index yet" by removing them from the tree object for the index.

on the recording side (i.e. "stash create"), and then teach the
replay side (i.e. "stash apply") to pay attention to such strange
"exists in the tree for the working tree, but missing from the tree
for the index" paths and mark them with the "intent-to-add" bit.



      reply	other threads:[~2022-08-08 17:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 16:39 git add -N vs. git stash Uwe Kleine-König
2022-08-08 17:30 ` 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

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

  git send-email \
    --in-reply-to=xmqqh72mskvi.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=jwilk@debian.org \
    --cc=uwe@kleine-koenig.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.
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 NNTP newsgroup(s).