From: "Kristoffer Haugsbakk" <kristofferhaugsbakk@fastmail.com>
To: "Josh Soref" <gitgitgadget@gmail.com>, git@vger.kernel.org
Cc: "Elijah Newren" <newren@gmail.com>,
"Phillip Wood" <phillip.wood123@gmail.com>
Subject: Re: [PATCH v4 2/2] merge-tree: add a new --quiet flag
Date: Sat, 17 May 2025 21:52:50 +0200 [thread overview]
Message-ID: <6cc85081-bbdd-43f6-b17d-8baffedec8c9@app.fastmail.com> (raw)
In-Reply-To: <7c40d3c921610576dc7947bc4c517055717dd94e.1747425858.git.gitgitgadget@gmail.com>
On Fri, May 16, 2025, at 22:04, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@gmail.com>
> + if (quiet && o.show_messages == -1)
> + o.show_messages = 0;
> + o.merge_options.mergeability_only = quiet;
> + die_for_incompatible_opt2(quiet, "--quiet", o.show_messages, "--messages");
> + die_for_incompatible_opt2(quiet, "--quiet", o.name_only, "--name-only");
> + die_for_incompatible_opt2(quiet, "--quiet", o.use_stdin, "--stdin");
> + die_for_incompatible_opt2(quiet, "--quiet", !line_termination, "-z");
I’ve been using git-merge-tree(1) for some scripting but only today
tried out `--stdin` for printing refs that conflict.
```
# Pipe in pairs
merge_pairs=$(mktemp)
tee $merge_pairs \
| git merge-tree --stdin --no-messages \
| tr '\0' '\n' \
| grep --extended-regexp '^(1|0)$' \
| paste -d' ' - $merge_pairs \
| grep '^0' \
| cut -d' ' -f2-
```
(Previously I called the command in a loop)
I could imagine a `--format` option to just keep one of the arguments,
which means the tee(1) (for cross-referencing the ref) and all the other
things are gone:
```
git merge-tree --format='%(if)%(conflicted)%(then)oid2%(end)' --stdin
```
(But imagined options aside)
`--stdin` is presumably for efficiency and `--quiet`/`--dry-run`
definitely is. But `--quiet` can only be used in the mode where you can
only do a single merge, not in the `--stdin` batch mode.
`--quiet`/`--dry-run` with informational output (c.f. the above
die-for-incompatible) would “break” the documented output format since
conflicts haven’t been computed all the way and there are no OIDs for
successful merges. But the user is opting into a new mode here, never
seen before. Can’t they opt into a new informational mode where
`--stdin --quiet` can co-exist? Then you can have dry-run batch mode.
--
Kristoffer Haugsbakk
next prev parent reply other threads:[~2025-05-17 19:53 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-10 22:02 [PATCH 0/2] merge-tree: add new --mergeability-only option Elijah Newren via GitGitGadget
2025-05-10 22:02 ` [PATCH 1/2] merge-ort: add a new mergeability_only option Elijah Newren via GitGitGadget
2025-05-10 22:02 ` [PATCH 2/2] merge-tree: add a new --mergeability-only flag Elijah Newren via GitGitGadget
2025-05-12 17:04 ` [PATCH 0/2] merge-tree: add new --mergeability-only option Junio C Hamano
2025-05-12 17:41 ` Elijah Newren
2025-05-12 18:27 ` Junio C Hamano
2025-05-12 18:37 ` Elijah Newren
2025-05-12 23:42 ` [PATCH v2 0/2] merge-tree: add new --dry-run option Elijah Newren via GitGitGadget
2025-05-12 23:42 ` [PATCH v2 1/2] merge-ort: add a new mergeability_only option Elijah Newren via GitGitGadget
2025-05-12 23:42 ` [PATCH v2 2/2] merge-tree: add a new --dry-run flag Elijah Newren via GitGitGadget
2025-05-13 7:15 ` Kristoffer Haugsbakk
2025-05-13 15:28 ` Elijah Newren
2025-05-13 13:24 ` Junio C Hamano
2025-05-13 15:30 ` Elijah Newren
2025-05-14 14:08 ` Junio C Hamano
2025-05-14 0:24 ` [PATCH v3 0/2] merge-tree: add new --dry-run option Elijah Newren via GitGitGadget
2025-05-14 0:24 ` [PATCH v3 1/2] merge-ort: add a new mergeability_only option Elijah Newren via GitGitGadget
2025-05-14 0:24 ` [PATCH v3 2/2] merge-tree: add a new --dry-run flag Elijah Newren via GitGitGadget
2025-05-15 13:07 ` Junio C Hamano
2025-05-16 13:18 ` Phillip Wood
2025-05-16 16:03 ` Elijah Newren
2025-05-14 15:34 ` [PATCH v3 0/2] merge-tree: add new --dry-run option Kristoffer Haugsbakk
2025-05-16 20:04 ` [PATCH v4 0/2] merge-tree: add new --quiet option Elijah Newren via GitGitGadget
2025-05-16 20:04 ` [PATCH v4 1/2] merge-ort: add a new mergeability_only option Elijah Newren via GitGitGadget
2025-05-16 20:04 ` [PATCH v4 2/2] merge-tree: add a new --quiet flag Elijah Newren via GitGitGadget
2025-05-17 19:52 ` Kristoffer Haugsbakk [this message]
2025-05-17 19:57 ` Kristoffer Haugsbakk
2025-05-19 9:05 ` [PATCH v4 0/2] merge-tree: add new --quiet option Phillip Wood
2025-05-19 15:59 ` 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=6cc85081-bbdd-43f6-b17d-8baffedec8c9@app.fastmail.com \
--to=kristofferhaugsbakk@fastmail.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=newren@gmail.com \
--cc=phillip.wood123@gmail.com \
/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).