Skip to content

Commit 9b899e4

Browse files
JakobDegenmeta-codesync[bot]
authored andcommitted
targets: Flip default on target-hash-recursive
Summary: Previous diff deleted the last reference to recursive target hashing, telemetry also agrees with it being unused. Flip the default, I'll fix up callsites to not pass it at all afterward, then we can delete the flag Reviewed By: AishwaryaSivaraman Differential Revision: D98552750 fbshipit-source-id: 71e28ab1a7d0fd4e302f178d92e560b22588ba86
1 parent 008635b commit 9b899e4

5 files changed

Lines changed: 13 additions & 5 deletions

File tree

app/buck2_client/src/commands/targets.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ pub struct TargetsCommand {
165165

166166
/// When true, emit the hash or target node and all dependencies recursively.
167167
/// When false, hash only the target node.
168-
#[clap(long, action = clap::ArgAction::Set, default_value = "true", conflicts_with = "streaming")]
168+
#[clap(long, action = clap::ArgAction::Set, default_value = "false", conflicts_with = "streaming")]
169169
target_hash_recursive: bool,
170170

171171
#[clap(flatten)]

tests/core/help/test_help_data/buck2-help-targets.golden.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Options:
5656
When true, emit the hash or target node and all dependencies recursively. When false, hash
5757
only the target node
5858

59-
[default: true]
59+
[default: false]
6060
[possible values: true, false]
6161

6262
-A, --output-all-attributes

tests/core/help/test_help_data/buck2-help-utargets.golden.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ Options:
5959
When true, emit the hash or target node and all dependencies recursively. When false, hash
6060
only the target node
6161

62-
[default: true]
62+
[default: false]
6363
[possible values: true, false]
6464

6565
-A, --output-all-attributes

tests/core/targets_command/test_unconfigured_target_hashing.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async def assert_hashes(
3434
"--json",
3535
"--target-hash-file-mode",
3636
"PATHS_ONLY",
37+
"--target-hash-recursive=true",
3738
)
3839

3940
modified_result = await buck.targets(
@@ -42,6 +43,7 @@ async def assert_hashes(
4243
"--json",
4344
"--target-hash-file-mode",
4445
"PATHS_ONLY",
46+
"--target-hash-recursive=true",
4547
"--target-hash-modified-paths",
4648
modified_path,
4749
)

tests/e2e/targets_command/test_targets.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ async def test_configured_target_hashing(
5959
"--json",
6060
"--target-hash-file-mode",
6161
"PATHS_ONLY",
62+
"--target-hash-recursive=true",
6263
)
6364

6465
# Modify a target
@@ -68,6 +69,7 @@ async def test_configured_target_hashing(
6869
"--json",
6970
"--target-hash-file-mode",
7071
"PATHS_ONLY",
72+
"--target-hash-recursive=true",
7173
"--target-hash-modified-paths",
7274
"buck2/tests/targets/target_hashing/{}".format(src_changed),
7375
)
@@ -109,13 +111,17 @@ def grab(x: BuckResult) -> str:
109111
@buck_test(inplace=True)
110112
async def test_non_recursive_target_hash(buck: Buck) -> None:
111113
target = "fbcode//buck2/tests/targets/target_hashing:rule9"
112-
pre_recursive = await buck.targets(target, "--show-target-hash", "--json")
114+
pre_recursive = await buck.targets(
115+
target, "--show-target-hash", "--json", "--target-hash-recursive=true"
116+
)
113117
pre_direct = await buck.targets(
114118
target, "--show-target-hash", "--json", "--target-hash-recursive=false"
115119
)
116120

117121
config = "-ctesting.hashing=1"
118-
post_recursive = await buck.targets(target, config, "--show-target-hash", "--json")
122+
post_recursive = await buck.targets(
123+
target, config, "--show-target-hash", "--json", "--target-hash-recursive=true"
124+
)
119125
post_direct = await buck.targets(
120126
target, config, "--show-target-hash", "--json", "--target-hash-recursive=false"
121127
)

0 commit comments

Comments
 (0)