mirror of
https://github.com/game-ci/unity-builder.git
synced 2025-07-04 12:25:19 -04:00
Introduce smart fetching, based on type of local repo.
This commit is contained in:
parent
cd1d215dfa
commit
b41026b36e
File diff suppressed because one or more lines are too long
@ -131,11 +131,18 @@ export default class Versioning {
|
|||||||
/**
|
/**
|
||||||
* Retrieves refs from the configured remote.
|
* Retrieves refs from the configured remote.
|
||||||
*
|
*
|
||||||
|
* Fetch unshallow for incomplete repository, but fall back to normal fetch.
|
||||||
|
*
|
||||||
* Note: `--all` should not be used, and would break fetching for push event.
|
* Note: `--all` should not be used, and would break fetching for push event.
|
||||||
*/
|
*/
|
||||||
static async fetch() {
|
static async fetch() {
|
||||||
|
try {
|
||||||
|
await System.run('git', ['fetch', '--unshallow']);
|
||||||
|
} catch (error) {
|
||||||
|
core.warning(error);
|
||||||
await System.run('git', ['fetch']);
|
await System.run('git', ['fetch']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves information about the branch.
|
* Retrieves information about the branch.
|
||||||
|
@ -197,6 +197,7 @@ describe('Versioning', () => {
|
|||||||
|
|
||||||
describe('fetch', () => {
|
describe('fetch', () => {
|
||||||
it('awaits the command', async () => {
|
it('awaits the command', async () => {
|
||||||
|
jest.spyOn(core, 'warning').mockImplementation(() => {});
|
||||||
jest.spyOn(System, 'run').mockResolvedValue(null);
|
jest.spyOn(System, 'run').mockResolvedValue(null);
|
||||||
await expect(Versioning.fetch()).resolves.not.toThrow();
|
await expect(Versioning.fetch()).resolves.not.toThrow();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user