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

current-git-branch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

current-git-branch - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

CHANGELOG.md

1

build.js

@@ -50,1 +50,2 @@ 'use strict';

exports.default = isGitAdded;
module.exports = exports['default'];

6

package.json
{
"name": "current-git-branch",
"version": "1.0.0",
"version": "1.0.1",
"description": "A tool to check if files are added in a git repository",

@@ -9,3 +9,3 @@ "main": "build.js",

"test": "nyc ava",
"lint": "eslint index.js",
"lint": "eslint index.js test.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",

@@ -46,2 +46,3 @@ "prepublish": "npm run babel",

"dependencies": {
"babel-plugin-add-module-exports": "^0.2.1",
"execa": "^0.6.1",

@@ -60,5 +61,4 @@ "is-git-repository": "^1.0.0"

"husky": "^0.13.2",
"is-ci": "^1.0.10",
"nyc": "^10.1.2"
}
}

@@ -0,34 +1,33 @@

import fs from 'fs';
import { homedir } from 'os';
import test from 'ava';
import path from 'path';
import execa from 'execa';
import fs from 'fs-extra';
import isCi from 'is-ci';
import branchName from './index';
const fixtures = 'test/fixtures';
const fixtures = path.join(process.cwd(), 'test', 'fixtures');
test('check if the given directory is the branch master', (t) => {
t.plan(1);
const folders = [
'feat_test',
'master',
];
if (isCi) {
t.is(branchName(path.join(fixtures, 'master')).slice(0, 14), '(HEAD detached');
} else {
t.is(branchName(path.join(fixtures, 'master')), 'master');
}
test.before('rename git folders', () => {
folders.map(folder => fs.renameSync(path.join(fixtures, folder, 'git'), path.join(fixtures, folder, '.git')));
});
test('check if the given directory is the branch feat/test', (t) => {
t.plan(1);
test.after.always('rename .git folders', () => {
folders.map(folder => fs.renameSync(path.join(fixtures, folder, '.git'), path.join(fixtures, folder, 'git')));
});
if (isCi) {
t.is(branchName(path.join(fixtures, 'feat_test')).slice(0, 14), '(HEAD detached');
} else {
t.is(branchName(path.join(fixtures, 'feat_test')), 'feat/test');
}
test('check if the given directory is the branch master', (t) => {
t.is(branchName(path.join(fixtures, 'master')), 'master');
});
test('check if the given directory is the branch feat/test', (t) => {
t.is(branchName(path.join(fixtures, 'feat_test')), 'feat_test');
});
test('check the branch name of the home dir', (t) => {
t.false(branchName(homedir()));
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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