From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 5C7FD1F531 for ; Sat, 8 Aug 2020 07:53:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726128AbgHHHxu (ORCPT ); Sat, 8 Aug 2020 03:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgHHHxu (ORCPT ); Sat, 8 Aug 2020 03:53:50 -0400 Received: from out0.migadu.com (out0.migadu.com [IPv6:2001:41d0:2:267::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7C33C061756 for ; Sat, 8 Aug 2020 00:53:49 -0700 (PDT) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ameretat.dev; s=default; t=1596873225; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=sDo2/z5eCBbp3hBqM3X9hwfsAtnvj61fAyLrtPuHHcE=; b=EWl06pZpKwQGyfeY9Wu1455ypJxXExaKbPysCiQEU+6H/xMcGFIGjyNR4ENWNPodCEa+px izZ25W4GcIkJmsVsGft8Po+Et5lyfWmO5HjLoqCqQhOKpOVAfYLrS6Ru/4ZcO0thiYNXuc Bwv0JExCjB5wq2ZwQxrGM1u3kczJoKk= From: "Raymond E. Pasco" To: Junio C Hamano Cc: git@vger.kernel.org, "Raymond E. Pasco" Subject: [PATCH 1/1] diff-lib: use worktree mode in diffs from i-t-a entries Date: Sat, 8 Aug 2020 03:53:23 -0400 Message-Id: <20200808075323.36041-1-ray@ameretat.dev> In-Reply-To: <20200806060119.74587-1-ray@ameretat.dev> References: <20200806060119.74587-1-ray@ameretat.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org When creating "new file" diffs against i-t-a index entries, diff-lib erroneously used the mode of the cache entry rather than the mode of the file in the worktree. This changes run_diff_files() to correctly use the mode of the worktree file in this case. Signed-off-by: Raymond E. Pasco --- This is a distinct bugfix from the other changes, so I've sent it as a separate patch also based on v2.28.0. diff-lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diff-lib.c b/diff-lib.c index 25fd2dee19..50521e2093 100644 --- a/diff-lib.c +++ b/diff-lib.c @@ -219,7 +219,8 @@ int run_diff_files(struct rev_info *revs, unsigned int option) continue; } else if (revs->diffopt.ita_invisible_in_index && ce_intent_to_add(ce)) { - diff_addremove(&revs->diffopt, '+', ce->ce_mode, + newmode = ce_mode_from_stat(ce, st.st_mode); + diff_addremove(&revs->diffopt, '+', newmode, &null_oid, 0, ce->name, 0); continue; } -- 2.28.0.5.gfc8e108108