public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Adam Johnson" <me@adamj•eu>
To: "Junio C Hamano" <gitster@pobox•com>,
	"Adam Johnson" <gitgitgadget@gmail•com>
Cc: git@vger•kernel.org, "Thomas Gummerer" <t.gummerer@gmail•com>,
	"Elijah Newren" <newren@gmail•com>,
	"Phillip Wood" <phillip.wood@dunelm•org.uk>,
	"Victoria Dye" <vdye@github•com>
Subject: Re: [PATCH] stash: reuse cached index entries in --patch temporary index
Date: Fri, 22 May 2026 21:55:27 +0100	[thread overview]
Message-ID: <e6e3ba3a-a08d-426b-b0ae-1f57554b2b1d@app.fastmail.com> (raw)
In-Reply-To: <xmqqldde6cl5.fsf@gitster.g>

> Is this "non-zero return from refresh_index() leads to a failure"
> intended?

Good catch, it’s not needed. Removing, we can make the call
unconditional.

On Wed, 20 May 2026, at 03:26, Junio C Hamano wrote:
> "Adam Johnson via GitGitGadget" <gitgitgadget@gmail•com> writes:
> 
> >  2 files changed, 83 insertions(+), 6 deletions(-)
> >
> > diff --git a/builtin/stash.c b/builtin/stash.c
> > index 32dbc97b47..48189cb9f7 100644
> > --- a/builtin/stash.c
> > +++ b/builtin/stash.c
> > @@ -372,6 +372,57 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
> >  return 0;
> >  }
> >  
> > +static int create_index_from_tree(const struct object_id *tree_id,
> > +   const char *index_path)
> > +{
> > + int nr_trees = 1;
> > + int ret = 0;
> > + struct unpack_trees_options opts;
> > + struct tree_desc t[MAX_UNPACK_TREES];
> > + struct tree *tree;
> > + struct index_state dst_istate = INDEX_STATE_INIT(the_repository);
> > + struct lock_file lock_file = LOCK_INIT;
> > +
> > + repo_read_index_preload(the_repository, NULL, 0);
> > + if (refresh_index(the_repository->index, REFRESH_QUIET, NULL, NULL, NULL))
> > + return -1;
> 
> Is this "non-zero return from refresh_index() leads to a failure"
> intended?  The old "git read-tree HEAD" wouldn't have cared if the
> original index were unmerged, for example, but with this update, we
> will see an immediate failure.  There are other conditions that
> refresh_index() flips its local variable has_errors on, which leads
> to its non-zero return.
> 
> Since "git stash -p" is almost always invoked when the user has
> unstaged modifications, I am not sure allowing refresh_index() to
> notice and barf is what we want here.
> 

  reply	other threads:[~2026-05-22 20:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 12:43 [PATCH] stash: reuse cached index entries in --patch temporary index Adam Johnson via GitGitGadget
2026-05-20  2:08 ` Junio C Hamano
2026-05-22 20:53   ` Adam Johnson
2026-05-20  2:26 ` Junio C Hamano
2026-05-22 20:55   ` Adam Johnson [this message]
2026-05-22 23:12 ` [PATCH v2] " Adam Johnson via GitGitGadget
2026-06-01 21:33   ` Junio C Hamano

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=e6e3ba3a-a08d-426b-b0ae-1f57554b2b1d@app.fastmail.com \
    --to=me@adamj$(echo .)eu \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitgitgadget@gmail$(echo .)com \
    --cc=gitster@pobox$(echo .)com \
    --cc=newren@gmail$(echo .)com \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    --cc=t.gummerer@gmail$(echo .)com \
    --cc=vdye@github$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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