git-loom 0.25.0

A Git CLI tool that weaves together multiple feature branches into integration branches
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
use crate::core::hunk_select::HunkArgs;
use crate::core::test_helpers::TestRepo;

// ── HEAD split tests ──────────────────────────────────────────────────

#[test]
fn split_head_commit() {
    // Split HEAD into two commits: one with file1.txt, one with file2.txt
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");

    // Create a commit that touches two files
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "content a"), ("file_b.txt", "content b")],
        "Two files commit",
    );

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "First part".to_string(),
    );

    assert!(result.is_ok(), "split_head_commit failed: {:?}", result);

    // HEAD should be the second commit (original message)
    assert_eq!(test_repo.get_subject(0), "Two files commit");
    // HEAD~1 should be the first commit (new message)
    assert_eq!(test_repo.get_subject(1), "First part");

    // Verify files are in the right commits
    assert_eq!(
        test_repo.commit_file_paths(test_repo.get_oid(0)),
        vec!["file_b.txt"]
    );
    assert_eq!(
        test_repo.commit_file_paths(test_repo.get_oid(1)),
        vec!["file_a.txt"]
    );
}

#[test]
fn split_head_commit_with_absolute_path() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");

    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "content a"), ("file_b.txt", "content b")],
        "Two files commit",
    );

    let abs = test_repo
        .workdir()
        .join("file_a.txt")
        .to_string_lossy()
        .into_owned();

    let result = test_repo.in_dir(|| {
        super::split_commit_with_selection(
            &test_repo.repo,
            &target_oid.to_string(),
            vec![abs.clone()],
            "First part".to_string(),
        )
    });

    assert!(
        result.is_ok(),
        "split with absolute path failed: {result:?}"
    );
    assert_eq!(
        test_repo.commit_file_paths(test_repo.get_oid(1)),
        vec!["file_a.txt"]
    );
}

// ── Non-HEAD split tests ──────────────────────────────────────────────

#[test]
fn split_non_head_commit() {
    // Split a commit that is not HEAD — requires rebase
    let test_repo = TestRepo::new_with_remote();

    // Create a commit with two files
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "content a"), ("file_b.txt", "content b")],
        "Two files commit",
    );

    // Add another commit on top
    test_repo.commit("Later commit", "later.txt");

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "First part".to_string(),
    );

    assert!(result.is_ok(), "split_non_head_commit failed: {:?}", result);

    // HEAD should still be the later commit
    assert_eq!(test_repo.get_subject(0), "Later commit");
    // HEAD~1 should be the second part (original message)
    assert_eq!(test_repo.get_subject(1), "Two files commit");
    // HEAD~2 should be the first part (new message)
    assert_eq!(test_repo.get_subject(2), "First part");
}

// ── Validation error tests ───────────────────────────────────────────

#[test]
fn split_single_file_fails() {
    let test_repo = TestRepo::new();
    let c1_oid = test_repo.commit("Single file", "only.txt");

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &c1_oid.to_string(),
        vec!["only.txt".to_string()],
        "Should fail".to_string(),
    );

    assert!(result.is_err(), "Should fail on single-file commit");
    let err = result.unwrap_err().to_string();
    assert!(
        err.contains("only one file"),
        "Error should mention single file: {}",
        err
    );
}

#[test]
fn split_merge_commit_fails() {
    let test_repo = TestRepo::new();
    let c1_oid = test_repo.commit("First", "file1.txt");

    // Create a branch with a different commit
    let default_branch = test_repo.current_branch_name();
    test_repo.create_branch("side");
    test_repo.switch_branch("side");
    let c2_oid = test_repo.commit("Side", "side.txt");

    // Switch back and create a merge
    test_repo.switch_branch(&default_branch);
    let merge_oid = test_repo.commit_merge("Merge", c1_oid, c2_oid);

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &merge_oid.to_string(),
        vec!["file1.txt".to_string()],
        "Should fail".to_string(),
    );

    assert!(result.is_err(), "Should fail on merge commit");
    let err = result.unwrap_err().to_string();
    assert!(
        err.contains("merge commit"),
        "Error should mention merge commit: {}",
        err
    );
}

