@@ -249,7 +249,8 @@ fn run(matches: &ArgMatches) -> Result<()> {
249
249
Err ( anyhow ! ( "{target_branchname} is already the current branch" ) )
250
250
} else {
251
251
if !matches. contains_id ( "merge" ) {
252
- repo. check_worktree_clean ( ) ?;
252
+ let statuses = repo. stupid ( ) . statuses ( None ) ?;
253
+ statuses. check_worktree_clean ( ) ?;
253
254
}
254
255
let target_branch = repo. get_branch ( Some ( target_branchname) ) ?;
255
256
switch_to ( matches, & repo, & target_branch)
@@ -426,10 +427,12 @@ fn create(repo: git2::Repository, matches: &ArgMatches) -> Result<()> {
426
427
let new_branchname = get_one_str ( matches, "new-branch" ) . expect ( "required argument" ) ;
427
428
428
429
repo. check_repository_state ( ) ?;
429
- repo. check_conflicts ( ) ?;
430
+ let stupid = repo. stupid ( ) ;
431
+ let statuses = stupid. statuses ( None ) ?;
432
+ statuses. check_conflicts ( ) ?;
430
433
431
434
let parent_branch = if let Some ( committish) = get_one_str ( matches, "committish" ) {
432
- repo . check_worktree_clean ( ) ?;
435
+ statuses . check_worktree_clean ( ) ?;
433
436
let mut parent_branch = None ;
434
437
if let Ok ( local_parent_branch) = repo. find_branch ( committish, git2:: BranchType :: Local ) {
435
438
parent_branch = Some ( local_parent_branch) ;
@@ -523,9 +526,11 @@ fn clone(repo: git2::Repository, matches: &ArgMatches) -> Result<()> {
523
526
format ! ( "{current_branchname}-{suffix}" )
524
527
} ;
525
528
526
- repo. check_worktree_clean ( ) ?;
529
+ let stupid = repo. stupid ( ) ;
530
+ let statuses = stupid. statuses ( None ) ?;
531
+ statuses. check_worktree_clean ( ) ?;
527
532
repo. check_repository_state ( ) ?;
528
- repo . check_conflicts ( ) ?;
533
+ statuses . check_conflicts ( ) ?;
529
534
530
535
if let Ok ( stack) = Stack :: from_branch ( & repo, None ) {
531
536
stack. check_head_top_mismatch ( ) ?;
@@ -539,9 +544,9 @@ fn clone(repo: git2::Repository, matches: &ArgMatches) -> Result<()> {
539
544
false ,
540
545
& format ! ( "clone from {current_branchname}" ) ,
541
546
) ?;
542
- repo . stupid ( ) . branch_copy ( None , & new_branchname) ?;
547
+ stupid. branch_copy ( None , & new_branchname) ?;
543
548
} else {
544
- repo . stupid ( ) . branch_copy ( None , & new_branchname) ?;
549
+ stupid. branch_copy ( None , & new_branchname) ?;
545
550
Stack :: initialize ( & repo, Some ( & new_branchname) ) ?;
546
551
} ;
547
552
0 commit comments