Skip to content

Commit

Permalink
Insert import
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyagr committed Apr 29, 2023
1 parent 5c948ec commit 79466c6
Showing 1 changed file with 53 additions and 17 deletions.
70 changes: 53 additions & 17 deletions tests/test_git_colocated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,35 +264,43 @@ fn test_git_colocated_fetch_deleted_branch() {
"###);

test_env.jj_cmd_success(&origin_path, &["branch", "delete", "B"]);
let stdout = test_env.jj_cmd_success(&clone_path, &["git", "export"]);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&clone_path, &["git", "import"]);
insta::assert_snapshot!(stdout, @r###"
Nothing changed.
"###);
let stdout = test_env.jj_cmd_success(&clone_path, &["debug", "operation"]);
// There's no meaningful change in this view, as suggested by the "Nothing
// changed" reported by `jj git import` above.
insta::assert_snapshot!(stdout, @r###"
Operation {
view_id: ViewId(
"7d9422bdff03fcf979b88d1c9f9b4db60a76430c9c4eade17fd52143084e27b4ea8fa0fa93c09fba776b9ab78d59edc3a7c3f19f3af2373edc280f3a3c9a1a11",
"110a7aaed4c4079dc5390dc93bf1c24862f30d3537be13cf0fc9ffcb3ce9c503f7f2de3327d8a81676f323180ed52b712aae62abd22146533bb122f005efa540",
),
parents: [
OperationId(
"5450d70f57438061eccfefb3346fcca05fe5531d5f4f9272835bbe3d352ff0a8636e82ab5a06b784af321e7d948d85fae4a5ec80015c2e2c25ce272769a1f05d",
"4e23cd7df682f0d6bccafb15ac1423793047a31eef181bf4f1d0e6251659bb604f429a1abc1ec1a7f59699882fc821d3534537fbfc84baac376d12c5f0657a7d",
),
],
metadata: OperationMetadata {
start_time: Timestamp {
timestamp: MillisSinceEpoch(
981147913000,
981147916000,
),
tz_offset: 420,
},
end_time: Timestamp {
timestamp: MillisSinceEpoch(
981147913000,
981147916000,
),
tz_offset: 420,
},
description: "check out git remote's default branch",
description: "export git refs",
hostname: "host.example.com",
username: "test-username",
tags: {
"args": "jj git clone $TEST_ENV/origin $TEST_ENV/clone",
"args": "jj git export",
},
},
}
Expand Down Expand Up @@ -359,6 +367,21 @@ fn test_git_colocated_fetch_deleted_branch() {
},
tags: {},
git_refs: {
"refs/heads/A": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
),
),
"refs/heads/B": Normal(
CommitId(
"e1f4268fabd2c84e880c5eb5bd87e076180fc8e3",
),
),
"refs/heads/master": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
),
),
"refs/remotes/origin/A": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
Expand Down Expand Up @@ -386,31 +409,28 @@ fn test_git_colocated_fetch_deleted_branch() {
}
"###);
let stdout = test_env.jj_cmd_success(&clone_path, &["git", "fetch"]);
insta::assert_snapshot!(stdout, @r###"
Rebased 1 descendant commits
Working copy now at: aeb3580e4ddb (no description set)
"###);
insta::assert_snapshot!(stdout, @"");
let stdout = test_env.jj_cmd_success(&clone_path, &["debug", "operation"]);
insta::assert_snapshot!(stdout, @r###"
Operation {
view_id: ViewId(
"3a6f7a8dca645d0bf816cc02a36eca2f313b4e1611067dbeb88e6c89dd9b1a0eace851f008123d6aea553e5821a45b27fc134176bd101ff34908901cd4cba33c",
"122ca5357ef04d307266b1c830a123f73fdda5aeab4a56d93c68fda1184aff5ba62bf166c4bf5b311ef41b5ca1eede8e380625a9f531fd50ce128add11db5c99",
),
parents: [
OperationId(
"64cb9d92221dc24aed256013113bd1eb9603195530c464945a003c24cc7ff96a55589a5dded011e4a38d7acb98cc7866751457311dcc3c4dec8d1c8c19495064",
"0fd99943b89ee103f3b08940955007d47627cce9baa15edaf02bcf63c7db8689ff4894e862b97a583b755c6ad7c4190acf9e375a7b988a982eac5c629515d3b3",
),
],
metadata: OperationMetadata {
start_time: Timestamp {
timestamp: MillisSinceEpoch(
981147917000,
981147919000,
),
tz_offset: 420,
},
end_time: Timestamp {
timestamp: MillisSinceEpoch(
981147917000,
981147919000,
),
tz_offset: 420,
},
Expand All @@ -425,7 +445,7 @@ fn test_git_colocated_fetch_deleted_branch() {
View {
head_ids: {
CommitId(
"aeb3580e4ddb26a48d4b6e0b4cba5905b6103f82",
"bc7d08e8de9b7bc248b9358a05e96f1671bbd4d9",
),
},
public_head_ids: {
Expand Down Expand Up @@ -469,6 +489,21 @@ fn test_git_colocated_fetch_deleted_branch() {
},
tags: {},
git_refs: {
"refs/heads/A": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
),
),
"refs/heads/B": Normal(
CommitId(
"e1f4268fabd2c84e880c5eb5bd87e076180fc8e3",
),
),
"refs/heads/master": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
),
),
"refs/remotes/origin/A": Normal(
CommitId(
"a86754f975f953fa25da4265764adc0c62e9ce6b",
Expand All @@ -485,14 +520,15 @@ fn test_git_colocated_fetch_deleted_branch() {
WorkspaceId(
"default",
): CommitId(
"aeb3580e4ddb26a48d4b6e0b4cba5905b6103f82",
"bc7d08e8de9b7bc248b9358a05e96f1671bbd4d9",
),
},
}
"###);
// TODO: e1f4 should have been abandoned (#864)
insta::assert_snapshot!(get_log_output(&test_env, &clone_path), @r###"
@ aeb3580e4ddb26a48d4b6e0b4cba5905b6103f82
@ bc7d08e8de9b7bc248b9358a05e96f1671bbd4d9
◉ e1f4268fabd2c84e880c5eb5bd87e076180fc8e3
◉ a86754f975f953fa25da4265764adc0c62e9ce6b A master
◉ 0000000000000000000000000000000000000000
"###);
Expand Down

0 comments on commit 79466c6

Please sign in to comment.