@@ -10,6 +10,7 @@ var Promise = require("nodegit-promise");
1010var normalizeOptions = require ( "./util/normalize_options" ) ;
1111var Status = require ( "./status" ) ;
1212var StatusFile = require ( "./status_file" ) ;
13+ var StatusList = require ( "./status_list" ) ;
1314
1415var TreeBuilder = NodeGit . Treebuilder ;
1516var Repository = NodeGit . Repository ;
@@ -727,17 +728,17 @@ Repository.initExt = function(repo_path, opts) {
727728 * Get the status of a repo to it's working directory
728729 *
729730 * @param {obj } opts
730- * @return {Object } Promise object.
731+ * @return {Array<StatusFile> }
731732 */
732733Repository . prototype . getStatus = function ( opts ) {
733734 var statuses = [ ] ;
734735 var statusCallback = function ( path , status ) {
735- statuses . push ( new StatusFile ( path , status ) ) ;
736+ statuses . push ( new StatusFile ( { path : path , status : status } ) ) ;
736737 } ;
737738
738739 if ( ! opts ) {
739740 opts = {
740- flags : Status . OPT . INCLUDE_UNTRACKED +
741+ flags : Status . OPT . INCLUDE_UNTRACKED |
741742 Status . OPT . RECURSE_UNTRACKED_DIRS
742743 } ;
743744 }
@@ -747,4 +748,34 @@ Repository.prototype.getStatus = function(opts) {
747748 } ) ;
748749} ;
749750
751+ /**
752+ * Get extended statuses of a repo to it's working directory. Status entries
753+ * have `status`, `headToIndex` delta, and `indexToWorkdir` deltas
754+ *
755+ * @param {obj } opts
756+ * @return {Array<StatusEntry> }
757+ */
758+ Repository . prototype . getStatusExt = function ( opts ) {
759+ var statuses = [ ] ;
760+
761+ if ( ! opts ) {
762+ opts = {
763+ flags : Status . OPT . INCLUDE_UNTRACKED |
764+ Status . OPT . RECURSE_UNTRACKED_DIRS |
765+ Status . OPT . RENAMES_INDEX_TO_WORKDIR |
766+ Status . OPT . RENAMES_HEAD_TO_INDEX |
767+ Status . OPT . RENAMES_FROM_REWRITES
768+ } ;
769+ }
770+
771+ return StatusList . create ( this , opts ) . then ( function ( list ) {
772+ for ( var i = 0 ; i < list . entrycount ( ) ; i ++ ) {
773+ var entry = Status . byIndex ( list , i ) ;
774+ statuses . push ( new StatusFile ( { entry : entry } ) ) ;
775+ }
776+
777+ return statuses ;
778+ } ) ;
779+ } ;
780+
750781module . exports = Repository ;
0 commit comments