Skip to content

Commit

Permalink
Fix trying to check for updates if origin doesn't have same branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuckyz committed Mar 7, 2024
1 parent f701142 commit 1979976
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/updater/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ async function getRepo() {
async function calculateGitChanges() {
await git("fetch");

const branch = await git("branch", "--show-current");
const branch = (await git("branch", "--show-current")).stdout.trim();

const res = await git("log", `HEAD...origin/${branch.stdout.trim()}`, "--pretty=format:%an/%h/%s");
const existsOnOrigin = (await git("ls-remote", "origin", branch)).stdout.length > 0;
if (!existsOnOrigin) return [];

const res = await git("log", `HEAD...origin/${branch}`, "--pretty=format:%an/%h/%s");

const commits = res.stdout.trim();
return commits ? commits.split("\n").map(line => {
Expand Down

0 comments on commit 1979976

Please sign in to comment.