Created
September 27, 2011 15:30
-
-
Save gimmi/1245381 to your computer and use it in GitHub Desktop.
JSMake Git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jsmake.git = {}; | |
jsmake.git.GitUtils = { | |
getLastCommitInfo: function (gitRepoPath) { | |
var git = new org.eclipse.jgit.api.Git(new org.eclipse.jgit.storage.file.FileRepository(jsmake.Fs.combinePaths(gitRepoPath, '.git'))); | |
var commit = git.log().call().iterator().next(); | |
return { | |
message: commit.getFullMessage(), | |
sha1: commit.getName(), | |
date: new Date(1000 * commit.getCommitTime()) | |
}; | |
}, | |
hasUncommittedChanges: function (gitRepoPath) { | |
var git = new org.eclipse.jgit.api.Git(new org.eclipse.jgit.storage.file.FileRepository(jsmake.Fs.combinePaths(gitRepoPath, '.git'))); | |
var status = git.status().call(); | |
return !status.getChanged().isEmpty() | |
|| !status.getMissing().isEmpty() | |
|| !status.getAdded().isEmpty() | |
|| !status.getModified().isEmpty() | |
|| !status.getRemoved().isEmpty() | |
|| !status.getUntracked().isEmpty(); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment