Skip to content

Commit 167aaa1

Browse files
committed
feat(submit): create SubmitStatus::Local
1 parent f10d5b3 commit 167aaa1

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

git-branchless-submit/src/branch_forge.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl Forge for BranchForge<'_> {
142142

143143
let commit_status = match branch_infos.as_slice() {
144144
[] => CommitStatus {
145-
submit_status: SubmitStatus::Unsubmitted,
145+
submit_status: SubmitStatus::Local,
146146
remote_name: None,
147147
local_branch_name: None,
148148
remote_branch_name: None,

git-branchless-submit/src/lib.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ lazy_static! {
5353
/// The status of a commit, indicating whether it needs to be updated remotely.
5454
#[derive(Clone, Debug)]
5555
pub enum SubmitStatus {
56-
/// The commit exists locally but has not been pushed remotely.
56+
/// The commit exists locally and there is no intention to push it to the
57+
/// remote.
58+
Local,
59+
60+
/// The commit exists locally and will eventually be pushed to the remote,
61+
/// but it has not been pushed yet.
5762
Unsubmitted,
5863

5964
/// It could not be determined whether the remote commit exists.
@@ -273,14 +278,25 @@ fn submit(
273278
let statuses = try_exit_code!(forge.query_status(commit_set)?);
274279
debug!(?statuses, "Commit statuses");
275280

276-
let (unsubmitted_commits, commits_to_update, commits_to_skip): (
281+
#[allow(clippy::type_complexity)]
282+
let (_local_commits, unsubmitted_commits, commits_to_update, commits_to_skip): (
283+
HashMap<NonZeroOid, CommitStatus>,
277284
HashMap<NonZeroOid, CommitStatus>,
278285
HashMap<NonZeroOid, CommitStatus>,
279286
HashMap<NonZeroOid, CommitStatus>,
280287
) = statuses.into_iter().fold(Default::default(), |acc, elem| {
281-
let (mut unsubmitted, mut to_update, mut to_skip) = acc;
288+
let (mut local, mut unsubmitted, mut to_update, mut to_skip) = acc;
282289
let (commit_oid, commit_status) = elem;
283290
match commit_status {
291+
CommitStatus {
292+
submit_status: SubmitStatus::Local,
293+
remote_name: _,
294+
local_branch_name: _,
295+
remote_branch_name: _,
296+
} => {
297+
local.insert(commit_oid, commit_status);
298+
}
299+
284300
CommitStatus {
285301
submit_status: SubmitStatus::Unsubmitted,
286302
remote_name: _,
@@ -322,7 +338,7 @@ fn submit(
322338
remote_branch_name: _,
323339
} => {}
324340
}
325-
(unsubmitted, to_update, to_skip)
341+
(local, unsubmitted, to_update, to_skip)
326342
});
327343

328344
let (created_branches, uncreated_branches): (BTreeSet<String>, BTreeSet<String>) = {

0 commit comments

Comments
 (0)