mirror of
https://github.com/atom/atom.git
synced 2026-02-02 10:45:14 -05:00
Added .getReferenceTarget
This commit is contained in:
@@ -485,4 +485,17 @@ describe('GitRepositoryAsync', () => {
|
||||
expect(tags.length).toBe(0)
|
||||
})
|
||||
})
|
||||
|
||||
describe('.getReferenceTarget(reference, path)', () => {
|
||||
let workingDirectory
|
||||
beforeEach(() => {
|
||||
workingDirectory = copyRepository()
|
||||
repo = GitRepositoryAsync.open(workingDirectory)
|
||||
})
|
||||
|
||||
it('returns the SHA target', async () => {
|
||||
const SHA = await repo.getReferenceTarget('refs/heads/master')
|
||||
expect(SHA).toBe('8a9c86f1cb1f14b8f436eb91f4b052c8802ca99e')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -288,13 +288,18 @@ export default class GitRepositoryAsync {
|
||||
})
|
||||
}
|
||||
|
||||
// Public: Returns the current {String} SHA for the given reference.
|
||||
// Public: Get the SHA for the given reference.
|
||||
//
|
||||
// * `reference` The {String} reference to get the target of.
|
||||
// * `path` An optional {String} path in the repo to get the reference target
|
||||
// for. Only needed if the repository contains submodules.
|
||||
//
|
||||
// Returns a {Promise} which resolves to the current {String} SHA for the
|
||||
// given reference.
|
||||
getReferenceTarget (reference, _path) {
|
||||
throw new Error('Unimplemented')
|
||||
return this._getRepo(_path)
|
||||
.then(repo => repo.getReference(reference))
|
||||
.then(ref => ref.target().tostrS())
|
||||
}
|
||||
|
||||
// Reading Status
|
||||
|
||||
Reference in New Issue
Block a user