Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,35 @@ A detailed description of the architecture of Git-meta is provided in

## Installation

### Prerequisites

This project requires **Node.js version 18 or later** (including Node.js 23+). The project has been updated to use `simple-git` instead of `nodegit`, which provides full compatibility with modern Node.js versions and eliminates the need for native module compilation.

**Note:** This project requires Git to be installed on your system, as `simple-git` is a wrapper around the Git CLI. The project uses a compatibility layer that mimics the `nodegit` API, allowing the codebase to work with modern Node.js versions without requiring changes to the existing code.

### Install Steps

To install the git-meta plugin:

```bash
$ git clone https://github.com/twosigma/git-meta.git
$ cd git-meta/node
$ npm install
$ npm link
```

**Alternative:** If you prefer a global installation instead of linking:

```bash
$ cd git-meta/node
$ npm install
$ npm install -g
```

**Note:**
- Make sure you're in the `node` subdirectory (not the root of the repository) when running npm commands, as that's where the `package.json` file is located.
- The project includes a `.npmrc` file that automatically handles peer dependency resolution, so you don't need to use the `--legacy-peer-deps` flag.

## Quick Start / Basic Usage

### Clone
Expand Down
2 changes: 2 additions & 0 deletions node/.npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
legacy-peer-deps=true

3 changes: 0 additions & 3 deletions node/lib/cmd/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,20 @@ to submodules with new commits in their working directories.

