From 2e725270e4c265008caad57cb43358f73202a3a5 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 28 Nov 2022 05:50:36 -0800 Subject: [PATCH] cli: hint about how to recover from failed export of branches --- src/cli_util.rs | 7 +++++++ tests/test_git_colocated.rs | 3 +++ tests/test_git_export.rs | 3 +++ 3 files changed, 13 insertions(+) diff --git a/src/cli_util.rs b/src/cli_util.rs index 53af9ce61..fcaf1f663 100644 --- a/src/cli_util.rs +++ b/src/cli_util.rs @@ -907,6 +907,13 @@ pub fn print_failed_git_export( formatter.with_label("branch", |formatter| formatter.write_str(branch_name))?; formatter.write_str("\n")?; } + drop(formatter); + ui.write_hint( + r#"Hint: Git doesn't allow a branch name that looks like a parent directory of +another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to +export or their "parent" branches. +"#, + )?; } Ok(()) } diff --git a/tests/test_git_colocated.rs b/tests/test_git_colocated.rs index 96e81548b..514f50981 100644 --- a/tests/test_git_colocated.rs +++ b/tests/test_git_colocated.rs @@ -193,6 +193,9 @@ fn test_git_colocated_conflicting_git_refs() { insta::assert_snapshot!(get_stderr_string(&assert), @r###" Failed to export some branches: main/sub + Hint: Git doesn't allow a branch name that looks like a parent directory of + another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to + export or their "parent" branches. "###); } diff --git a/tests/test_git_export.rs b/tests/test_git_export.rs index 315960798..93d9b5e3b 100644 --- a/tests/test_git_export.rs +++ b/tests/test_git_export.rs @@ -32,5 +32,8 @@ fn test_git_export_conflicting_git_refs() { insta::assert_snapshot!(get_stderr_string(&assert), @r###" Failed to export some branches: main/sub + Hint: Git doesn't allow a branch name that looks like a parent directory of + another (e.g. `foo` and `foo/bar`). Try to rename the branches that failed to + export or their "parent" branches. "###); }