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

branchforge

Package Overview
Dependencies
Maintainers
0
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

branchforge - npm Package Compare versions

Comparing version 0.8.0 to 0.9.0

45

dist/index.js

@@ -49,2 +49,7 @@ #!/usr/bin/env node

}
fetch() {
return __awaiter(this, void 0, void 0, function* () {
const output = yield this.git.fetch();
});
}
getCurrentBranch() {

@@ -72,4 +77,4 @@ return __awaiter(this, void 0, void 0, function* () {

const branches = yield this.git.branch(["-a"]); // Include remote branches
// Check both local and remote branches
return branches.all.includes(branch) || branches.all.includes(`remotes/origin/${branch}`);
return (branches.all.includes(branch) ||
branches.all.includes(`origin/${branch}`));
}

@@ -101,9 +106,15 @@ catch (error) {

yield this.git.checkout(base);
// Create the new branch from base
yield this.git.checkoutLocalBranch(branchName);
// Merge the include branches
for (const include of includes) {
// Check if the include branch exists remotely
const includeBranch = (yield this.branchExists(include)) ? include : `origin/${include}`;
yield this.git.merge([includeBranch]);
const includeBranch = (yield this.branchExists(include))
? include
: `origin/${include}`;
try {
yield this.git.merge([includeBranch]);
}
catch (error) {
if (error instanceof Error) {
console.error(`Error merging branch "${includeBranch}": ${error.message}`);
}
}
}

@@ -115,3 +126,7 @@ console.log(`Branch "${branchName}" has been rebuilt.`);

return __awaiter(this, void 0, void 0, function* () {
const baseAndIncludesBranches = [base, ...includes];
const includesExist = yield Promise.all(includes.map((include) => this.branchExists(include)));
const baseAndIncludesBranches = [
base,
...includes.map((include, i) => includesExist[i] ? include : `origin/${include}`),
];
try {

@@ -172,3 +187,2 @@ const combinedCommits = yield this.git.raw([

const baseExists = yield gitService.branchExists(base);
const includesExist = yield Promise.all(includes.map(gitService.branchExists.bind(gitService)));
if (!baseExists) {

@@ -178,3 +192,13 @@ console.error(`Base branch "${base}" does not exist.`);

}
const missingIncludes = includes.filter((_, i) => !includesExist[i]);
const missingIncludes = [];
for (const include of includes) {
// Check for existence in local branches, remote branches, and remotes/origin
const localExists = yield gitService.branchExists(include);
const remoteExists = yield gitService.branchExists(`origin/${include}`);
const remotesOriginExists = yield gitService.branchExists(`remotes/origin/${include}`);
if (!localExists && !remoteExists && !remotesOriginExists) {
missingIncludes.push(include);
}
}
// Only log an error if all includes are truly missing
if (missingIncludes.length > 0) {

@@ -207,2 +231,3 @@ console.error(`Includes branches do not exist: ${missingIncludes.join(", ")}`);

const gitService = new GitService();
yield gitService.fetch(); // Fetch all remote branches before proceeding
const originalBranch = yield gitService.getCurrentBranch(); // Use the new method

@@ -209,0 +234,0 @@ console.log("starting out in branch", originalBranch);

{
"name": "branchforge",
"version": "0.8.0",
"version": "0.9.0",
"private": false,

@@ -5,0 +5,0 @@ "main": "dist/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