mirror of
https://github.com/danog/gift.git
synced 2024-11-30 04:19:37 +01:00
Support file arguments for ls-files
This commit is contained in:
parent
25af97c70c
commit
951ba4c0b2
@ -287,13 +287,19 @@ module.exports = class Repo
|
||||
# Public: Show information about files in the index and the
|
||||
# working tree.
|
||||
#
|
||||
# files - Array of String paths; or a String path (optional).
|
||||
# options - An Object of command line arguments to pass to
|
||||
# `git ls-files` (optional).
|
||||
# callback - Receives `(err,stdout)`.
|
||||
#
|
||||
ls_files: (options, callback) ->
|
||||
ls_files: (files, options, callback) ->
|
||||
[options, callback] = [callback, options] if !callback
|
||||
@git "ls-files", options
|
||||
[files, callback] = [callback, files] if !callback
|
||||
[files, options] = [options, files] if typeof files is 'object' and not _.isArray files
|
||||
options ?= {}
|
||||
files ?= ''
|
||||
files = [files] if _.isString files
|
||||
@git "ls-files", options, _.flatten(['--', files])
|
||||
, (err, stdout, stderr) =>
|
||||
return callback err if err
|
||||
return callback null, @parse_lsFiles stdout,options
|
||||
|
Loading…
Reference in New Issue
Block a user