mirror of
https://github.com/atom/atom.git
synced 2026-02-02 10:45:14 -05:00
Added .getConfigValue
This commit is contained in:
@@ -472,9 +472,8 @@ describe('GitRepositoryAsync', () => {
|
||||
})
|
||||
|
||||
describe('.getReferences(path)', () => {
|
||||
let workingDirectory
|
||||
beforeEach(() => {
|
||||
workingDirectory = copyRepository()
|
||||
const workingDirectory = copyRepository()
|
||||
repo = GitRepositoryAsync.open(workingDirectory)
|
||||
})
|
||||
|
||||
@@ -487,9 +486,8 @@ describe('GitRepositoryAsync', () => {
|
||||
})
|
||||
|
||||
describe('.getReferenceTarget(reference, path)', () => {
|
||||
let workingDirectory
|
||||
beforeEach(() => {
|
||||
workingDirectory = copyRepository()
|
||||
const workingDirectory = copyRepository()
|
||||
repo = GitRepositoryAsync.open(workingDirectory)
|
||||
})
|
||||
|
||||
@@ -498,4 +496,22 @@ describe('GitRepositoryAsync', () => {
|
||||
expect(SHA).toBe('8a9c86f1cb1f14b8f436eb91f4b052c8802ca99e')
|
||||
})
|
||||
})
|
||||
|
||||
describe('.getConfigValue(key, path)', () => {
|
||||
beforeEach(() => {
|
||||
const workingDirectory = copyRepository()
|
||||
console.log(workingDirectory)
|
||||
repo = GitRepositoryAsync.open(workingDirectory)
|
||||
})
|
||||
|
||||
it('looks up the value for the key', async () => {
|
||||
const bare = await repo.getConfigValue('core.bare')
|
||||
expect(bare).toBe('false')
|
||||
})
|
||||
|
||||
it("resolves to null if there's no value", async () => {
|
||||
const value = await repo.getConfigValue('my.special.key')
|
||||
expect(value).toBe(null)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -233,8 +233,14 @@ export default class GitRepositoryAsync {
|
||||
//
|
||||
// * `path` An optional {String} path in the repository to get this information
|
||||
// for, only needed if the repository has submodules.
|
||||
//
|
||||
// Returns a {Promise} which resolves to the {String} git configuration value
|
||||
// specified by the key.
|
||||
getConfigValue (key, _path) {
|
||||
throw new Error('Unimplemented')
|
||||
return this._getRepo(_path)
|
||||
.then(repo => repo.configSnapshot())
|
||||
.then(config => config.getStringBuf(key))
|
||||
.catch(_ => null)
|
||||
}
|
||||
|
||||
// Public: Returns the origin url of the repository.
|
||||
|
||||
Reference in New Issue
Block a user