Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

git-repo-info

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

git-repo-info - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

tests/fixtures/branch-with-slashes/dot-git/HEAD

5

index.js

@@ -106,3 +106,6 @@ 'use strict';

var headFile = fs.readFileSync(headFilePath, {encoding: 'utf8'});
var branchName = headFile.split('/').slice(-1)[0].trim();
var branchName = headFile.split('/').slice(2).join('/').trim();
if (!branchName) {
branchName = headFile.split('/').slice(-1)[0].trim();
}
var refPath = headFile.split(' ')[1];

@@ -109,0 +112,0 @@

2

package.json
{
"name": "git-repo-info",
"version": "1.1.0",
"version": "1.1.1",
"description": "Retrieve current sha and branch name from a git repo.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -130,3 +130,17 @@ 'use strict';

}
it('returns an object with repo info, including the full branch name, if the branch name includes any slashes', function() {
var repoRoot = path.join(testFixturesPath, 'branch-with-slashes');
var result = repoInfo(path.join(repoRoot, gitDir));
var expected = {
branch: 'feature/branch/with/slashes',
sha: '5359aabd3872d9ffd160712e9615c5592dfe6745',
abbreviatedSha: '5359aabd38',
tag: null
};
assert.deepEqual(result, expected);
});
});
});
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