// ── Preservation tests ───────────────────────────────────────────────

#[test]
fn split_preserves_other_commits() {
    // Commits before and after the split target should be unchanged
    let test_repo = TestRepo::new_with_remote();

    let c1_oid = test_repo.commit("Before", "before.txt");

    // Create a commit with two files
    let split_oid = test_repo.commit_multi(
        &[("file_a.txt", "content a"), ("file_b.txt", "content b")],
        "Split me",
    );

    test_repo.commit("After", "after.txt");

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &split_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "First part".to_string(),
    );

    assert!(
        result.is_ok(),
        "split_preserves_other_commits failed: {:?}",
        result
    );

    // Verify surrounding commits are preserved
    assert_eq!(test_repo.get_subject(0), "After");
    assert_eq!(test_repo.get_subject(1), "Split me");
    assert_eq!(test_repo.get_subject(2), "First part");
    assert_eq!(test_repo.get_subject(3), "Before");

    // Before commit is an ancestor of the rebase range and should be unchanged
    assert_eq!(test_repo.get_oid(3), c1_oid);
}

#[test]
fn split_with_woven_branches() {
    // Verify that split preserves merge topology of woven branches
    let test_repo = TestRepo::new_with_remote();
    let base_oid = test_repo.find_remote_branch_target("origin/main");

    // Create feature-a at merge-base with a two-file commit
    test_repo.create_branch_at("feature-a", &base_oid.to_string());
    test_repo.switch_branch("feature-a");

    let split_oid = test_repo.commit_multi(
        &[("fa1.txt", "content a1"), ("fa2.txt", "content a2")],
        "Feature A files",
    );

    // Switch back to integration, add a commit, then weave
    test_repo.switch_branch("integration");
    test_repo.commit("Int commit", "int.txt");
    test_repo.merge_no_ff("feature-a");

    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &split_oid.to_string(),
        vec!["fa1.txt".to_string()],
        "Feature A part 1".to_string(),
    );

    assert!(
        result.is_ok(),
        "split_with_woven_branches failed: {:?}",
        result
    );

    // Verify feature-a branch still exists
    assert!(
        test_repo.branch_exists("feature-a"),
        "feature-a branch should still exist"
    );

    // Verify the split created two commits on the branch
    // The HEAD should still be on integration with merge topology preserved
    let head = test_repo.head_commit();
    assert!(
        head.parent_count() > 1,
        "HEAD should still be a merge commit"
    );
}

/// Splitting off the deletion half of a commit: the split stages a path that
/// is gone from the working tree.
#[test]
fn split_head_commit_with_a_deletion() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add file1", "file1.txt");

    // A commit that deletes file1.txt and adds file2.txt.
    std::fs::remove_file(test_repo.workdir().join("file1.txt")).unwrap();
    test_repo.write_file("file2.txt", "content b");
    test_repo.stage_files(&["file1.txt", "file2.txt"]);
    test_repo.commit_staged("Delete one, add another");

    let target_oid = test_repo.head_oid();
    let result = super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file1.txt".to_string()],
        "Delete file1".to_string(),
    );

    assert!(result.is_ok(), "split of a deletion failed: {:?}", result);
    assert_eq!(test_repo.get_subject(1), "Delete file1");
    assert_eq!(test_repo.get_subject(0), "Delete one, add another");
    assert!(!test_repo.commit_has_file(test_repo.get_oid(1), "file1.txt"));
    assert_eq!(
        test_repo.commit_file_paths(test_repo.get_oid(0)),
        vec!["file2.txt"]
    );
    test_repo.assert_working_tree_clean();
}

fn blob_at(test_repo: &TestRepo, steps_back: usize, path: &str) -> Vec<u8> {
    let commit = test_repo.find_commit(test_repo.get_oid(steps_back));
    let entry = commit
        .tree()
        .unwrap()
        .get_path(std::path::Path::new(path))
        .unwrap();
    let blob = test_repo.repo.find_blob(entry.id()).unwrap();
    blob.content().to_vec()
}

