Skip to content

Commit 3e41485

Browse files
pcloudsgitster
authored andcommitted
read-tree: add --quiet
read-tree is basically the front end of unpack-trees code and shoud expose all of its functionality (unless it's designed for internal use). This "opts.quiet" (formerly "opts.gently") was added for builtin/checkout.c but there is no reason why other read-tree users won't find this useful. The test that is updated to run 'read-tree --quiet' was added because unpack-trees was accidentally not being quiet [1] in 6a143aa (checkout -m: attempt merge when deletion of path was staged - 2014-08-12). Because checkout is the only "opts.quiet" user, there was no other way to test quiet behavior. But we can now test it directly. 6a143aa was manually reverted to verify that read-tree --quiet works correctly (i.e. test_must_be_empty fails). [1] the commit message there say "errors out instead of performing a merge" but I'm pretty sure the "performing a merge" happens anyway even before that commit. That line should say "errors out _in addition to_ performing a merge" Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b165fac commit 3e41485

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

Documentation/git-read-tree.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ OPTIONS
128128
Instead of reading tree object(s) into the index, just empty
129129
it.
130130

131+
-q::
132+
--quiet::
133+
Quiet, suppress feedback messages.
134+
131135
<tree-ish#>::
132136
The id of the tree object(s) to be read/merged.
133137

builtin/read-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ int cmd_read_tree(int argc, const char **argv, const char *unused_prefix)
154154
{ OPTION_CALLBACK, 0, "recurse-submodules", NULL,
155155
"checkout", "control recursive updating of submodules",
156156
PARSE_OPT_OPTARG, option_parse_recurse_submodules_worktree_updater },
157+
OPT__QUIET(&opts.quiet, N_("suppress feedback messages")),
157158
OPT_END()
158159
};
159160

t/t7201-co.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ test_expect_success 'switch to another branch while carrying a deletion' '
223223
test_must_fail git checkout simple 2>errs &&
224224
test_i18ngrep overwritten errs &&
225225
226+
test_must_fail git read-tree --quiet -m -u HEAD simple 2>errs &&
227+
test_must_be_empty errs &&
228+
226229
git checkout --merge simple 2>errs &&
227230
test_i18ngrep ! overwritten errs &&
228231
git ls-files -u &&

0 commit comments

Comments
 (0)