0.0.1 • Published 7 years ago

committed-git-files v0.0.1

Weekly downloads
182
License
BSD-2-Clause
Repository
github
Last release
7 years ago

committed Git Files Build Status npm version

This module returns an array of committed files diff from a source branch and current HEAD and their status acording to git.

Usage

Download

npm install committed-git-files

In Code

var cgf = require("committed-git-files");
cgf(function(err, results){
	//WHAT EVER YOU SO PLEASE
});

Example Results

[
	{
		"filename": "package.json",
		"status": "Added"
	},
	{
		"filename": "readme.md",
		"status": "Modified"
	},
	{
		"filename": "index.js",
		"status": "Renamed"
	}
]

API

cgf(source, filter, callback)

Get a list of committed git files

  • source: string of git source branch: origin/master
  • filter: string of git status codes. No spaces
  • callback: err: the error results: file object array.

cgf.getSourceId(source, callback)

Get commit id that will be used in the diff to ID which files are committed diff.

  • source: string of git source branch: origin/master
  • callback err: the error head: the git commit id of the branch

cgf.readFile(filename, options, callback)

This is a proxy for fs.readFile with one change. The filename will be relative to the cgf.cwd

cgf.debug

Boolean that flips logging on and off. By default this is false. If true, all git commands will be console logged.

cgf.includeContent

If true, include content will add a content or err param to the file object.

  • Default Value: false
  • Content Param: the content of the file
  • Err Param: the error message received while trying to read the file.

cgf.cwd

The current working directory. AKA: where the .git folder you care about is.

Default Value: is equal to process.cwd() of your app.g

Statuses

cgf-Status (git status code)

Change Log

0.0.1