/// Splitting HEAD resets onto its parent with nothing autostashed, so staging
/// by path would commit the user's edits along with the commit's own content.
/// `a[1].txt` would also match `a1.txt` as a glob.
#[test]
fn split_head_takes_the_files_from_the_commit_not_the_working_tree() {
    let test_repo = TestRepo::new();
    test_repo.commit("Base", "base.txt");
    test_repo.commit_multi(
        &[
            ("a[1].txt", "a\n"),
            ("a1.txt", "one\n"),
            ("gone.txt", "g\n"),
        ],
        "Three files",
    );
    test_repo.write_file("a[1].txt", "a\nDIRTY\n");
    test_repo.write_file("a1.txt", "one\nDIRTY\n");
    std::fs::remove_file(test_repo.workdir().join("gone.txt")).unwrap();

    super::split_commit_with_selection(
        &test_repo.repo,
        "HEAD",
        vec!["a[1].txt".to_string()],
        "First".to_string(),
    )
    .unwrap();

    assert_eq!(
        test_repo.commit_file_paths(test_repo.get_oid(1)),
        vec!["a[1].txt"]
    );
    assert_eq!(blob_at(&test_repo, 0, "a[1].txt"), b"a\n");
    assert_eq!(blob_at(&test_repo, 0, "a1.txt"), b"one\n");
    assert_eq!(blob_at(&test_repo, 0, "gone.txt"), b"g\n");
    assert_eq!(test_repo.read_file("a[1].txt"), "a\nDIRTY\n");
    assert_eq!(
        test_repo.status_porcelain(),
        " M a1.txt\n M a[1].txt\n D gone.txt\n"
    );
}

/// Staging by path committed the unstaged layer into the first half; the
/// staged one must also come back to the index, not the working tree.
#[test]
fn split_head_keeps_a_staged_and_an_unstaged_edit_of_one_file() {
    let test_repo = TestRepo::new();
    test_repo.commit("Base", "base.txt");
    test_repo.commit_multi(&[("a.txt", "a\n"), ("b.txt", "b\n")], "Two files");
    test_repo.write_file("a.txt", "a\nSTAGED\n");
    test_repo.stage_files(&["a.txt"]);
    test_repo.write_file("a.txt", "a\nSTAGED\nUNSTAGED\n");

    super::split_commit_with_selection(
        &test_repo.repo,
        "HEAD",
        vec!["a.txt".to_string()],
        "First".to_string(),
    )
    .unwrap();

    assert_eq!(blob_at(&test_repo, 1, "a.txt"), b"a\n");
    assert_eq!(blob_at(&test_repo, 0, "b.txt"), b"b\n");
    assert_eq!(test_repo.status_porcelain(), "MM a.txt\n");
    assert_eq!(test_repo.read_file("a.txt"), "a\nSTAGED\nUNSTAGED\n");
    let index = test_repo.repo.index().unwrap();
    let staged = index.get_path(std::path::Path::new("a.txt"), 0).unwrap();
    let blob = test_repo.repo.find_blob(staged.id).unwrap();
    assert_eq!(blob.content(), b"a\nSTAGED\n");
}

#[test]
fn split_head_by_hunks_takes_whole_files_from_the_commit() {
    let test_repo = TestRepo::new();
    test_repo.commit("Base", "base.txt");
    test_repo.write_file("text.txt", "one\n");
    std::fs::write(test_repo.workdir().join("f.bin"), b"\0one").unwrap();
    std::fs::remove_file(test_repo.workdir().join("base.txt")).unwrap();
    test_repo.stage_files(&["text.txt", "f.bin", "base.txt"]);
    test_repo.commit_staged("Text, binary and a deletion");
    let workdir = test_repo.workdir();
    let mut selections = crate::core::staging::collect_commit_hunks(&workdir, "HEAD", &[]).unwrap();
    for file in &mut selections {
        for hunk in &mut file.hunks {
            hunk.selected = file.path != "text.txt";
        }
    }
    test_repo.write_file("text.txt", "one\nDIRTY\n");
    std::fs::write(workdir.join("f.bin"), b"\0dirty").unwrap();
    test_repo.write_file("base.txt", "recreated\n");

    super::perform_head_split_by_hunks(
        &test_repo.repo,
        &workdir,
        &selections,
        Some("Binary"),
        "Text",
    )
    .unwrap();

    assert_eq!(blob_at(&test_repo, 1, "f.bin"), b"\0one");
    assert!(!test_repo.commit_has_file(test_repo.get_oid(1), "base.txt"));
    assert_eq!(blob_at(&test_repo, 0, "text.txt"), b"one\n");
    assert_eq!(
        test_repo.status_porcelain(),
        " M f.bin\n M text.txt\n?? base.txt\n"
    );
}