exports.configureParser = function (parser) {
parser.addArgument(["-u", "--update"], {
required: false,
action: "storeConst",
constant: true,
help: "Update tracked files.",
defaultValue:false
});

parser.addArgument(["-v", "--verbose"], {
required: false,
action: "storeConst",
constant: true,
help: `Log which files are added to / removed from the index`,
defaultValue: false,
});

parser.addArgument(["--meta"], {
required: false,
action: "storeConst",
constant: true,
help: `
Expand Down
2 changes: 1 addition & 1 deletion node/lib/cmd/add_submodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Branch in repo from which we are importing to checkout as HEAD.`,
*/
exports.executeableSubcommand = co.wrap(function *(args) {
const colors = require("colors");
const fs = require("fs-promise");
const fs = require("fs-extra");
const path = require("path");

const AddSubmodule = require("../util/add_submodule");
Expand Down
1 change: 0 additions & 1 deletion node/lib/cmd/checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ match a single remote tracking branch, treat as equivalent to \
});

parser.addArgument(["-f", "--force"], {
required: false,
action: "storeConst",
constant: true,
help: `Overwrite conflicting local changes.`,
Expand Down
1 change: 0 additions & 1 deletion node/lib/cmd/close.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ exports.configureParser = function (parser) {

parser.addArgument(["-f", "--force"], {
defaultValue: false,
required: false,
action: "storeConst",
constant: true,
help: `The command refuses to close submodules that have
Expand Down
4 changes: 0 additions & 4 deletions node/lib/cmd/commit-shadow.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ use and its output format is stable.`;
*/
exports.configureParser = function (parser) {
parser.addArgument(["-u", "--include-untracked"], {
required: false,
action: "storeConst",
constant: true,
defaultValue: false,
Expand All @@ -79,23 +78,20 @@ exports.configureParser = function (parser) {
help: "commit message for shadow commits",
});
parser.addArgument(["-e", "--epoch-timestamp"], {
required: false,
action: "storeConst",
constant: true,
defaultValue: false,
help: "deprecated, but same as '--increment-timestamp'",
});

parser.addArgument(["-i", "--increment-timestamp"], {
required: false,
action: "storeConst",
constant: true,
defaultValue: false,
help: "use timestamp of HEAD + 1 instead of current time",
});
parser.addArgument(["-s", "--include-subrepos"], {
type: "string",
required: false,
nargs: "+",
help: "only include specified sub-repos",
});
Expand Down
6 changes: 0 additions & 6 deletions node/lib/cmd/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ meta-repository to point to these new commits.`;
exports.configureParser = function (parser) {
parser.addArgument(["-a", "--all"], {
defaultValue: false,
required: false,
action: "storeConst",
constant: true,
help: "commit all changed files",
});
parser.addArgument(["-m", "--message"], {
type: "string",
action: "append",
required: false,
help: "commit message; if not specified will prompt"
});
parser.addArgument(["--amend"], {
required: false,
action: "storeConst",
constant: true,
help: `\
Expand All @@ -78,21 +75,18 @@ specified) modifications. Will fail unless all submodules changed in HEAD \
have matching commits and have no new commits.`,
});
parser.addArgument(["--no-edit"], {
required: false,
action: "storeConst",
defaultValue: false,
constant: true,
help: `When amending, reuse previous messages without editing.`,
});
parser.addArgument(["--no-verify"], {
required: false,
action: "storeConst",
defaultValue: false,
constant: true,
help: `This option bypasses the pre-commit hooks.`,
});
parser.addArgument(["-i", "--interactive"], {
required: false,
action: "storeConst",
defaultValue: false,
constant: true,
Expand Down
2 changes: 1 addition & 1 deletion node/lib/cmd/list_files.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ exports.configureParser = function (/* parser */) {
exports.executeableSubcommand = co.wrap(function *(/* args */) {
// TODO: add applicable `git rebase` options.

const fs = require("fs-promise");
const fs = require("fs-extra");
const path = require("path");

const ListFiles = require("../util/list_files");
Expand Down
4 changes: 1 addition & 3 deletions node/lib/cmd/merge.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"use strict";

const co = require("co");
const fs = require("fs-promise");
const fs = require("fs-extra");

/**
* This module contains methods for implementing the `merge` command.
Expand Down Expand Up @@ -60,12 +60,10 @@ exports.configureParser = function (parser) {
type: "string",
help: "commit message",
action: "append",
required: false,
});
parser.addArgument(["-F", "--message-file"], {
type: "string",
help: "commit message file name",
required: false,
});
parser.addArgument(["--ff"], {
help: "allow fast-forward merges; this is the default",
Expand Down
4 changes: 1 addition & 3 deletions node/lib/cmd/merge_bare.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"use strict";

const co = require("co");
const fs = require("fs-promise");
const fs = require("fs-extra");

/**
* This module contains methods for implementing the `merge-bare` command.
Expand All @@ -58,12 +58,10 @@ exports.configureParser = function (parser) {
type: "string",
action: "append",
help: "commit message",
required: false,
});
parser.addArgument(["-F", "--message-file"], {
type: "string",
help: "commit message file name",
required: false,
});

parser.addArgument(["ourCommit"], {
Expand Down
2 changes: 1 addition & 1 deletion node/lib/cmd/open.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
const assert = require("chai").assert;
const co = require("co");
const path = require("path");
const NodeGit = require("nodegit");
const NodeGit = require("../util/nodegit_compat");
const GitUtil = require("../util/git_util");
const UserError = require("../util/user_error");

Expand Down
2 changes: 0 additions & 2 deletions node/lib/cmd/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,13 @@ if not specified.`,
});

parser.addArgument(["-f", "--force"], {
required: false,
action: "storeConst",
constant: ForcePushSpec.Force,
defaultValue: ForcePushSpec.NoForce,
help: `Attempt to push even if not a fast-forward change.`,
});

parser.addArgument(["--force-with-lease"], {
required: false,
action: "storeConst",
constant: ForcePushSpec.ForceWithLease,
dest: "force",
Expand Down
4 changes: 0 additions & 4 deletions node/lib/cmd/reset.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,22 +70,19 @@ for each mode for more information.
exports.configureParser = function (parser) {

parser.addArgument(["--soft"], {
required: false,
action: "storeConst",
constant: true,
help: `Do not change the working directory or index.`,
});

parser.addArgument(["--mixed"], {
required: false,
action: "storeConst",
constant: true,
help: `Unstage any changes, but do not alter the working dictory. \
This mode is the default.`,
});

parser.addArgument(["--hard"], {
required: false,
action: "storeConst",
constant: true,
help: `Discard all changes and reset both working directory and index \
Expand All @@ -96,7 +93,6 @@ as specified by the selected commit.`
type: "string",
help: "commit to reset the head of the current branch to",
defaultValue: null,
required: false,
nargs: ArgParse.Const.OPTIONAL,
});

Expand Down
3 changes: 0 additions & 3 deletions node/lib/cmd/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,23 +56,20 @@ its removal will be staged in the index.

exports.configureParser = function (parser) {
parser.addArgument(["-f", "--force"], {
required: false,
action: "storeConst",
constant: true,
help: "Force removal of a commit with stated changes.",
defaultValue:false
});

parser.addArgument(["-r", "--recursive"], {
required: false,
action: "storeConst",
constant: true,
help: "Remove a directory recursively",
defaultValue:false
});

parser.addArgument(["--cached"], {
required: false,
action: "storeConst",
constant: true,
help: `
Expand Down
1 change: 0 additions & 1 deletion node/lib/cmd/root.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ directory of that meta-repository.`;

exports.configureParser = function (parser) {
parser.addArgument(["--relative", "-r"], {
required: false,
action: "storeConst",
constant: true,
help: `
Expand Down
1 change: 0 additions & 1 deletion node/lib/cmd/stash.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ exports.configureParser = function (parser) {
parser.addArgument(["-m", "--message"], {
type: "string",
action: "append",
required: false,
help: "description; if not provided one will be generated",
});

Expand Down
2 changes: 0 additions & 2 deletions node/lib/cmd/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ state, e.g., when a sub-repo is on a different branch than the meta-repo.`;

exports.configureParser = function (parser) {
parser.addArgument(["-s", "--short"], {
required: false,
action: "storeConst",
constant: true,
help: "Give the output in a short format",
dest: "shortFormat" //"short" is a reserved word in js
});
parser.addArgument(["-u", "--untracked-files"], {
required: false,
choices: [
DiffUtil.UNTRACKED_FILES_OPTIONS.ALL,
DiffUtil.UNTRACKED_FILES_OPTIONS.NORMAL,
Expand Down
5 changes: 0 additions & 5 deletions node/lib/cmd/submodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ current SHA-1 for that submodule followed by its name.`,

statusParser.addArgument(["-v", "--verbose"], {
defaultValue: false,
required: false,
action: "storeConst",
constant: true,
help: `show one-line summary of each submodule: a '-' if the \
Expand Down Expand Up @@ -110,15 +109,13 @@ ancestor of M (or M itself) that references S (or a descendant of S)`,
findMetaParser.addArgument(["submodule committish"], {
help: "submodule commit to look for",
type: "string",
required: false,
defaultValue: "HEAD",
nargs: "?",
});

findMetaParser.addArgument(["-m", "--meta-committish"], {
help: "meta-repo commit from which to begin searching",
type: "string",
required: false,
defaultValue: "HEAD",
});

Expand All @@ -139,15 +136,13 @@ meta-repo that is not opened is ignored by this command.`,
foreachParser.addArgument(["--recursive"], {
help: "sub-repos are traversed recursively",
defaultValue: false,
required: false,
action: "storeConst",
constant: true,
});

foreachParser.addArgument(["--quiet"], {
help: "only print error messages",
defaultValue: false,
required: false,
action: "storeConst",
constant: true,
});
Expand Down
2 changes: 1 addition & 1 deletion node/lib/destitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

const ArgumentParser = require("argparse").ArgumentParser;
const co = require("co");
const NodeGit = require("nodegit");
const NodeGit = require("./util/nodegit_compat");

const DestitchUtil = require("./util/destitch_util");
const UserError = require("./util/user_error");
Expand Down
Loading
Loading