From patchwork Tue Feb 18 16:24:35 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 13980224 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1202626E622 for ; Tue, 18 Feb 2025 16:24:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895885; cv=none; b=sdgcF/LwO3B45QU+lq+xaG/b8kzmFqQi7Ce7142Dh4ueazQmQ+4sA0PTLauNlRs1gvPyUsj1mdnkUNRE1ieAEnAsBUc/mPXxSo6hxazs9LBD7yUQYL43CH0Gx2Ckm85AHbQK2jmyB6HdOO/sOZki3Zhap+PdEiFKKLcYFrXs/+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895885; c=relaxed/simple; bh=iB5wMfHI+J9P2YZV+NCaEmyVstCchgGsnuq7mfblivY=; h=Message-Id:In-Reply-To:References:From:Date:Subject:MIME-Version: Content-Type:To:Cc; b=e7vEPjuVGAiZsrpbOew7jac3kmnRq8RYh8IzDZVM3i4zKRLXDkK4+95jSSFCLFgZY+frxsaaWHFl0FI2Kp30bF/M+hLw7kt4Ep5wxzFDuJjfLWw0Recp01hTYlrW14Y4/jd5XYdT+pzqYEdLIieXRCL2SdZH2f1TXRU5tgXOWVE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=eMYgnJPe; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eMYgnJPe" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-43996e95114so5548455e9.3 for ; Tue, 18 Feb 2025 08:24:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739895882; x=1740500682; darn=vger.kernel.org; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=XPqc6l0vee5Ni9OfLO4My72PUsnlMX1DvFM+AF0kAbE=; b=eMYgnJPe8n1hv/MZ+fJDlS1VobAA0vdbX/TlC+nveHOZvZZ/6Bt2gNFlXW1spH7wo+ U53Rauj8YC5kF/6zFnUnGCeSwoAdAXOkUaHN4am7gPoYKco2CwRq3W1xB+YWPEDIny3t spdUoO3E3/Nd/PjtZFlmNXn//z8dQAwPha4AOHeThmGgbNe5BNfaCtT0IUEz78kxzL6m czYYOSuNE025Q7xLpsFi52YPw9lco/dJ4BAm7zZmZ17uqitfdlsHvOyy7qMx75YBRAa2 lg582ouJa1SoOCaCCZEUgCTfFKj8kgxuIzbjCkGZEAUJnzoUJ6461Ryi6fmc1iEBOtAF 0RiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739895882; x=1740500682; h=cc:to:fcc:content-transfer-encoding:mime-version:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XPqc6l0vee5Ni9OfLO4My72PUsnlMX1DvFM+AF0kAbE=; b=b+yHMzPLvGPsggw6usnQaowMyjxikJukcedaHi2fiK9aMO6nlPu/V/dnapjLu1macX J5I8R+GGVwC12i/xNGqoZ5TBVrdJqhnDP8LFHXTwdl53nCiO6AgF3VWO1qNx6PJ8Ae5C f1vug8iLWEui+/tnW3uNR46kpIT2lbp03TJ0fEoAtKLaecf+J80Bj98Ke3Keldf1m6O3 Nyh0aDChzzVomMhsrsFqyIbCoKW22PPlv50wCJiOgpk1C8J255fKcRq18r3HNBcVCNuD 8twQiZtPXMNZkZqNINcIihj+KS+aUbxxEqTQvsmy7OApyqu/BnMIAfnB/NvNeVrrhDG8 wuNg== X-Gm-Message-State: AOJu0Yw+HZvKun7I/kQy5xUHPGGxcQ2O7S0c4EHznNC+oPvVqvRbtWFK vRsvSvAJjolziwhHKm8mYwKV+LVN0Ys+Bn+s7U6HAT5aqKQv2J99L1xI8w== X-Gm-Gg: ASbGncvo7aTS3CzlpNa6eys5gDT6VRQSJBVF6IWdbiBvL7Eumyd2kRxa8h925j3JbkL Glh3P05wfF07qq0sEzGHR6Fmfrv8Ndvhc1HNidFP5fjKp5OcD+ZpIy/CgfvumNPESbqqBZBDuYV QyjZY/xQVeRMxrZm6y917Btr+H8HpaGRMgnLRukNPUp4sHJazb6eB51Z/a5QBYAzDb7497R3i7T 3FBmTa/HmRck/HKNwVrwIHsdEqi5Q258c+bx4FImKA94BLNib4qYElsR/lpMBVn2Do3CsCRWnxE sx9E5MkDl2YmpEhC X-Google-Smtp-Source: AGHT+IHDgtMsD+D2tyZc0T4kGw2KaGPpeY1d/mJPCv65H2tx/vlz0e5e4Pn2RXmLYYCAA8HRz7Jhfg== X-Received: by 2002:a05:600c:354f:b0:439:6b57:c6b with SMTP id 5b1f17b1804b1-4396e700738mr125862335e9.17.1739895881735; Tue, 18 Feb 2025 08:24:41 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43999e5beebsm1154015e9.22.2025.02.18.08.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 08:24:41 -0800 (PST) Message-Id: <3b3179785098580f3336bb24bdbaf0aa1366bfcd.1739895879.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 18 Feb 2025 16:24:35 +0000 Subject: [PATCH v2 1/5] merge-tree --stdin: flush stdout to avoid deadlock Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fcc: Sent To: git@vger.kernel.org Cc: Elijah Newren , Phillip Wood , Phillip Wood , Phillip Wood From: Phillip Wood From: Phillip Wood If a process tries to read the output from "git merge-tree --stdin" before it closes merge-tree's stdin then it deadlocks. This happens because merge-tree does not flush its output before trying to read another line of input and means that it is not possible to cherry-pick a sequence of commits using "git merge-tree --stdin". Fix this by calling maybe_flush_or_die() before trying to read the next line of input. Flushing the output after each merge does not seem to affect the performance, any difference is lost in the noise even after increasing the number of runs. $ git rev-list --merges --parents -n100 origin/master | sed 's/^[^ ]* //' >/tmp/merges $ hyperfine -L flush 0,1 --warmup 1 --runs 30 \ 'GIT_FLUSH={flush} ./git merge-tree --stdin --- builtin/merge-tree.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 9a6c8b4e4cf..57f4340faba 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -18,6 +18,7 @@ #include "tree.h" #include "config.h" #include "strvec.h" +#include "write-or-die.h" static int line_termination = '\n'; @@ -623,6 +624,7 @@ int cmd_merge_tree(int argc, } else { die(_("malformed input line: '%s'."), buf.buf); } + maybe_flush_or_die(stdout, "stdout"); if (result < 0) die(_("merging cannot continue; got unclean result of %d"), result); From patchwork Tue Feb 18 16:24:36 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 13980225 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89F4B26E653 for ; Tue, 18 Feb 2025 16:24:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895886; cv=none; b=KPUF6GaCj1+s5WJthquVWnvbuHDC9X9JB6gxScmOcox3mlS+pJ6ik0Dd7nyMDJvpQYByAHmxqwrbRvOJRkfncnvSwJi1d7Ud+sXbJM6vp/rc7TcExMh+zGmA5UMykpSIUnlcmM0omUFTcdI1ppdvEclFhEZxJsm0OQQCRhOlfUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895886; c=relaxed/simple; bh=HE+3hPHK0tO0PnFZu/AYYaNJ1gKQl15ECqdtlhOQNag=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=YU4QvJDeyzoDbz6o90xKvRyb4jnGLlH/4efQRbI75WhWiRx2580f92MvHiAli/MicWXiABNd0FXM0To84QqWsN6An99mXhGnU0Oa++XcaXhdPkPBIKEDeIFn1G6HPTM9ew4sdCGUMpi5/QCqqLk8SZJ6HP/czotyy4p+eMS43lg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bbjrq2gV; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bbjrq2gV" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-38f3ac22948so1518141f8f.0 for ; Tue, 18 Feb 2025 08:24:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739895882; x=1740500682; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=jG4iePMgc/SX/1ONSHK/c3e2He/X8AdCj+2j+mvbkgw=; b=bbjrq2gVfxjU95k+5wc+3Qkwyt/ThHlYJgMs2k7J0LiKfiYSNd2sI18Q0eUkEFQ81N FeItz74G2tmEg5AROd1MW0pETgnOP92yYG+sU4iOgyZUrZLQUBMeJ7pQBymkUdpTh18F +oKWpsNtgcE325cPY+0BqUiBezZaIrmkby5hXOxNyvY8A0929K1NPrQ3Pr/LXW53zwKN M0subFyjI6sTntY9fFdiUz2dSqjh3CiHdYHR9iAe4n/PC9LcqaNVgFzx1PGiW2JkrVZ4 75PBnga/zGSJoPExj+PaKzmiE0IFgQf5KGFiBtRKTa6uj2Qw/Y+8MXAeY34CcXZYJreX 6Wgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739895882; x=1740500682; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jG4iePMgc/SX/1ONSHK/c3e2He/X8AdCj+2j+mvbkgw=; b=mlqZUhejVdeHAbq47tzGpPBDl4TQ3ZezEzHfEGvPZrDwWY0TdDZs0xWLSGXB9jFxYx p2hgVtfeJCa4XpndCJE/J3jgSEuAxt6t3/Z0z0rE0K93S+8aF+6PaUeaQO2wVij8Lw8k JTAytsxSTC3jcfQ1enPawZX+l/wOsz8OfY/3Ai1dgFPdzygDloo0zgbVbJqdlBNKFcaT e9UVTPjo2H7duZxRf0yvlp8uMQH0UwsnMmNWY1wSVavZ67Nu+ZNHVxZFRaM8DC5uZKJw zcc/EdycrHUaOTORiXwMXuZB6mlz3hQaJ7lzgOMbQz2WUoJkDwS9x9VuRLcDgTsd66n1 yKzg== X-Gm-Message-State: AOJu0Yx4/sGoWpdgX9CmcaTVUHQkWrjJ/Tn+riv0NdZJSlV3v9upJugy YwoMlulhcvD5GDjV9+Ql6FYDgx5BagHoLIi0EPTUbjgdDNvhDm/xwtv5mA== X-Gm-Gg: ASbGncu2zuGrVjpVhAklOppP1puxzm+wP96H5PPRLle3QSNNAoALD1+nByevohoOL3G YFfX/yquMM88Ipeoy/JzS8s0pEGtJalySSYjjOQ5TH3KeMwIx961RsfRZ+hdgFUDWxv2HVvzamP 5vYDPJfjgRJeNHwGntcagNSmp3DGmxpSULySCmc38flDOxLvEp0tL6k9DNzSSTKwQUD2VPHKJXx OyE1wMKGXUSd3CgZBL2GP+Wx9ntoFdBVmQ02jKCIxqyRzVP2Xpmq28nnSOC0EaG+/hoVXFr5WKs tfufkBEwXqhgcEMH X-Google-Smtp-Source: AGHT+IFu+UTIIwT1diee+7//5XZRvTjEZVh2DNFQQOO0+dMNYzShF6oRxP6YWQ9jD+q15L/CkoEKTw== X-Received: by 2002:a05:6000:1845:b0:38e:ae25:6d66 with SMTP id ffacd0b85a97d-38f33f28f97mr13918955f8f.19.1739895882460; Tue, 18 Feb 2025 08:24:42 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f25a0fa38sm15695848f8f.98.2025.02.18.08.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 08:24:42 -0800 (PST) Message-Id: <63b09dbe1b7bc7c671526288e302051e5f447552.1739895879.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 18 Feb 2025 16:24:36 +0000 Subject: [PATCH v2 2/5] merge-tree: remove redundant code Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Phillip Wood , Phillip Wood , Phillip Wood From: Phillip Wood From: Phillip Wood real_merge() only ever returns "0" or "1" as it dies if the merge status is less than zero. Therefore the check for "result < 0" is redundant and the result variable is not needed. The return value of real_merge() is ignored because exit status of "git merge-tree --stdin" is "0" for both successful and conflicted merges (the status of each merge is written to stdout). The return type of real_merge() is not changed as it is used for the program's exit status when "--stdin" is not given. Signed-off-by: Phillip Wood --- builtin/merge-tree.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 57f4340faba..3c73482f2b0 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -601,7 +601,6 @@ int cmd_merge_tree(int argc, line_termination = '\0'; while (strbuf_getline_lf(&buf, stdin) != EOF) { struct strbuf **split; - int result; const char *input_merge_base = NULL; split = strbuf_split(&buf, ' '); @@ -618,16 +617,14 @@ int cmd_merge_tree(int argc, if (input_merge_base && split[2] && split[3] && !split[4]) { strbuf_rtrim(split[2]); strbuf_rtrim(split[3]); - result = real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix); + real_merge(&o, input_merge_base, split[2]->buf, split[3]->buf, prefix); } else if (!input_merge_base && !split[2]) { - result = real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix); + real_merge(&o, NULL, split[0]->buf, split[1]->buf, prefix); } else { die(_("malformed input line: '%s'."), buf.buf); } maybe_flush_or_die(stdout, "stdout"); - if (result < 0) - die(_("merging cannot continue; got unclean result of %d"), result); strbuf_list_free(split); } strbuf_release(&buf); From patchwork Tue Feb 18 16:24:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 13980226 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D90E426F449 for ; Tue, 18 Feb 2025 16:24:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895887; cv=none; b=jvK1oZrLz/UY5V7knM2vsfwyXk2OylFIXuYdEi5ByMqs4ZIrNUw1fgP/lOB9ohlGJ6qGUSVhR4dyXOtLFskFxT/PKuqH1+G8ifG1W2P3bh+YkP9x9vGKtLA8qGgMFIrMzjccQ9JMCXc/j10PWjXtOJEQZSLWAU4xY9rck8S5C0k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895887; c=relaxed/simple; bh=fsb00xLpOxRrgT/DgrF+Cf4vGKMmdw1Ft/tXfKOD7cs=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=RxYDJoqSJDFXQkf6carxLgM5O0GBbMOsZQZnqq6+WIXz4YTTZ9FOFNDqXbBpkM9rvyT3nsz+tzTeaD1kCZNKs48If8RgyDZq5N8QUUzLlJmAzgMFNJUiXngZdSj4GHxnwiJlFlNlp++W+/6Xs+rQShyfcTInrBdnVIuoOSJ0pFs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=j4vTqNFC; arc=none smtp.client-ip=209.85.128.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j4vTqNFC" Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-4398c8c8b2cso21219655e9.2 for ; Tue, 18 Feb 2025 08:24:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739895884; x=1740500684; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=nykryX9gYlil/AYXBT+DOOFcMiqRnFeK+MsOWuNjDGI=; b=j4vTqNFCh+TK5w3j2AAvxEK5sHnHPOMZFSo14ccAABARSjXnIxQR8F+zcYPyzYfGSj PJ9SolByBt1V9uGeYsCewHUDKOpY5zOdbl+wIXe5CZlBn3rD7uvXXnld5dYBUIu1JlYs fkkCQN2vl4uoGVrF8iBXxCqf3K3X1DTeaA0zDP5opaPZ8Hi5BkpE12v30GiXVxpPx7uK 7uwmjnRQqN3JaRAzaJl/T4zRhcmAQchpcuDXk2lKjvIjr8GVbIv/Sd8FPUnLlu6ifmI1 dU0XsUBnyQgL5FrfrEVaGQ/SnNkGEHT4CMbUQGxCY4yuipGG76TCfqKYSN9dDwdNQJOY dGbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739895884; x=1740500684; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nykryX9gYlil/AYXBT+DOOFcMiqRnFeK+MsOWuNjDGI=; b=oQnyOjROlP9fAvkJO8qzlseNIdcTXyE2L5IP+shAaUnx91leo1gHn+twAZA8C2UTXP ynmDiL9HnaYcPQpq/Nl8G3h9SdQ0jXrMctjbCC1cHJeBg8lIiwY0EX0TftcHrGIQe3XG EsJ/4kYxlFVBS9/jwOMBYRWcVrPaiL5QA1Be4BgDqMFzxQ7Q0guX/Z7HV27iT+Lov/hd rbghli3CxK5PUqNLFmnX0X/Kt/+gs6kAnaxAekHoaCkQHnZ8e5mx/djjCzZ49qnwMTQb ttqHtfvrpJyW7UYOOKxg2GFaqVYzuaQuRRxzUAmWMukYgZsPMKTHJvf48D/8F0AEpR3j 3L/Q== X-Gm-Message-State: AOJu0Yw+NPhdRmfw+xUXAZsbF5w7qBT+if1NgQhjer/babiAH/OAYaH7 LFmuN1iHQj6nEzOwZRs3DyyqbA4YwN6KbzZ3WOPBXf7pH6yB4Ez/GxHNzA== X-Gm-Gg: ASbGncsDmHFBEp01QX4MGBUgqTLRi+XTDJPkM+Uv10v2pc6P6SjthFJ+sqsW6L0Bi/o juVy8jlFqWrWd+MSfaqpBYc6trExOb8KHsglVnJ2ycyD3+4YRPpHiBuqLK0tY//VcNWdINTH0ED nXHByVIJCLLpLGEvsPaaR6Xrb3buR+A4AiqtfPP99ZBXOeKw6CKy+7H6x7U+Eaay9HQIBOWob2i KJUNBJffTz+2RR5QX23+x9lMMAq+uyLbJ/8VxGQgpIhR4cvfJCYWchoD7M5/tGqwWr1PwlD1IOh phcy/hr1eEiUzCDf X-Google-Smtp-Source: AGHT+IGlmOPFL96uGyOaQnt+k/ffipNuKKww0Hcx3GnmKMAfMzizWqnz92pz9LmkOZ9cY41KdWHwaw== X-Received: by 2002:a05:600c:1c86:b0:439:98ca:e39b with SMTP id 5b1f17b1804b1-43998cae5a5mr15787535e9.29.1739895883391; Tue, 18 Feb 2025 08:24:43 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-43996b35040sm17053145e9.23.2025.02.18.08.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 08:24:42 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 18 Feb 2025 16:24:37 +0000 Subject: [PATCH v2 3/5] merge-tree: only use basic merge config Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Phillip Wood , Phillip Wood , Phillip Wood From: Phillip Wood From: Phillip Wood Commit 9c93ba4d0ae (merge-recursive: honor diff.algorithm, 2024-07-13) replaced init_merge_options() with init_basic_merge_config() for use in plumbing commands and init_ui_merge_config() for use in porcelain commands. As "git merge-tree" is a plumbing command it should call init_basic_merge_config() rather than init_ui_merge_config(). The merge ort machinery ignores "diff.algorithm" so the behavior is unchanged by this commit but it future proofs us against any future changes to init_ui_merge_config(). Signed-off-by: Phillip Wood --- builtin/merge-tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c index 3c73482f2b0..3ec7127b3a6 100644 --- a/builtin/merge-tree.c +++ b/builtin/merge-tree.c @@ -576,7 +576,7 @@ int cmd_merge_tree(int argc, }; /* Init merge options */ - init_ui_merge_options(&o.merge_options, the_repository); + init_basic_merge_options(&o.merge_options, the_repository); /* Parse arguments */ original_argc = argc - 1; /* ignoring argv[0] */ From patchwork Tue Feb 18 16:24:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 13980227 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA22626F469 for ; Tue, 18 Feb 2025 16:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895888; cv=none; b=s/Hc9FzQfm8JnQt4j7KBWjFTp0ncpzVu8tfaADpUHIsA5SFRuKrLdG8kOjXZohCIN4jvkKwwacGSJxRPP+kEMVAXORDyyeYjdewG6MDXROQqE/NDatIsWfK0wD0MsWZZMNenqW6jNdFlO9LaFWl7LGQE6IElNb4pGPbZadiCR2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895888; c=relaxed/simple; bh=27gytcY1iCgQodLcrldIKIbF14AesUFaoltzye8Bq/M=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=psgfmAwHaqcWTRsN3KjSnImHt+MCgo1pny1waH5CzphcSHSxRW2S3svaS2QAdzQiFaG7ujnFaZPX5tMWyYaj4xJR+CmmOrSOavrTswckoOjG5/Ztbf0czCcdJYnHvqo3QRU+NojJJb225dDHUxe0h+5kdnEkeloaaWGtxwLT6JQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kC8YRvgj; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kC8YRvgj" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4394a823036so59555715e9.0 for ; Tue, 18 Feb 2025 08:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739895885; x=1740500685; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=wOJwhIyFoZwHfX9r8sLv4CLLdBHhe33cH5JIcOQ4Ffw=; b=kC8YRvgj4v3l8MbIiXygUIcXA50IkOWnCoVY8aqMfw6C4OYL2ZyIYIBb9kS6z8UTCv Ida6Sp6gekcPEKhRCnwTjiqDHjYw6rzj6SEibvSoWVVe1dwJZe7grVSX0UrKXzFaTEn/ ms3WoSyrG85+m5HpgUPLpkq/zaH78UR+/9ItgHTvaxSep2D7IgWXpwwndKBSXiQTJa1m venpuVUetr59gkWHW8gVAtWQBW0AHIHRXO6AmrmEbeLDewSaktRU6J4SqvBuSYo3vYp7 n2Ovtu8/XPw2kYJ78f6IQLz5e6k5DpOy1oykBHi03IEkYt0NULbw7gkoGbvu8Q2xVT4o OO1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739895885; x=1740500685; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wOJwhIyFoZwHfX9r8sLv4CLLdBHhe33cH5JIcOQ4Ffw=; b=bLbBqTgtixuWqNuyckxomGo7ZSlPWYMIm+TSmjy2pp3SQa3jRLvCyKpnB+NklZJNsP O3y2QLnP3ch6diQXq47gBDNQXBmwVhgLeN6NDkiNKzuwhg5ScH1hBDXBC3heOQEslRra l0xjdiXGQGqoo2fPlZ51oOQ9UB9Lsz80yFkv3bjgpvByQQCbEfpdONdPmZiBDStJHysP LpnkK/sd3XWUjppSCVyXi7eqiRNt+b/63v5fnqUhLr+45YsIZpH+FWX+i4bLEogoZ0Ep s0Cw+TOxp+X0PilLz+ugWJ1qHCCb7oBLUnPVPqq/agDfN20MRQ8YsF79W/VVJVo54Nq0 v6lw== X-Gm-Message-State: AOJu0Yx3/DgPUb1lnPs7nhDsbEIebTlzb/OrQ0D5aP+aAWavX1FlszK+ L7ZIxHHQq5/iiA74wg/8RPwNHsz+/SCxW+toT7JURUPFu6DRUCb3Ozjc2g== X-Gm-Gg: ASbGncu0zkfh/FLxckiISKJoN7LzatsAiuYTLrrmnuC5Iuirg+XrnedGBuxx0LTCGDs dmNzE6dF2WVhDlUNanDnZTasQ2UFRZILLSv/1T8Xaq71hIemw5yOwHESikPAB/V9XqFAb9B37jU HgiYpnkbRh+Va6ET5h/bxSMIl5QZCiwcvbtWVaFuBtouPKEgr4wWw6s3JAIYOszIXRXFxhFjDYR 6Hi4lMygZv/s65Vi5GqORiz4uCOhHTGUJ2Zypd2U2GpVi1vYZSMh3BWA06kKrlZO4Oe1HPVMpFT owiK1TGuR81Hmy7h X-Google-Smtp-Source: AGHT+IFZlJc0qkAI8HNz8o6+gZFwIx4B62Ebiwu2kdMQttyAcEn72kZhfYS3J6mqjTjz1aYss+hXXA== X-Received: by 2002:a05:600c:1c96:b0:439:98f6:8bc8 with SMTP id 5b1f17b1804b1-43998f68d3fmr9247115e9.26.1739895884270; Tue, 18 Feb 2025 08:24:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258f5efdsm15225212f8f.43.2025.02.18.08.24.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 08:24:43 -0800 (PST) Message-Id: <1645b0e747e9bd65147bb0bc4123cfa32ca68818.1739895879.git.gitgitgadget@gmail.com> In-Reply-To: References: Date: Tue, 18 Feb 2025 16:24:38 +0000 Subject: [PATCH v2 4/5] merge-tree: improve docs for --stdin Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Phillip Wood , Phillip Wood , Phillip Wood From: Phillip Wood From: Phillip Wood Add a section for --stdin in the list of options and document that it implies -z so readers know how to parse the output. Also correct the merge status documentation for --stdin as if the status is less than zero "git merge-tree" dies before printing it. Signed-off-by: Phillip Wood --- Documentation/git-merge-tree.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt index 0b6a8a19b1f..efb16b4f27d 100644 --- a/Documentation/git-merge-tree.txt +++ b/Documentation/git-merge-tree.txt @@ -40,6 +40,11 @@ After the merge completes, a new toplevel tree object is created. See OPTIONS ------- +--stdin:: + Read the commits to merge from the standard input rather than + the command-line. See <> below for more + information. Implies `-z`. + -z:: Do not quote filenames in the section, and end each filename with a NUL character rather than @@ -116,8 +121,6 @@ This is an integer status followed by a NUL character. The integer status is: 0: merge had conflicts 1: merge was clean - <0: something prevented the merge from running (e.g. access to repository - objects denied by filesystem) [[OIDTLT]] OID of toplevel tree @@ -235,6 +238,7 @@ with linkgit:git-merge[1]: * any messages that would have been printed to stdout (the <>) +[[INPUT]] INPUT FORMAT ------------ 'git merge-tree --stdin' input format is fully text based. Each line From patchwork Tue Feb 18 16:24:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phillip Wood X-Patchwork-Id: 13980228 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1684826F473 for ; Tue, 18 Feb 2025 16:24:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895888; cv=none; b=YHckD0qZ0T20jYhrmFNP10Gvg5qaFxiCgAcOARWptZUv4ymawy6BBLWeCKhXb0sCStPXD9O+HQ9O65wRREjB6jbjwPaov9uygVCYG9/9nvhdrqUrcod/nJhOjIMb6tRJebREVOpS1SFpJfvHraQ8NNJLt+Q85RSif0PtSuyEOP0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739895888; c=relaxed/simple; bh=+S1zg5XbCyQ7711DWFK4Erle4f9KxWiAuUlp3bpaVVM=; h=Message-Id:In-Reply-To:References:From:Date:Subject:Content-Type: MIME-Version:To:Cc; b=YdgHwTXxpTtCRLIBHKjRkyNlifpmklwv+D97rH5Kinzd/1zCww/n6RVpgQ8rzO13jGLDcP+e4HAwUbTXRmG1D+ZIGL4LWkQrhhKFrdZRMR0JEGVpx66xxeENx3sS7r6V6Qjws9YOu1Pe4NivNxkRX319iYi+N/c3ecJS2NX3RXc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TeuXssF5; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TeuXssF5" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-38f3913569fso1791532f8f.1 for ; Tue, 18 Feb 2025 08:24:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739895885; x=1740500685; darn=vger.kernel.org; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:from:to:cc:subject:date :message-id:reply-to; bh=a7FtHLrzUWo+GJfYTEfGjK8nJID5aIuC0/8aOGD2Gy4=; b=TeuXssF5WA8JdckM2oRkLaDEHOaUO838Oh+kHpCN5dT32HKpqMSg41MYyD1KElxBKq 4+5xAplgfQxA3BqaH9tn+ilJ7bYTjM9wGncdpAzK2gFXqF6HkZK3e50mDJ9SQE6MQbc5 aF5hpMaOcBn4WGr1HR0pK2+Izd00I5DrOaKSIv3eJzHO5rnkVBj0zt5trsvhkcRCY5nN XcBscJW89idDI6wBjTfGe4CuCeO5PWogs2fFofIq7EN55bp6+xC+ZMEMaPnsl99dmQ0s PHPzHrOS1P5dhKUFU2JyFzMGLcHhFjzIYLl5qR0//y53X89RDstDhp5QgbdxXtFINMYB mwpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739895885; x=1740500685; h=cc:to:mime-version:content-transfer-encoding:fcc:subject:date:from :references:in-reply-to:message-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a7FtHLrzUWo+GJfYTEfGjK8nJID5aIuC0/8aOGD2Gy4=; b=MCCIoaa9kZhPRN1StKvkx62wbVVxSHNUE3/23T14tErl8vtOZA/G6gwoqREjXnL82e FWCBWpjs94MwpQWE7UINwwPsfYqi8zCN2nj+57+feQdLQGI+IgQM9ThADK1De/WThBi2 e749dd1GZJ2fX5TjIli1jcNpC7OOuSSsQItU8l3qy0UBnP1H1hxPbrqL4jbpC60KxQcS n/kboynHJP3wGIzzD38N90JgCTWsjQLPuUQn/vqo17hDhOM4B00Fv4AQY6Kt3k3XzjEz sR6Y8m/kNSFuFLsOcafy5DdWjmORAJD0EREzv3lFan6ugMsjveS/awmLxvJWbVWBYaA3 6sbQ== X-Gm-Message-State: AOJu0YzQhBDKuzKeW5yVwe5kqKmW7EwxJU8Dm3aj9om2DeNDgbQHdAvy wBNzFMMFO4eIY1z15O/aDp4nNSpnU7V552NE4+FznuOnHR4fYr8anrTDdQ== X-Gm-Gg: ASbGncs2RoeJyPMwUiGnWwcqMGhkHwwF3g9o4G+CYIcqae3d+eNAPJLjadLt9AkJ/5f K5OuW2DQYodnk+mSRFHodGMOwbhd0T8SfCokbQAqRlPcVVUmKyZJs+7Pp3qTna80kVcjKXXy6ug nguX2E1pvaUDl+Bb/AzRhEkOuPRe3O+flebQPi1Vn0osIF9Omg3rN60IONBuf9CT/nBq4Of3kk/ DdkngczofozjipD95GGAcHlR8hYJx0sFW3eAQa7RpyIS5ojTXXti1sM3fGP7o8BXe8cN6xSpDXx O/wYiS+PXdFc1Y8o X-Google-Smtp-Source: AGHT+IFl1yP3/EdXoNtYNKq/tqB+oYzAI4WWis9diGW6wE4ybdpXo9a/BofJk8Am6yD2Tl1v69OJPA== X-Received: by 2002:a5d:6d83:0:b0:38f:2c10:da1e with SMTP id ffacd0b85a97d-38f57ea22c6mr377178f8f.27.1739895884933; Tue, 18 Feb 2025 08:24:44 -0800 (PST) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f25914171sm15615846f8f.53.2025.02.18.08.24.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2025 08:24:44 -0800 (PST) Message-Id: In-Reply-To: References: Date: Tue, 18 Feb 2025 16:24:39 +0000 Subject: [PATCH v2 5/5] merge-tree: fix link formatting in html docs Fcc: Sent Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 To: git@vger.kernel.org Cc: Elijah Newren , Phillip Wood , Phillip Wood , Phillip Wood From: Phillip Wood From: Phillip Wood In the html documentation the link to the "OUTPUT" section is surrounded by square brackets. Fix this by adding explicit link text to the cross reference. Signed-off-by: Phillip Wood --- Documentation/git-merge-tree.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/git-merge-tree.txt b/Documentation/git-merge-tree.txt index efb16b4f27d..cf0578f9b5e 100644 --- a/Documentation/git-merge-tree.txt +++ b/Documentation/git-merge-tree.txt @@ -49,7 +49,8 @@ OPTIONS Do not quote filenames in the section, and end each filename with a NUL character rather than newline. Also begin the messages section with a NUL character - instead of a newline. See <> below for more information. + instead of a newline. See <> below for more + information. --name-only:: In the Conflicted file info section, instead of writing a list