How to use the git-rev-sync.message function in git-rev-sync

To help you get started, we’ve selected a few git-rev-sync examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nodecg / nodecg / lib / bundle-parser / git.js View on Github external
module.exports = function (bundle) {
	const gitData = {};
	const workingDir = process.cwd();

	try {
		// These will error if bundle.dir is not a git repo
		gitData.branch = git.branch(bundle.dir);
		gitData.hash = git.long(bundle.dir);
		gitData.shortHash = git.short(bundle.dir);

		// Needed for the below commands to work.
		process.chdir(bundle.dir);

		// These will error if bundle.dir is not a git repo and if `git` is not in $PATH.
		gitData.date = git.date();
		gitData.message = git.message();
	} catch (e) {}

	process.chdir(workingDir);
	return gitData;
};

git-rev-sync

Synchronously get the current git commit hash, tag, or branch

MIT
Latest version published 3 years ago

Package Health Score

50 / 100
Full package analysis

Similar packages