Skip to content

Commit 79b6796

Browse files
committed
why
1 parent 33771ea commit 79b6796

3 files changed

Lines changed: 34 additions & 1 deletion

File tree

.github/workflows/pr.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
runs-on: ${{ matrix.os }}
5252

5353
steps:
54+
- run: git --version
55+
5456
- name: Check out code
5557
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
5658

packages/beachball/src/__fixtures__/repositoryFactory.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ export class RepositoryFactory {
162162
/** Cloned child repos, tracked so we can clean them up */
163163
private childRepos: Repository[] = [];
164164

165+
public get originRoot(): string {
166+
if (!this.root) {
167+
throw new Error('Factory was already cleaned');
168+
}
169+
return this.root;
170+
}
171+
165172
/**
166173
* Create the "origin" repo and create+commit fixture files.
167174
* If `fixture` is a string, the corresponding default fixture is used.

packages/beachball/src/__functional__/git/ensureSharedHistory.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@ describe('ensureSharedHistory', () => {
230230

231231
it('deepens history if needed', () => {
232232
const repo = repositoryFactory.cloneRepository({ depth: 2, branch: testBranch, singleBranch: true });
233+
234+
expect(workspaceTools.getDefaultRemoteBranch({ cwd: repo.rootPath })).toEqual(defaultRemoteBranchName);
235+
logs.clear();
233236
gitSpy.mockClear();
234237

235238
ensureSharedHistory({
@@ -241,7 +244,28 @@ describe('ensureSharedHistory', () => {
241244
verbose: true,
242245
});
243246

244-
const allLogs = logs.getMockLines('all');
247+
const allLogs = logs.getMockLines('all', {
248+
replacePaths: { [repo.rootPath]: '<repo-root>', [repositoryFactory.originRoot]: '<origin-root>' },
249+
});
250+
expect(allLogs).toMatchInlineSnapshot(`
251+
"[log] Adding branch "master" to fetch config for remote "origin"
252+
[log] Fetching branch "master" from remote "origin" (with --depth=2)...
253+
[log] From <origin-root>
254+
* branch master -> FETCH_HEAD
255+
* [new branch] master -> origin/master
256+
[log] Fetching branch "master" from remote "origin" (with --depth=2) completed successfully
257+
[log] This is a shallow clone. Deepening to check for changes...
258+
[log] Deepening by 2 more commits (attempt 1/3)...
259+
[log] Fetching branch "master" from remote "origin" (with --deepen=2)...
260+
[log] From <origin-root>
261+
* branch master -> FETCH_HEAD
262+
[log] Fetching branch "master" from remote "origin" (with --deepen=2) completed successfully
263+
[log] Deepening by 2 more commits (attempt 2/3)...
264+
[log] Fetching branch "master" from remote "origin" (with --deepen=2)...
265+
[log] From <origin-root>
266+
* branch master -> FETCH_HEAD
267+
[log] Fetching branch "master" from remote "origin" (with --deepen=2) completed successfully"
268+
`);
245269
expect(allLogs).toMatch('Adding branch "master" to fetch config for remote "origin"');
246270
expect(allLogs).toMatch('This is a shallow clone. Deepening to check for changes...');
247271
expect(allLogs).toMatch('Deepening by 2 more commits (attempt 1/3)...');

0 commit comments

Comments
 (0)