Skip to content

Commit 4fbb533

Browse files
author
SPRINX0\prochazka
committed
ingore sync commit test
1 parent c8aa98d commit 4fbb533

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

src/diflow.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,22 @@ describe('Git Repository Tests', () => {
173173
// Verify changes
174174
expect(mergedExists).toBe(false);
175175
});
176+
177+
test('Ignore sync commits', async () => {
178+
await createTestCommit(getTestRepoPath('diff'), 'newfile.txt', 'new content', 'diff', 'SYNC: ingore this commit');
179+
180+
await beforeDiflow();
181+
182+
const processor = new Processor(getTestRepoPath('config'), path.join(__dirname, 'workrepos'), 'master');
183+
await processor.process();
184+
185+
await afterDiflow();
186+
187+
const mergedExists = await fs.exists(path.join(getTestRepoPath('merged'), 'newfile.txt'));
188+
189+
await checkStateInConfig();
190+
191+
// Verify changes
192+
expect(mergedExists).toBe(false);
193+
});
176194
});

src/testrepo.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,21 @@ export async function initTestRepo(name: string) {
2020
await execAsync('git config user.name "Test User"', { cwd: repoPath });
2121
}
2222

23-
export async function createTestCommit(repoPath: string, fileName: string, content: string, repoid: string) {
23+
export async function createTestCommit(
24+
repoPath: string,
25+
fileName: string,
26+
content: string,
27+
repoid: string,
28+
message?: string
29+
) {
2430
console.log('Creating commit:', repoPath, 'file:', fileName, 'content:', content);
2531
await fs.writeFile(path.join(repoPath, fileName), content);
2632
await execAsync('git add .', { cwd: repoPath });
27-
await execAsync(`git commit -m "Commit into ${repoid}"`, { cwd: repoPath });
33+
if (message) {
34+
await execAsync(`git commit -m "${message}"`, { cwd: repoPath });
35+
} else {
36+
await execAsync(`git commit -m "Commit into ${repoid}"`, { cwd: repoPath });
37+
}
2838

2939
const { stdout: commitHash } = await execAsync('git rev-parse HEAD', { cwd: repoPath });
3040
return commitHash.trim();

0 commit comments

Comments
 (0)