提交 4a73aaaf 编写于 作者: J Jeff King 提交者: Junio C Hamano

patch-id: use RUN_SETUP_GENTLY

Patch-id does not require a repository because it is just
processing the incoming diff on stdin, but it may look at
git config for keys like patchid.stable.

Even though we do not setup_git_directory(), this works from
the top-level of a repository because we blindly look at
".git/config" in this case. But as the included test
demonstrates, it does not work from a subdirectory.

We can fix it by using RUN_SETUP_GENTLY. We do not take any
filenames from the user on the command line, so there's no
need to adjust them via prefix_filename().
Signed-off-by: NJeff King <peff@peff.net>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 0e94ee94
...@@ -444,7 +444,7 @@ static struct cmd_struct commands[] = { ...@@ -444,7 +444,7 @@ static struct cmd_struct commands[] = {
{ "pack-objects", cmd_pack_objects, RUN_SETUP }, { "pack-objects", cmd_pack_objects, RUN_SETUP },
{ "pack-redundant", cmd_pack_redundant, RUN_SETUP }, { "pack-redundant", cmd_pack_redundant, RUN_SETUP },
{ "pack-refs", cmd_pack_refs, RUN_SETUP }, { "pack-refs", cmd_pack_refs, RUN_SETUP },
{ "patch-id", cmd_patch_id }, { "patch-id", cmd_patch_id, RUN_SETUP_GENTLY },
{ "pickaxe", cmd_blame, RUN_SETUP }, { "pickaxe", cmd_blame, RUN_SETUP },
{ "prune", cmd_prune, RUN_SETUP }, { "prune", cmd_prune, RUN_SETUP },
{ "prune-packed", cmd_prune_packed, RUN_SETUP }, { "prune-packed", cmd_prune_packed, RUN_SETUP },
......
...@@ -143,6 +143,20 @@ test_expect_success 'patch-id supports git-format-patch MIME output' ' ...@@ -143,6 +143,20 @@ test_expect_success 'patch-id supports git-format-patch MIME output' '
test_cmp patch-id_master patch-id_same test_cmp patch-id_master patch-id_same
' '
test_expect_success 'patch-id respects config from subdir' '
test_config patchid.stable true &&
mkdir subdir &&
# copy these because test_patch_id() looks for them in
# the current directory
cp bar-then-foo foo-then-bar subdir &&
(
cd subdir &&
test_patch_id irrelevant patchid.stable=true
)
'
cat >nonl <<\EOF cat >nonl <<\EOF
diff --git i/a w/a diff --git i/a w/a
index e69de29..2e65efe 100644 index e69de29..2e65efe 100644
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册