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.3.0 to 1.3.1

30

index.js

@@ -23,12 +23,28 @@ 'use strict';

} else {
// We have a file that tells us where to find the worktree git dir. Once we
// look there we'll know how to find the common git dir, depending on
// whether it's a linked worktree git dir, or a submodule dir
var linkedGitDir = fs.readFileSync(gitPath).toString();
var worktreeGitDir = /gitdir: (.*)/.exec(linkedGitDir)[1];
var worktreeGitDirUnresolved = /gitdir: (.*)/.exec(linkedGitDir)[1];
var worktreeGitDir = path.resolve(worktreeGitDirUnresolved);
var commonDirPath = path.join(worktreeGitDir, 'commondir');
var commonDirRelative = fs.readFileSync(commonDirPath).toString().replace(/\r?\n$/, '');
var commonDir = path.resolve(path.join(worktreeGitDir, commonDirRelative));
if (fs.existsSync(commonDirPath)) {
// this directory contains a `commondir` file; we're within a linked
// worktree
return {
worktreeGitDir: path.resolve(worktreeGitDir),
commonGitDir: commonDir,
};
var commonDirRelative = fs.readFileSync(commonDirPath).toString().replace(/\r?\n$/, '');
var commonDir = path.resolve(path.join(worktreeGitDir, commonDirRelative));
return {
worktreeGitDir: worktreeGitDir,
commonGitDir: commonDir,
};
} else {
// there is no `commondir` file; we're in a submodule
return {
worktreeGitDir: worktreeGitDir,
commonGitDir: worktreeGitDir,
};
}
}

@@ -35,0 +51,0 @@ }

{
"name": "git-repo-info",
"version": "1.3.0",
"version": "1.3.1",
"description": "Retrieve current sha and branch name from a git repo.",

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

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