From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a6-smtp.messagingengine.com (fhigh-a6-smtp.messagingengine.com [103.168.172.157]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E63B0437136 for ; Sun, 27 Sep 2026 18:59:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790535588; cv=none; b=PLW4yg1+df7CoWqoFh1c9v/3WBAwfs0Is7TstWDiE6OdEs7eZgqsMVdNfo3wpp0DoFjBPReRvV8K46Zzs8n9lZlcB0+nye42jG3x1TtdcO8Ihg+I+f5YhthXbe7KvU0b5V5wBoVZJp536RQxAmAf5aGmWo0MDs5lsFdzTxpxEAg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790535588; c=relaxed/simple; bh=MoIqLSsvCx8SpIq6L1BEyrrlDu8hlZ0Iyq4pdm0UmNc=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=s8jWatH4J+ba2os+T8h4CTAdUCVwCU0qjQKqxL+3pzqgVSo0f1CK36D0y3a7EwB88c+1zQLuoK3G77DH1oslCq17ISYjqER64QVmvNWr+PxmTSEjAJZxobGmTMbNbcssX4oozC4t3S0CZw77+3th8z4+BcwRXnUYjPod/Bv5RVQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=WdKUjO0e; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=JR9NuI6U; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="WdKUjO0e"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="JR9NuI6U" Received: from phl-compute-01.internal (phl-compute-01.internal [10.202.2.41]) by mailfhigh.phl.internal (Postfix) with ESMTP id C82361400058; Sun, 27 Sep 2026 14:59:44 -0400 (EDT) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-01.internal (MEProxy); Sun, 27 Sep 2026 14:59:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1790535584; x=1790621984; bh=tZJs2Ll+xv qjEyCw/KgBkQA9lUnXYt0R2IS9y3xHFG0=; b=WdKUjO0ercyy/5kNAm8QVfD3mW m0hYakMLjrzSxL6O5vvNPHssKKrr7RlBAfUGrRn4Ddslpo6nVfqLaER+OZsE/e1g jhUh8sYnY2EYvsQBLyNgJHr7hGE17qjJ/fzkBLHmYP9fzXXSOF6yDD45cmzn9OHw que58ItzBS2CGffjeMsk1DT5X8cUVy7HmNmyP8OC0FweL+gBNuTBuC1wVnWrXpTH GVWf2DRMteHKq2KUeT67vCFZFvuNNCeHbOhdUHGh5/wwFIsUzVwfUecO7D3OapB6 9VTCJAqGdpHJW2eM/i/hPTgjIk4wqtPKlyLJfSiVmZXvNCwEQuABENjBjHcA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1790535584; x=1790621984; bh=tZJs2Ll+xvqjEyC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Rfe0JbTj4Bl8K8nYC1rPLdxSrXriY1EVPRMpcvchdK7bz9r31oPxH/rw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 27 Sep 2026 14:59:43 -0400 (EDT) From: Junio C Hamano To: "D. Ben Knoble" Cc: git@vger.kernel.org, Eli Barzilay , Phillip Wood , Elijah Newren , Patrick Steinhardt , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Victoria Dye , Adam Johnson , Jeff King Subject: Re: [PATCH v3 5/5] builtin/stash: merge index in-core In-Reply-To: (D. Ben Knoble's message of "Sat, 26 Sep 2026 08:16:48 -0400") References: Date: Sun, 27 Sep 2026 11:59:41 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "D. Ben Knoble" writes: > @@ -671,29 +627,27 @@ static enum stash_apply_result do_apply_stash(const char *prefix, > oideq(&c_tree, &info->i_tree)) { > has_index = 0; > } else { > - struct strbuf out = STRBUF_INIT; > + struct merge_result result = { 0 }; > > - if (diff_tree_binary(&out, &info->w_commit)) { > - strbuf_release(&out); > - return error(_("could not generate diff %s^!."), > - oid_to_hex(&info->w_commit)); > - } > + o.branch1 = "Current index"; > + o.branch2 = "Stashed index changes"; > + o.ancestor = "Stash base"; > > - ret = apply_cached(&out); > - strbuf_release(&out); > - if (ret) > + o.verbosity = 0; We realize that 'o' is a struct merge_options defined on the stack for this function, initialized with init_ui_merge_options() fairly early on. It would have initialized '.verbosity' to the default verbosity, the merge.verbosity configuration variable, or the GIT_MERGE_VERBOSITY environment variable. You drop the verbosity here, presumably because you want to match the previous implementation 'diff-tree | apply --cached' (which I guess was fairly quiet, but I do not use 'stash pop --index' myself). > + head = lookup_tree(o.repo, &c_tree); > + merge = lookup_tree(o.repo, &info->i_tree); > + merge_base = lookup_tree(o.repo, &info->b_tree); > + > + merge_incore_nonrecursive(&o, merge_base, head, merge, > + &result); > + > + oidcpy(&index_tree, &result.tree->object.oid); > + merge_finalize(&o, &result); And then the (index) merge is quiet, which is nice. > + > + if (!result.clean) > return error(_("conflicts in index. " > "Try without --index.")); > - > - discard_index(the_repository->index); > - repo_read_index(the_repository); > - if (write_index_as_tree(&index_tree, the_repository->index, > - repo_get_index_file(the_repository), 0, NULL)) > - return error(_("could not save index tree")); > - > - reset_head(); > - discard_index(the_repository->index); > - repo_read_index(the_repository); > } > } But the thing is, this is not the end of the function, or the last call to the merge machinery using 'o'. We then use the same 'o' to drive another three-way merge. Yet nobody restores '.verbosity' that was unconditionally turned off above for that second merge. It is a bit surprising that the existing test suite did not catch this. Perhaps we do not test --quiet and the merge.verbosity configuration in combination? Anyway, I think you'd need something like the following (caveat emptor: written against checked out 'seen' while reading the patch, and not even compile tested). Thanks. builtin/stash.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git c/builtin/stash.c w/builtin/stash.c index 0f10b9c703..a165419d77 100644 --- c/builtin/stash.c +++ w/builtin/stash.c @@ -622,6 +622,9 @@ static enum stash_apply_result do_apply_stash(const char *prefix, init_ui_merge_options(&o, the_repository); + if (quiet) + o.verbosity = 0; + if (index) { if (oideq(&info->b_tree, &info->i_tree) || oideq(&c_tree, &info->i_tree)) { @@ -633,8 +636,6 @@ static enum stash_apply_result do_apply_stash(const char *prefix, o.branch2 = "Stashed index changes"; o.ancestor = "Stash base"; - o.verbosity = 0; - head = lookup_tree(o.repo, &c_tree); merge = lookup_tree(o.repo, &info->i_tree); merge_base = lookup_tree(o.repo, &info->b_tree); @@ -658,9 +659,6 @@ static enum stash_apply_result do_apply_stash(const char *prefix, if (oideq(&info->b_tree, &c_tree)) o.branch1 = "Version stash was based on"; - if (quiet) - o.verbosity = 0; - if (o.verbosity >= 3) printf_ln(_("Merging %s with %s"), o.branch1, o.branch2);