@@ -72,22 +72,29 @@ Object.keys(descriptor).forEach(function(fileName, index) {
7272 }
7373 } ) ;
7474
75+ var cFile = libgit2 . files [ index ] ;
76+
7577 if ( file . cType === undefined ) {
76- if ( libgit2 . files [ index ] . functions . length ) {
77- file . cType = libgit2 . files [ index ] . functions [ 0 ] . split ( "_" ) . slice ( 0 , 2 ) . join ( "_" ) ;
78+ if ( cFile . functions . length ) {
79+ file . cType = cFile . functions [ 0 ] . split ( "_" ) . slice ( 0 , 2 ) . join ( "_" ) ;
7880 }
7981 }
8082
8183 if ( file . cType ) {
8284 file . freeFunctionName = "git_" + fileName + "_free" ;
8385 }
8486
85- var cFile = libgit2 . files [ index ] ;
86-
87- if ( ! cFile || ! cFile . functions ) {
87+ if ( ( ! cFile || ! cFile . functions ) && ! file . isStruct ) {
8888 return ;
8989 }
9090
91+ // TODO Obsolete this.
92+ if ( file . isStruct ) {
93+ // No functions.
94+ cFile = file ;
95+ cFile . functions = [ ] ;
96+ }
97+
9198 // Doesn't actually exist.
9299 if ( cFile . functions . indexOf ( file . freeFunctionName ) === - 1 ) {
93100 delete file . freeFunctionName ;
@@ -159,7 +166,13 @@ Object.keys(descriptor).forEach(function(fileName, index) {
159166 // Used to identify a missing function descriptor later on.
160167 var ident = { } ;
161168
162- file . functions = libgit2 . files [ index ] . functions . map ( function ( functionName , index ) {
169+ //Object.keys(file.functions || {}).forEach(function(functionName) {
170+ // if (cFile.functions.indexOf(functionName) === -1 && functionName) {
171+ // cFile.functions.push(functionName);
172+ // }
173+ //});
174+
175+ file . functions = cFile . functions . map ( function ( functionName , index ) {
163176 var funcDescriptor = libgit2 . functions [ functionName ] ;
164177 var descriptor = legacyFile . functions ? legacyFile . functions [ index ] || { } : { } ;
165178 var cType = file . cType || "git" ;
0 commit comments