Skip to content

Commit 6766090

Browse files
authored
Merge pull request #8905 from Byron/head-info
ref-info: normal workflow
2 parents ca0bc58 + 7645124 commit 6766090

File tree

4 files changed

+109
-3
lines changed

4 files changed

+109
-3
lines changed

crates/but-workspace/src/ref_info.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -942,7 +942,6 @@ pub(crate) mod function {
942942
})
943943
.collect();
944944

945-
// TODO: get `hide()` for `gix`.
946945
for (segment_index, remote_ref_tip_and_base) in segments_with_remote_ref_tips_and_base {
947946
boundary.clear();
948947
boundary.extend(stack.base);

crates/but-workspace/tests/fixtures/scenario/with-remotes-and-workspace.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,3 +383,26 @@ git init multiple-dependent-branches-per-stack-without-commit
383383

384384
create_workspace_commit_once lane lane-2
385385
)
386+
387+
git init two-dependent-branches-with-interesting-remote-setup
388+
(cd two-dependent-branches-with-interesting-remote-setup
389+
git commit -m "init" --allow-empty
390+
setup_target_to_match_main
391+
392+
git checkout -b integrated
393+
git commit -m "integrated in target" --allow-empty
394+
git commit -m "other integrated" --allow-empty
395+
396+
git checkout -b soon-A-remote
397+
git commit -m "shared by name" --allow-empty
398+
setup_remote_tracking soon-A-remote A "move"
399+
400+
git checkout -b soon-main-remote integrated
401+
git commit -m "another unrelated" --allow-empty
402+
403+
git checkout -b A
404+
git commit -m "shared by name" --allow-empty
405+
406+
setup_remote_tracking soon-main-remote main "move"
407+
create_workspace_commit_once A
408+
)

crates/but-workspace/tests/workspace/ref_info/with_workspace_commit/mod.rs

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1474,6 +1474,92 @@ fn two_branches_stracked_with_remotes() -> anyhow::Result<()> {
14741474
Ok(())
14751475
}
14761476

1477+
#[test]
1478+
fn two_branches_stacked_with_interesting_remote_setup() -> anyhow::Result<()> {
1479+
let (repo, mut meta) =
1480+
read_only_in_memory_scenario("two-dependent-branches-with-interesting-remote-setup")?;
1481+
insta::assert_snapshot!(visualize_commit_graph_all(&repo)?, @r"
1482+
* a221221 (HEAD -> gitbutler/workspace) GitButler Workspace Commit
1483+
* aadad9d (A) shared by name
1484+
* 96a2408 (origin/main) another unrelated
1485+
| * 2b1808c (origin/A) shared by name
1486+
|/
1487+
* f15ca75 (integrated) other integrated
1488+
* 9456d79 integrated in target
1489+
* fafd9d0 (main) init
1490+
");
1491+
1492+
// Just a single explicit reference we want to know of.
1493+
add_stack(
1494+
&mut meta,
1495+
StackId::from_number_for_testing(1),
1496+
"A",
1497+
StackState::InWorkspace,
1498+
);
1499+
1500+
let opts = standard_options();
1501+
let info = ref_info(repo.find_reference("A")?, &*meta, opts).unwrap();
1502+
1503+
// TODO: A should just have 1 commit, remote should only have one commit.
1504+
// 'integrated' shouldn't be listed.
1505+
insta::assert_debug_snapshot!(info, @r#"
1506+
RefInfo {
1507+
workspace_ref_name: Some(
1508+
FullName(
1509+
"refs/heads/gitbutler/workspace",
1510+
),
1511+
),
1512+
stacks: [
1513+
Stack {
1514+
base: Some(
1515+
Sha1(fafd9d08a839d99db60b222cd58e2e0bfaf1f7b2),
1516+
),
1517+
segments: [
1518+
StackSegment {
1519+
ref_name: "refs/heads/A",
1520+
remote_tracking_ref_name: "refs/remotes/origin/A",
1521+
ref_location: "ReachableFromWorkspaceCommit",
1522+
commits_unique_from_tip: [
1523+
LocalCommit(aadad9d, "shared by name\n", local/remote(similarity)),
1524+
LocalCommit(96a2408, "another unrelated\n", local),
1525+
],
1526+
commits_unique_in_remote_tracking_branch: [
1527+
RemoteCommit(f15ca75, "other integrated\n",
1528+
RemoteCommit(9456d79, "integrated in target\n",
1529+
],
1530+
metadata: Some(
1531+
Branch {
1532+
ref_info: RefInfo { created_at: None, updated_at: "1970-01-01 00:00:00 +0000" },
1533+
description: None,
1534+
review: Review { pull_request: None, review_id: None },
1535+
},
1536+
),
1537+
},
1538+
StackSegment {
1539+
ref_name: "refs/heads/integrated",
1540+
remote_tracking_ref_name: "None",
1541+
ref_location: "ReachableFromWorkspaceCommit",
1542+
commits_unique_from_tip: [
1543+
LocalCommit(f15ca75, "other integrated\n", integrated),
1544+
LocalCommit(9456d79, "integrated in target\n", integrated),
1545+
],
1546+
commits_unique_in_remote_tracking_branch: [],
1547+
metadata: None,
1548+
},
1549+
],
1550+
stash_status: None,
1551+
},
1552+
],
1553+
target_ref: Some(
1554+
FullName(
1555+
"refs/remotes/origin/main",
1556+
),
1557+
),
1558+
}
1559+
"#);
1560+
Ok(())
1561+
}
1562+
14771563
#[test]
14781564
fn single_commit_but_two_branches_stack_on_top_of_ws_commit() -> anyhow::Result<()> {
14791565
let (repo, mut meta) =

crates/gitbutler-branch-actions/src/upstream_integration.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +890,6 @@ fn forced_integrated(
890890
});
891891

892892
if let Some(commit_ref) = &commit_ref {
893-
dbg!(commit_ref);
894-
dbg!(&ref_name);
895893
&commit_ref.to_string() == ref_name
896894
} else {
897895
false

0 commit comments

Comments
 (0)