Skip to content

Commit

Permalink
fix: log remote in git fetch errors
Browse files Browse the repository at this point in the history
If git fetch fails we should clarify which remote was used to fetch
from.
  • Loading branch information
korthout committed May 3, 2024
1 parent 02d15db commit 79396b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export class Git {
);
if (exitCode === 128) {
throw new GitRefNotFoundError(
`Expected to fetch '${ref}', but couldn't find it`,
`Expected to fetch '${ref}' from '${remote}', but couldn't find it`,
ref,
);
} else if (exitCode !== 0) {
throw new Error(
`'git fetch origin ${ref}' failed with exit code ${exitCode}`,
`'git fetch ${remote} ${ref}' failed with exit code ${exitCode}`,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/git.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("git.fetch", () => {
expect(error).toBeInstanceOf(GitRefNotFoundError);
expect(error).toHaveProperty(
"message",
"Expected to fetch 'unknown', but couldn't find it",
"Expected to fetch 'unknown' from 'origin', but couldn't find it",
);
expect(error).toHaveProperty("ref", "unknown");
});
Expand Down

0 comments on commit 79396b7

Please sign in to comment.