1
0
mirror of https://github.com/danog/gift.git synced 2024-11-30 04:19:37 +01:00

Added current_commit function to repo

This commit is contained in:
Igor Muzyka 2014-02-19 12:38:06 +02:00
parent e37fd24033
commit d6bc3d0bdf

View File

@ -86,6 +86,27 @@ module.exports = class Repo
Commit.find_all this, start, {"max-count": limit, skip}, callback
# Internal: Returns current commit id
#
# callback - Receives `(err, id)`.
#
current_commit_id: (callback) ->
@git "rev-parse HEAD", {}, []
, (err, stdout, stderr) =>
return callback err if err
return callback null, _.first stdout.split "\n"
# Public:
#
# callback - Receives `(err, commit)`
#
current_commit: (callback) ->
@current_commit_id (err, commit_id) =>
return callback err if err
Commit.find this, commit_id, callback
# Public: The tree object for the treeish or master.
#
# treeish - String treeish (such as a branch or tag) (optional).