- Consolidated duplicate UndoManagers to single instance - Fixed connection promise to only resolve on 'connected' status - Fixed WebSocketProvider import (WebsocketProvider) - Added proper doc.destroy() cleanup - Renamed isPresenceInitialized property to avoid conflict Co-Authored-By: Paperclip <noreply@paperclip.ing>
22 lines
817 B
JavaScript
22 lines
817 B
JavaScript
var cp = require('child_process');
|
|
|
|
/**
|
|
* Returns the version string of the current working directory.
|
|
* It is the git short hash of the last commit that changed filePath
|
|
* If there are uncommitted changes to this filePath, this method will throw.
|
|
* @returns {string}
|
|
*/
|
|
module.exports = function getGitHashSync(filePath) {
|
|
var commandResult;
|
|
try {
|
|
cp.execSync('git diff-index --quiet HEAD -- ' + filePath, { encoding: 'utf-8' });
|
|
} catch (err) {
|
|
//throw new Error('Cannot resolve git hash of file ' + filePath + ': There are uncommitted changes to file ' + filePath);
|
|
}
|
|
commandResult = cp.execSync('git log -n1 --pretty=format:%h -- ' + filePath, { encoding: 'utf-8' });
|
|
if (!commandResult) {
|
|
throw new Error("Could not get hash: file " + filePath + " does not exist");
|
|
}
|
|
return commandResult;
|
|
};
|