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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, May 16, 2025, at 22:04, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <newren@xxxxxxxxx>
> +	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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux