Fix a few bugs

This commit is contained in:
Mattias Granlund 2024-05-23 03:13:29 +01:00
parent 12284f33ca
commit af4833f091
5 changed files with 5 additions and 9 deletions

View File

@ -36,7 +36,7 @@
remoteCommit={!hasShadowColumn ? remoteCommit : undefined} remoteCommit={!hasShadowColumn ? remoteCommit : undefined}
upstreamLine={upstreamLine && !hasShadowColumn} upstreamLine={upstreamLine && !hasShadowColumn}
{first} {first}
short={(!!localCommit && !localCommit?.children?.[0]?.relatedTo && !upstreamLine) || short={(!!localCommit && !localCommit?.children?.[0] && !upstreamLine) ||
(!!remoteCommit && !remoteCommit?.children?.[0])} (!!remoteCommit && !remoteCommit?.children?.[0])}
{base} {base}
/> />

View File

@ -14,16 +14,11 @@
const upstreamCommits = getUpstreamCommits(); const upstreamCommits = getUpstreamCommits();
const baseBranch = getContextStore(BaseBranch); const baseBranch = getContextStore(BaseBranch);
$: hasShadowColumn = $localCommits.some((c) => !c.relatedTo || c.id != c.relatedTo.id); $: hasShadowColumn = $localCommits.some((c) => c.relatedTo && c.id != c.relatedTo.id);
$: hasLocalColumn = $localCommits.length > 0; $: hasLocalColumn = $localCommits.length > 0;
$: hasCommits = $branch.commits && $branch.commits.length > 0; $: hasCommits = $branch.commits && $branch.commits.length > 0;
$: headCommit = $branch.commits.at(0); $: headCommit = $branch.commits.at(0);
$: unknownCommits = $upstreamCommits.filter((c) => !c.relatedTo || c.id != c.relatedTo.id); $: unknownCommits = $upstreamCommits.filter((c) => !c.relatedTo || c.id != c.relatedTo.id);
$: $upstreamCommits.forEach((c) => console.log(`${c.id}, ${c.relatedTo?.id}`));
$: console.log(unknownCommits);
$: console.log($upstreamCommits);
$: hasUnknownCommits = unknownCommits.length > 0; $: hasUnknownCommits = unknownCommits.length > 0;
</script> </script>

View File

@ -173,7 +173,7 @@ export class Commit {
} }
get status(): CommitStatus { get status(): CommitStatus {
if (this.isRemote && !this.relatedTo) return 'remote'; if (this.isRemote && (!this.relatedTo || this.id == this.relatedTo.id)) return 'remote';
return 'local'; return 'local';
} }

View File

@ -159,7 +159,7 @@ function linkAsParentChildren(commits: Commit[] | RemoteCommit[]) {
if (j == 0) { if (j == 0) {
commit.children = []; commit.children = [];
} else { } else {
const commit = commits[j - 1]; const commit = commits[j];
if (commit instanceof Commit) commit.children = [commit]; if (commit instanceof Commit) commit.children = [commit];
if (commit instanceof RemoteCommit) commit.children = [commit]; if (commit instanceof RemoteCommit) commit.children = [commit];
} }

View File

@ -1,6 +1,7 @@
use super::{Oid, Result, Signature, Tree}; use super::{Oid, Result, Signature, Tree};
use bstr::BStr; use bstr::BStr;
#[derive(Debug)]
pub struct Commit<'repo> { pub struct Commit<'repo> {
commit: git2::Commit<'repo>, commit: git2::Commit<'repo>,
} }