(result)
| 1887 | // stage the entire file so the file doesn't show as having unstaged changes |
| 1888 | // in `git status`. Also, check if there are no type changes. |
| 1889 | var lastHunkStagedPromise = function lastHunkStagedPromise(result) { |
| 1890 | return NodeGit.Diff.indexToWorkdir(repo, index, { |
| 1891 | flags: |
| 1892 | NodeGit.Diff.OPTION.SHOW_UNTRACKED_CONTENT | |
| 1893 | NodeGit.Diff.OPTION.RECURSE_UNTRACKED_DIRS | |
| 1894 | (additionalDiffOptions || 0) |
| 1895 | }) |
| 1896 | .then(function(diff) { |
| 1897 | return diff.patches(); |
| 1898 | }) |
| 1899 | .then(function(patches) { |
| 1900 | var pathPatch = patches.filter(function(patch) { |
| 1901 | return patch.newFile().path() === filePath; |
| 1902 | }); |
| 1903 | var emptyPatch = false; |
| 1904 | if (pathPatch.length > 0) { |
| 1905 | // No hunks, unchanged file mode, and no type changes. |
| 1906 | emptyPatch = pathPatch[0].size() === 0 && |
| 1907 | pathPatch[0].oldFile().mode() === pathPatch[0].newFile().mode() && |
| 1908 | !pathPatch[0].isTypeChange(); |
| 1909 | } |
| 1910 | if (emptyPatch) { |
| 1911 | return index.addByPath(filePath) |
| 1912 | .then(function() { |
| 1913 | return index.write(); |
| 1914 | }); |
| 1915 | } |
| 1916 | |
| 1917 | return result; |
| 1918 | }); |
| 1919 | }; |
| 1920 | |
| 1921 | return repo.refreshIndex() |
| 1922 | .then(function(indexResult) { |
no outgoing calls
no test coverage detected
searching dependent graphs…