Skip to content

Commit 39bbd03

Browse files
committed
Add docs and --dry-run
1 parent 1280123 commit 39bbd03

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

gix-diff/src/blob/unified_diff/impls.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ where
260260
}
261261

262262
impl DiffLineKind {
263-
/// TODO: Document.
263+
/// Returns a one-character representation for use in unified diffs.
264264
pub const fn to_prefix(self) -> char {
265265
match self {
266266
DiffLineKind::Context => ' ',

tests/it/src/args.rs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,19 @@ pub enum Subcommands {
123123
#[clap(value_parser = AsPathSpec)]
124124
patterns: Vec<gix::pathspec::Pattern>,
125125
},
126-
/// TODO: add description.
126+
/// Take a slider file generated with the help of [diff-slider-tools] and turn it into a series
127+
/// of baseline diffs to be used in [slider-rs].
128+
///
129+
/// See [make-diff-for-sliders-repo] for details.
130+
///
131+
/// [diff-slider-tools]: https://github.com/mhagger/diff-slider-tools
132+
/// [slider-rs]: gix-diff/tests/diff/blob/slider.rs
133+
/// [make-diff-for-sliders-repo]: gix-diff/tests/fixtures/make_diff_for_sliders_repo.sh
127134
CreateDiffCases {
128-
/// TODO: add description.
135+
/// Don't really copy anything.
136+
#[clap(long, short = 'n')]
137+
dry_run: bool,
138+
/// The `.sliders` file that contains a list of sliders.
129139
#[clap(long)]
130140
sliders_file: PathBuf,
131141
/// The git root to extract the diff-related parts from.
@@ -134,7 +144,7 @@ pub enum Subcommands {
134144
/// The directory into which to copy the files.
135145
#[clap(long)]
136146
destination_dir: PathBuf,
137-
/// TODO: add description.
147+
/// The number of sliders to generate test cases for.
138148
#[clap(long, default_value_t = 10)]
139149
count: usize,
140150
/// The directory to place assets in.

tests/it/src/commands/create_diff_cases.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@ pub(super) mod function {
1111
};
1212

1313
pub fn create_diff_cases(
14+
dry_run: bool,
1415
sliders_file: PathBuf,
1516
worktree_dir: &Path,
1617
destination_dir: PathBuf,
1718
count: usize,
1819
asset_dir: Option<BString>,
1920
) -> anyhow::Result<()> {
20-
// TODO: turn into parameter.
21-
let dry_run = false;
22-
2321
let prefix = if dry_run { "WOULD" } else { "Will" };
2422
let sliders = std::fs::read_to_string(&sliders_file)?;
2523

tests/it/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,13 @@ fn main() -> anyhow::Result<()> {
4747
patterns,
4848
} => commands::copy_royal(dry_run, &worktree_root, destination_dir, patterns),
4949
Subcommands::CreateDiffCases {
50+
dry_run,
5051
sliders_file,
5152
worktree_dir,
5253
destination_dir,
5354
count,
5455
asset_dir,
55-
} => commands::create_diff_cases(sliders_file, &worktree_dir, destination_dir, count, asset_dir),
56+
} => commands::create_diff_cases(dry_run, sliders_file, &worktree_dir, destination_dir, count, asset_dir),
5657
Subcommands::CheckMode {} => commands::check_mode(),
5758
Subcommands::Env {} => commands::env(),
5859
}

0 commit comments

Comments
 (0)