本文整理汇总了TypeScript中dugite.GitProcess.exec方法的典型用法代码示例。如果您正苦于以下问题:TypeScript GitProcess.exec方法的具体用法?TypeScript GitProcess.exec怎么用?TypeScript GitProcess.exec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dugite.GitProcess
的用法示例。
在下文中一共展示了GitProcess.exec方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('reflects renames', async () => {
const repo = await setupEmptyRepository()
fs.writeFileSync(path.join(repo.path, 'foo'), 'foo\n')
await GitProcess.exec(['add', 'foo'], repo.path)
await GitProcess.exec(['commit', '-m', 'Initial commit'], repo.path)
await GitProcess.exec(['mv', 'foo', 'bar'], repo.path)
const status = await getStatus(repo)
const files = status.workingDirectory.files
expect(files.length).to.equal(1)
expect(files[0].status).to.equal(AppFileStatus.Renamed)
expect(files[0].oldPath).to.equal('foo')
expect(files[0].path).to.equal('bar')
})
示例2: it
it('is empty for a renamed file', async () => {
const repo = await setupEmptyRepository()
fs.writeFileSync(path.join(repo.path, 'foo'), 'foo\n')
await GitProcess.exec(['add', 'foo'], repo.path)
await GitProcess.exec(['commit', '-m', 'Initial commit'], repo.path)
await GitProcess.exec(['mv', 'foo', 'bar'], repo.path)
const status = await getStatus(repo)
const files = status.workingDirectory.files
expect(files.length).to.equal(1)
const diff = await getTextDiff(repo, files[0])
expect(diff.hunks.length).to.equal(0)
})
示例3: it
it('returns true if LFS is tracking a path', async () => {
const path = await setupFixtureRepository('test-repo')
const repository = new Repository(path, -1, null, false)
await GitProcess.exec(['lfs', 'track', '*.psd'], repository.path)
const usingLFS = await isUsingLFS(repository)
expect(usingLFS).to.equal(true)
})
示例4: it
it('respects config when updating', async () => {
const fixture = gitStore!
const path = repo!.path
// first pass - save a single entry
await fixture.saveGitIgnore('node_modules\n')
await GitProcess.exec(['add', '.gitignore'], path)
await GitProcess.exec(['commit', '-m', 'create the ignore file'], path)
// second pass - update the file with a new entry
await fixture.saveGitIgnore('node_modules\n*.exe\n')
await GitProcess.exec(['add', '.gitignore'], path)
await GitProcess.exec(['commit', '-m', 'update the file'], path)
const status = await getStatus(repo!)
const files = status.workingDirectory.files
expect(files.length).to.equal(0)
})
示例5: it
it('reflects renames', async () => {
const repo = await setupEmptyRepository()
await FSE.writeFile(path.join(repo.path, 'foo'), 'foo\n')
await GitProcess.exec(['add', 'foo'], repo.path)
await GitProcess.exec(['commit', '-m', 'Initial commit'], repo.path)
await GitProcess.exec(['mv', 'foo', 'bar'], repo.path)
const status = await getStatusOrThrow(repo)
const files = status.workingDirectory.files
expect(files).toHaveLength(1)
expect(files[0].path).toBe('bar')
expect(files[0].status).toEqual({
kind: AppFileStatusKind.Renamed,
oldPath: 'foo',
})
})
示例6: it
it('skips files that are tracked by Git LFS', async () => {
const repository = await setupEmptyRepository()
await GitProcess.exec(['lfs', 'track', '*.png'], repository.path)
const photoFile = 'some-cool-photo.png'
const notFound = await filesNotTrackedByLFS(repository, [photoFile])
expect(notFound).toHaveLength(0)
})
示例7: it
it('can commit renames with partially selected modifications', async () => {
const repo = await setupEmptyRepository()
await FSE.writeFile(path.join(repo.path, 'foo'), 'line1\n')
await GitProcess.exec(['add', 'foo'], repo.path)
await GitProcess.exec(['commit', '-m', 'Initial commit'], repo.path)
await GitProcess.exec(['mv', 'foo', 'bar'], repo.path)
await FSE.writeFile(path.join(repo.path, 'bar'), 'line1\nline2\nline3\n')
const status = await getStatusOrThrow(repo)
const files = status.workingDirectory.files
expect(files.length).toEqual(1)
expect(files[0].path).toContain('bar')
expect(files[0].status.kind).toEqual(AppFileStatusKind.Renamed)
const selection = files[0].selection
.withSelectNone()
.withLineSelection(2, true)
const partiallySelectedFile = files[0].withSelection(selection)
const sha = await createCommit(repo, 'renamed a file', [
partiallySelectedFile,
])
expect(sha).toHaveLength(7)
const statusAfter = await getStatusOrThrow(repo)
expect(statusAfter.workingDirectory.files.length).toEqual(1)
const diff = await getTextDiff(
repo,
statusAfter.workingDirectory.files[0]
)
expect(diff.hunks.length).toEqual(1)
expect(diff.hunks[0].lines.length).toEqual(4)
expect(diff.hunks[0].lines[3].text).toEqual('+line3')
})
示例8: it
it('applies rule correctly to repository', async () => {
const repo = await setupEmptyRepository()
const path = repo.path
await saveGitIgnore(repo, '*.txt\n')
await GitProcess.exec(['add', '.gitignore'], path)
await GitProcess.exec(['commit', '-m', 'create the ignore file'], path)
// Create a txt file
const file = Path.join(repo.path, 'a.txt')
await FSE.writeFile(file, 'thrvbnmerkl;,iuw')
// Check status of repo
const status = await getStatusOrThrow(repo)
const files = status.workingDirectory.files
expect(files.length).to.equal(0)
})