fix(GitRepo): add diff function

This commit is contained in:
2024-06-22 02:44:19 +02:00
parent a2485560b3
commit e8c3d3c44f
6 changed files with 5100 additions and 3735 deletions

View File

@ -2,12 +2,12 @@ import { tap, expect } from '@push.rocks/tapbundle';
import * as smartgit from '../ts/index.js';
import * as smartpath from '@push.rocks/smartpath';
const __dirname = smartpath.get.dirnameFromImportMetaUrl(import.meta.url);
import * as path from 'path';
let testSmartgitInstance: smartgit.Smartgit;
const testRepoDir = path.join(__dirname, '../.nogit/testrepo');
const testRepoDirSmartfile = path.join(__dirname, '../.nogit/pushrocks_smartfile');
const packageDir = path.join(smartpath.get.dirnameFromImportMetaUrl(import.meta.url), '../');
const testRepoDir = path.join(packageDir, './.nogit/testrepo');
const testRepoDirSmartfile = path.join(packageDir, './.nogit/pushrocks_smartfile');
tap.test('should create a valid smartgit instance', async () => {
testSmartgitInstance = new smartgit.Smartgit();
@ -26,4 +26,12 @@ tap.test('should clone a repo', async () => {
);
});
tap.test('should open a repo', async () => {
const gitRepo = await testSmartgitInstance.createRepoByOpen(packageDir);
const diff = await gitRepo.getUncommittedDiff([
'pnpm-lock.yaml',
]);
console.log(diff);
});
await tap.start();