New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

git-bundle-sha

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-bundle-sha - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.travis.yml

28

lib/git-sha.js

@@ -27,2 +27,7 @@ var child_process = require('child_process'),

});
},
makeSHALengthCallback = function (callback, shaLength) {
return function (err, sha) {
callback(err, (sha || '').slice(0, shaLength));
};
};

@@ -36,12 +41,27 @@

* the latest commit in which one of the files was modified.
* @param {Boolean} force don't read any values from cache. For performance, some
* @param {Object} options a hash of any of the following options:
* {Boolean} force don't read any values from cache. For performance, some
* data (like known submodule paths) are cached normally.
* default = false
* {Number} length trim the resulting SHA to this many characters (from front)
* default = null (use full SHA)
* @param {Function} callback function that will receive the SHA1 as its first argument
*/
module.exports = function (/* [files,] [force,] callback */) {
module.exports = function (/* [files,] [options,] callback */) {
var args = Array.prototype.slice.call(arguments),
cb = args.pop(),
files = args.shift() || [],
force = args.shift() || false;
options = args.shift() || {},
origCallback;
// handle case of options, but no list of files
if (!Array.isArray(files)) {
options = files;
files = [];
}
if (typeof options.length === 'number') {
cb = makeSHALengthCallback(cb, options.length);
}
// just get the latest commit

@@ -52,3 +72,3 @@ if (files.length === 0) {

if (force) {
if (options.force) {
// clear any closure caches

@@ -55,0 +75,0 @@ submodulePromise = null;

8

package.json
{
"name": "git-bundle-sha",
"version": "0.0.1",
"version": "0.0.2",
"description": "Retrieve the git SHA of the commit that most recently touched a list of files.",
"main": "lib/git-sha.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha test/test.js"
},

@@ -17,3 +17,7 @@ "author": {

"bluebird": "^2.3.0"
},
"devDependencies": {
"mocha": "^1.21.4",
"sinon": "^1.10.3"
}
}
# git-bundle-sha
[![Build Status](https://travis-ci.org/diurnalist/git-bundle-sha.svg?branch=master)](https://travis-ci.org/diurnalist/git-bundle-sha)
Retrieve the Git SHA of the latest commit that touched any number of files.
Useful in particular with bundling, when you want to identify a collection of files by
something like a hash, but tied to something more real (like a Git history.)
Useful in particular with bundling, when you want to identify a collection of files by something like a hash, but tied to something more real (like a Git history.)

@@ -39,2 +40,10 @@ ## Usage

### Options
#### `force`
Don't read any values from cache (some things, like the submodule list, are cached for performance.) Default = `false`.
#### `length`
Trim the resulting SHA to a specified length. Default = `null` (no trimming.)
## Notes

@@ -41,0 +50,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc