-
Notifications
You must be signed in to change notification settings - Fork 350
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git_backend: write trees involved in conflict in git commit header
We haven't used custom Git commit headers for two main reasons: 1. I don't want commits created by jj to be different from any other commits. I don't want Git projects to get annoyed by such commit and reject them. 2. I've been concerned that tools don't know how to handle such headers, perhaps even resulting in crashes. The first argument doesn't apply to commits with conflicts because such commits would never be accepted by a project whether or not they use custom commit headers. The second argument is less relevant for conflicted commits because most tools will be confused by such commits anyway. Storing conflict information in commit headers means that we can transfer them via the regular Git wire protocol. We already include the tree objects nested inside the root-level tree, so they will also be transferred. So, let's start by writing the information redundantly to the commit header and to the existing storage. That way we can roll it back if we realize there's a problem with using commit headers.
- Loading branch information
1 parent
cd3d75e
commit 67500b8
Showing
11 changed files
with
124 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,7 @@ fn test_rewrite_immutable_commands() { | |
insta::assert_snapshot!(stdout, @r###" | ||
@ yqosqzyt [email protected] 2001-02-03 04:05:13.000 +07:00 3f89addf | ||
│ (empty) (no description set) | ||
│ ◉ mzvwutvl [email protected] 2001-02-03 04:05:11.000 +07:00 main 16ca9d80 conflict | ||
│ ◉ mzvwutvl [email protected] 2001-02-03 04:05:11.000 +07:00 main 3d14df18 conflict | ||
╭─┤ (empty) merge | ||
│ │ | ||
│ ~ | ||
|
@@ -113,61 +113,61 @@ fn test_rewrite_immutable_commands() { | |
// abandon | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["abandon", "main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// chmod | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["chmod", "-r=main", "x", "file"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// describe | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["describe", "main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// diffedit | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["diffedit", "-r=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// edit | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["edit", "main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// move --from | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--from=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// move --to | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["move", "--to=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// new --insert-before | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "--insert-before", "main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// new --insert-after parent_of_main | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["new", "--insert-after", "description(b)"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// rebase -s | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-s=main", "-d=@"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// rebase -b | ||
|
@@ -179,43 +179,43 @@ fn test_rewrite_immutable_commands() { | |
// rebase -r | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["rebase", "-r=main", "-d=@"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// resolve | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["resolve", "-r=description(merge)", "file"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// restore -c | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "-c=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// restore --to | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["restore", "--to=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// split | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["split", "-r=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// squash | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["squash", "-r=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
// unsquash | ||
let stderr = test_env.jj_cmd_failure(&repo_path, &["unsquash", "-r=main"]); | ||
insta::assert_snapshot!(stderr, @r###" | ||
Error: Commit 16ca9d800b08 is immutable | ||
Error: Commit 3d14df18607e is immutable | ||
Hint: Configure the set of immutable commits via `revset-aliases.immutable_heads()`. | ||
"###); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ fn test_obslog_with_or_without_diff() { | |
insta::assert_snapshot!(stdout, @r###" | ||
@ rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3 | ||
│ my description | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 ebc23d4b conflict | ||
│ my description | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc | ||
│ my description | ||
|
@@ -44,11 +44,11 @@ fn test_obslog_with_or_without_diff() { | |
insta::assert_snapshot!(stdout, @r###" | ||
@ [1m[38;5;13mr[38;5;8mlvkpnrz[39m [38;5;[email protected][39m [38;5;14m2001-02-03 04:05:10.000 +07:00[39m [38;5;12m6[38;5;8m6b42ad3[39m[0m | ||
│ [1mmy description[0m | ||
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:09.000 +07:00[39m [1m[38;5;4m5[0m[38;5;8mf4634a5[39m [38;5;1mconflict[39m | ||
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:09.000 +07:00[39m [1m[38;5;4meb[0m[38;5;8mc23d4b[39m [38;5;1mconflict[39m | ||
│ my description | ||
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:09.000 +07:00[39m [1m[38;5;4m6f[0m[38;5;8mbba7bc[39m | ||
│ my description | ||
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:08.000 +07:00[39m [1m[38;5;4me[0m[38;5;8mac0d0da[39m | ||
◉ [1m[39mr[0m[38;5;8mlvkpnrz[39m hidden [38;5;[email protected][39m [38;5;6m2001-02-03 04:05:08.000 +07:00[39m [1m[38;5;4mea[0m[38;5;8mc0d0da[39m | ||
[38;5;2m(empty)[39m my description | ||
"###); | ||
|
||
|
@@ -66,7 +66,7 @@ fn test_obslog_with_or_without_diff() { | |
│ 5 : foo | ||
│ 6 : bar | ||
│ 7 : >>>>>>> | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 ebc23d4b conflict | ||
│ my description | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc | ||
│ my description | ||
|
@@ -84,7 +84,7 @@ fn test_obslog_with_or_without_diff() { | |
insta::assert_snapshot!(stdout, @r###" | ||
@ rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3 | ||
│ my description | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict | ||
◉ rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 ebc23d4b conflict | ||
│ my description | ||
"###); | ||
|
||
|
@@ -93,7 +93,7 @@ fn test_obslog_with_or_without_diff() { | |
insta::assert_snapshot!(stdout, @r###" | ||
rlvkpnrz [email protected] 2001-02-03 04:05:10.000 +07:00 66b42ad3 | ||
my description | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 ebc23d4b conflict | ||
my description | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc | ||
my description | ||
|
@@ -119,7 +119,7 @@ fn test_obslog_with_or_without_diff() { | |
-bar | ||
->>>>>>> | ||
+resolved | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 5f4634a5 conflict | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 ebc23d4b conflict | ||
my description | ||
rlvkpnrz hidden [email protected] 2001-02-03 04:05:09.000 +07:00 6fbba7bc | ||
my description | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.