Skip to content

Commit

Permalink
Merge pull request #962 from chromaui/suppress-slug-warning
Browse files Browse the repository at this point in the history
Suppress issues caused by missing Git remote
  • Loading branch information
ghengeveld committed Mar 29, 2024
2 parents 36aa29a + 27723c4 commit d00be31
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 7 additions & 2 deletions node-src/git/git.ts
Expand Up @@ -148,10 +148,15 @@ export async function getChangedFiles(baseCommit: string, headCommit = '') {

/**
* Returns a boolean indicating whether the workspace is up-to-date (neither ahead nor behind) with
* the remote.
* the remote. Returns true on error, assuming the workspace is up-to-date.
*/
export async function isUpToDate({ log }: Pick<Context, 'log'>) {
execGitCommand(`git remote update`);
try {
await execGitCommand(`git remote update`);
} catch (e) {
log.warn(e);
return true;
}

let localCommit;
try {
Expand Down
11 changes: 5 additions & 6 deletions node-src/tasks/gitInfo.ts
Expand Up @@ -83,12 +83,11 @@ export const setGitInfo = async (ctx: Context, task: Task) => {
}

if (!ctx.git.slug) {
await getSlug().then(
(slug) => {
ctx.git.slug = slug;
},
(e) => ctx.log.warn('Failed to retrieve slug', e)
);
try {
ctx.git.slug = await getSlug();
} catch (e) {
ctx.log.debug('Failed to retrieve Git repository slug', e);
}
}

if (ownerName) {
Expand Down

0 comments on commit d00be31

Please sign in to comment.