forked from git/git
-
Notifications
You must be signed in to change notification settings - Fork 142
merge-tree: add new --quiet option #1920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,12 @@ OPTIONS | |
default is to include these messages if there are merge | ||
newren marked this conversation as resolved.
Show resolved
Hide resolved
newren marked this conversation as resolved.
Show resolved
Hide resolved
newren marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, "Kristoffer Haugsbakk" wrote (reply to this): On Fri, May 16, 2025, at 22:04, Elijah Newren via GitGitGadget wrote:
> From: Elijah Newren <[email protected]>
> + 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the Git mailing list, "Kristoffer Haugsbakk" wrote (reply to this): On Sat, May 17, 2025, at 21:52, Kristoffer Haugsbakk wrote:
> Can’t they opt into a new informational mode where
> `--stdin --quiet` can co-exist?
Yes, I now immediately see the contradiction in the
literal text: “informational mode” and `--quiet`.
But I shall not weigh in on the naming matter.
--
Kristoffer Haugsbakk
|
||
conflicts, and to omit them otherwise. | ||
|
||
--quiet:: | ||
Disable all output from the program. Useful when you are only | ||
interested in the exit status. Allows merge-tree to exit | ||
early when it finds a conflict, and allows it to avoid writing | ||
most objects created by merges. | ||
|
||
--allow-unrelated-histories:: | ||
merge-tree will by default error out if the two branches specified | ||
share no common history. This flag can be given to override that | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.