/// A submodule has to be split by the commit's own diff: `git add` would stage
/// whatever its checkout currently holds. Here the checkout deliberately holds
/// the *pre-image*, so staging by path would drop the bump from history.
#[test]
fn split_by_hunks_takes_a_submodule_from_the_commit() {
    use crate::tui::hunk_selector::{FileEntry, HunkEntry, HunkOrigin};

    let test_repo = TestRepo::new();
    let (first, second) = test_repo.add_submodule("Data");
    test_repo.commit_staged("Add submodule");

    test_repo.checkout_submodule("Data", second);
    test_repo.write_file("other.txt", "other");
    test_repo.stage_files(&["Data", "other.txt"]);
    test_repo.commit_staged("Bump and add");

    // An uncommitted downgrade sitting in the checkout.
    test_repo.checkout_submodule("Data", first);

    let entry = |path: &str, selected: bool, binary: bool| FileEntry {
        path: path.to_string(),
        hunks: vec![HunkEntry {
            hunk: crate::core::diff::DiffHunk {
                text: String::from("(submodule)"),
                modified_lines: vec![],
            },
            selected,
            origin: HunkOrigin::Commit,
        }],
        index_status: 'M',
        worktree_status: ' ',
        binary,
    };
    let selections = [entry("Data", true, true), entry("other.txt", false, false)];

    let workdir = test_repo.workdir();
    let (hash1, _hash2) = super::perform_head_split_by_hunks(
        &test_repo.repo,
        &workdir,
        &selections,
        Some("first"),
        "second",
    )
    .unwrap();

    let split_off = git2::Oid::from_str(&hash1).unwrap();
    assert_eq!(test_repo.submodule_oid(split_off, "Data"), second);
    assert_eq!(test_repo.get_subject(1), "first");
    assert_eq!(test_repo.get_subject(0), "second");
}

#[test]
fn split_refuses_when_the_replay_is_dropped() {
    // Same dropped-commit stop as reword, but split's `reset --mixed HEAD~1`
    // would destroy the commit below the target instead of amending it.
    let (t, target) = crate::core::test_helpers::repo_with_dropped_replay();
    let head_before = t.head_oid();
    let base_before = t.find_remote_branch_target("origin/main");

    let err = super::split_commit_with_selection(
        &t.repo,
        &target.to_string(),
        vec!["one.txt".to_string()],
        "First part".to_string(),
    )
    .unwrap_err()
    .to_string();

    assert!(err.contains("is redundant"), "{err}");
    assert_eq!(t.head_oid(), head_before, "{err}");
    assert_eq!(
        t.find_remote_branch_target("origin/main"),
        base_before,
        "{err}"
    );
    assert!(!crate::git::rebase_is_in_progress(t.repo.path()), "{err}");
}

// ── Change-Id ────────────────────────────────────────────────────────────

const CHANGE_ID: &str = "I0123456789abcdef0123456789abcdef01234567";

fn change_id_at(test_repo: &TestRepo, steps_back: usize) -> Option<String> {
    crate::core::changeid::from_message(test_repo.get_commit(steps_back).message().unwrap())
}

#[test]
fn split_keeps_the_change_id_on_the_second_commit_and_mints_one_for_the_first() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "a"), ("file_b.txt", "b")],
        &format!("Two files commit\n\nChange-Id: {CHANGE_ID}\n"),
    );

    super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "First part".to_string(),
    )
    .unwrap();

    assert_eq!(change_id_at(&test_repo, 0).as_deref(), Some(CHANGE_ID));
    let first = change_id_at(&test_repo, 1).expect("first half gets a fresh id");
    assert_ne!(first, CHANGE_ID);
    assert_eq!(
        test_repo.get_message(0).matches("Change-Id:").count(),
        1,
        "the original trailer is not duplicated"
    );
}

