1.4.0 • Published 3 months ago

@apexdevtools/git-ops v1.4.0

Weekly downloads
-
License
BSD-3-Clause
Repository
github
Last release
3 months ago

git-ops

Library to do git operations to find changed files in a given git repository.

Prerequisite

Minimum git version of 2.20.0 must already be installed on the host machine.

Getting Started

To build run

pnpm install
pnpm build

Jest unit tests can be run with

pnpm test

 Usage

Prerequisite: The head mus tbe set on the repo otherwise any functions using default branch will fail

Installation

npm i @apexdevtools/git-ops

Finding changed files

Getting changed files using the default branch in that repo given a ref. This finds the default branch in the repo using git symbolic-ref 'refs/remotes/origin/HEAD' so the HEAD must be set. The output of the command is same as running git diff branchName...ref combined with git status.

Note: files with the status of deleted (D) and ignored (!) will not be included in the change set.

getDefaultBranchDiffByRef

Works out changed files using the default branch in that repo given a ref. This find the default branch in the repo using git symbolic-ref 'refs/remotes/origin/HEAD' so the HEAD must be set. The output of the command is same as running git diff branchName...ref combined with git status.

Files with the status of deleted (D) and ignored (!) will not be included in the change set.

getDefaultBranchDiffByRef(repoDir: string, ref: string): Promise<Set<string>>

getDefaultBranchDiff

This command is same as calling getDefaultBranchDiffByRef(repoRootDir, 'HEAD').

getDefaultBranchDiff(repoDir: string): Promise<Set<string>>

getDiffRange

Works out the diff between a given range. Equivalent to git diff ref1...ref2

getDiffRange(dir: string, fromRef: string, toRef: string): Promise<Set<string>>

getLocalChanges

Get the local changes that not have been committed. Equivalent to git status

Files with the status of deleted (D) and ignored (!) will not be included in the change set

getLocalChanges(dir: string): Promise<Set<string>>
1.4.0

3 months ago

1.2.0

9 months ago

1.3.0

7 months ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago