git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/2] merge-tree: add a new --quiet flag

From
KHKristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>
Date
May 17, 2025, 19:52 UTC
Message-ID
<6cc85081-bbdd-43f6-b17d-8baffedec8c9@app.fastmail.com>
In-Reply-To
<7c40d3c921610576dc7947bc4c517055717dd94e.1747425858.git.gitgitgadget@gmail.com>
On Fri, May 16, 2025, at 22:04, Elijah Newren via GitGitGadget wrote:
Show 8 quoted lines
> 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
Previous: Elijah Newren via GitGitGadgetNext: Kristoffer Haugsbakk
Message 26 of 29 in “merge-tree: add new --mergeability-only option”
  1. 0/2 merge-tree: add new --mergeability-only optionElijah Newren via GitGitGadget, May 10, 2025
  2. 1/2 merge-ort: add a new mergeability_only optionElijah Newren via GitGitGadget, May 10, 2025
  3. 2/2 merge-tree: add a new --mergeability-only flagElijah Newren via GitGitGadget, May 10, 2025
  4. Junio C HamanoMay 12, 2025
  5. Elijah NewrenMay 12, 2025
  6. Junio C HamanoMay 12, 2025
  7. Elijah NewrenMay 12, 2025
  8. 0/2 merge-tree: add new --dry-run optionElijah Newren via GitGitGadget, May 12, 2025
  9. 1/2 merge-ort: add a new mergeability_only optionElijah Newren via GitGitGadget, May 12, 2025
  10. 2/2 merge-tree: add a new --dry-run flagElijah Newren via GitGitGadget, May 12, 2025
  11. Kristoffer HaugsbakkMay 13, 2025
  12. Elijah NewrenMay 13, 2025
  13. Junio C HamanoMay 13, 2025
  14. Elijah NewrenMay 13, 2025
  15. Junio C HamanoMay 14, 2025
  16. 0/2 merge-tree: add new --dry-run optionElijah Newren via GitGitGadget, May 14, 2025
  17. 1/2 merge-ort: add a new mergeability_only optionElijah Newren via GitGitGadget, May 14, 2025
  18. 2/2 merge-tree: add a new --dry-run flagElijah Newren via GitGitGadget, May 14, 2025
  19. Junio C HamanoMay 15, 2025
  20. Phillip WoodMay 16, 2025
  21. Elijah NewrenMay 16, 2025
  22. Kristoffer HaugsbakkMay 14, 2025
  23. 0/2 merge-tree: add new --quiet optionElijah Newren via GitGitGadget, May 16, 2025
  24. 1/2 merge-ort: add a new mergeability_only optionElijah Newren via GitGitGadget, May 16, 2025
  25. 2/2 merge-tree: add a new --quiet flagElijah Newren via GitGitGadget, May 16, 2025
  26. Kristoffer HaugsbakkMay 17, 2025
  27. Kristoffer HaugsbakkMay 17, 2025
  28. Phillip WoodMay 19, 2025
  29. Junio C HamanoMay 19, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.