#[test]
fn split_mints_change_ids_for_both_halves_of_a_plain_commit() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "a"), ("file_b.txt", "b")],
        "Two files commit",
    );

    super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "First part".to_string(),
    )
    .unwrap();

    let second = change_id_at(&test_repo, 0).expect("second half");
    let first = change_id_at(&test_repo, 1).expect("first half");
    assert_ne!(first, second);
    assert!(
        test_repo
            .get_message(0)
            .starts_with("Two files commit\n\nChange-Id: I")
    );
}

/// Split with `-m` equal to the id-less original's own text: both fresh ids
/// come from the same ident, HEAD, and message, and must still differ.
#[test]
fn split_gives_distinct_ids_when_both_halves_share_the_message() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "a"), ("file_b.txt", "b")],
        "Two files commit",
    );

    super::split_commit_with_selection(
        &test_repo.repo,
        &target_oid.to_string(),
        vec!["file_a.txt".to_string()],
        "Two files commit".to_string(),
    )
    .unwrap();

    let second = change_id_at(&test_repo, 0).expect("second half");
    let first = change_id_at(&test_repo, 1).expect("first half");
    assert_ne!(first, second);
}

#[test]
fn split_with_editor_stamps_the_first_half_and_keeps_the_second() {
    let test_repo = TestRepo::new();
    test_repo.commit("Add files", "file1.txt");
    let target_oid = test_repo.commit_multi(
        &[("file_a.txt", "a"), ("file_b.txt", "b")],
        &format!("Two files commit\n\nChange-Id: {CHANGE_ID}\n"),
    );
    test_repo.set_fake_editor("First part by editor");

    super::split_commit(
        &test_repo.repo,
        &target_oid.to_string(),
        None,
        None,
        vec!["file_a.txt".to_string()],
        &crate::core::graph::Theme::dark(),
    )
    .unwrap();

    assert!(
        test_repo
            .get_message(1)
            .starts_with("First part by editor\n\nChange-Id: I")
    );
    assert_eq!(change_id_at(&test_repo, 0).as_deref(), Some(CHANGE_ID));
}

// ── Replay hint ───────────────────────────────────────────────────────

fn hint(message: Option<&str>, patch: bool, hunks: HunkArgs, files: &[&str]) -> String {
    let files: Vec<String> = files.iter().map(|f| f.to_string()).collect();
    super::invocation("ab", message, patch, &hunks, &files)
}

#[test]
fn hint_keeps_the_message_it_was_given() {
    assert_eq!(
        hint(Some("fix the thing"), false, HunkArgs::default(), &[]),
        "loom split ab -m 'fix the thing'"
    );
}

/// The placeholder belongs only to the prompt asking for a message.
#[test]
fn hint_without_a_message_asks_for_one() {
    assert_eq!(
        hint(None, true, HunkArgs::default(), &[]),
        "loom split ab -m <message> -p"
    );
}

#[test]
fn hint_quotes_a_path_with_a_space() {
    assert_eq!(
        hint(Some("m"), true, HunkArgs::default(), &["with space.txt"]),
        "loom split ab -m m -p 'with space.txt'"
    );
}

/// Every argument the agent is told to re-run has to survive a shell,
/// `--hunks-from` included.
#[test]
fn hint_quotes_every_selection_argument() {
    let hunks = HunkArgs::new(
        vec!["a,b.txt:1".to_string(), "plain.txt:2".to_string()],
        Some("; echo pwned".to_string()),
    );
    assert_eq!(
        hint(Some("m"), true, hunks, &[]),
        "loom split ab -m m -p --hunks 'a,b.txt:1' --hunks 'plain.txt:2' --hunks-from '; echo pwned'"
    );
}

#[test]
fn hint_omits_the_selection_when_none_was_given() {
    let hunks = HunkArgs::new(vec![], Some("abc123".to_string()));
    assert_eq!(hint(Some("m"), true, hunks, &[]), "loom split ab -m m -p");
}