{"action":"created","issue":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/793","labels_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/793/labels{/name}","comments_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/793/comments","events_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/793/events","html_url":"https://github.com/libgit2/libgit2sharp/issues/793","id":40660940,"number":793,"title":"staging files with ignored invalid paths raises exceptions ","user":{"login":"shiftkey","id":359239,"avatar_url":"https://avatars.githubusercontent.com/u/359239?v=3","gravatar_id":"","url":"https://api.github.com/users/shiftkey","html_url":"https://github.com/shiftkey","followers_url":"https://api.github.com/users/shiftkey/followers","following_url":"https://api.github.com/users/shiftkey/following{/other_user}","gists_url":"https://api.github.com/users/shiftkey/gists{/gist_id}","starred_url":"https://api.github.com/users/shiftkey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shiftkey/subscriptions","organizations_url":"https://api.github.com/users/shiftkey/orgs","repos_url":"https://api.github.com/users/shiftkey/repos","events_url":"https://api.github.com/users/shiftkey/events{/privacy}","received_events_url":"https://api.github.com/users/shiftkey/received_events","type":"User","site_admin":true},"labels":[{"url":"https://api.github.com/repos/libgit2/libgit2sharp/labels/Bug","name":"Bug","color":"e10c02"},{"url":"https://api.github.com/repos/libgit2/libgit2sharp/labels/libgit2","name":"libgit2","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":18,"created_at":"2014-08-20T03:47:31Z","updated_at":"2015-02-19T07:11:01Z","closed_at":null,"body":"So here's the setup:\r\n\r\nThis file path is under `node_modules`, which is specified in the `.gitignore` file for the repository:\r\n\r\n```\r\nC:/Projects/GitHub/fiber-verification/node_modules/grunt-contrib-imagemin/\r\nnode_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/\r\ngifsicle/node_modules/bin-build/node_modules/download/node_modules/\r\ndecompress/node_modules/adm-zip/.idea/scopes/scope_settings.xml\r\n```\r\n\r\nWhen staging files multiple changes (two files in different subdirectories seems to be the minimum to trigger this) `libgit2sharp` will pass in the `DiffModifiers.IncludeIgnored` flag:\r\n\r\nhttps://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp/Index.cs#L157\r\n\r\n```\r\nvar changes = repo.Diff.Compare<TreeChanges>(\r\n    DiffModifiers.IncludeUntracked | DiffModifiers.IncludeIgnored, paths, explicitPathsOptions);\r\n```\r\n\r\nThis is mapped to two flags for `libgit2`: `GIT_DIFF_INCLUDE_IGNORED | GIT_DIFF_RECURSE_IGNORED_DIRS`\r\n\r\nhttps://github.com/libgit2/libgit2sharp/blob/vNext/LibGit2Sharp/Diff.cs#L39-L43\r\n\r\nAnd p/invoking `git_diff_index_to_workdir` surfaces this exception:\r\n\r\n```\r\nInvalid path for filesystem 'C:/Projects/GitHub/fiber-verification/node_modules/grunt-contrib-imagemin/node_modules/imagemin/node_modules/imagemin-gifsicle/node_modules/gifsicle/node_modules/bin-build/node_modules/download/node_modules/decompress/node_modules/adm-zip/.idea/scopes/scope_settings.xml': The data area passed to a system call is too small.\r\n```\r\n\r\nStack Trace: \r\n\r\n```\r\n   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) \r\n   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) \r\n   at LibGit2Sharp.Core.Proxy.git_diff_index_to_workdir(RepositorySafeHandle repo, IndexSafeHandle index, GitDiffOptions options) \r\n   at LibGit2Sharp.Diff.<>c__DisplayClass5.<WorkdirToIndex>b__4(ObjectId oh, ObjectId nh, GitDiffOptions o) \r\n   at LibGit2Sharp.Diff.BuildDiffList(ObjectId oldTreeId, ObjectId newTreeId, TreeComparisonHandleRetriever comparisonHandleRetriever, DiffModifiers diffOptions, IEnumerable`1 paths, ExplicitPathsOptions explicitPathsOptions, CompareOptions compareOptions) \r\n   at LibGit2Sharp.Diff.Compare[T](DiffModifiers diffOptions, IEnumerable`1 paths, ExplicitPathsOptions explicitPathsOptions, CompareOptions compareOptions) \r\n   at LibGit2Sharp.Index.Stage(IEnumerable`1 paths, ExplicitPathsOptions explicitPathsOptions)\r\n```\r\n\r\nThis is a demo repository which demonstrates the issue (you need to \"npm install\" to add the ignored folders): https://github.com/agrc/fiber-verification/\r\n\r\n**As a workaround**, I've been able to complete staging the files by removing the `DiffModifiers.IncludeIgnored` flag - but this feels like a hack because of the notes mentioned here 885de34f544478ec005dce3d5b5ea5a72d1c7457 cc @ethomson\r\n\r\nI'm going to look to recreate this in plain `libgit2` next so I can debug further, as this message makes me think there's something which needs to be addressed in there...\r\n\r\n> The data area passed to a system call is too small."},"comment":{"url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/comments/75007771","html_url":"https://github.com/libgit2/libgit2sharp/issues/793#issuecomment-75007771","issue_url":"https://api.github.com/repos/libgit2/libgit2sharp/issues/793","id":75007771,"user":{"login":"ericis","id":974919,"avatar_url":"https://avatars.githubusercontent.com/u/974919?v=3","gravatar_id":"","url":"https://api.github.com/users/ericis","html_url":"https://github.com/ericis","followers_url":"https://api.github.com/users/ericis/followers","following_url":"https://api.github.com/users/ericis/following{/other_user}","gists_url":"https://api.github.com/users/ericis/gists{/gist_id}","starred_url":"https://api.github.com/users/ericis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericis/subscriptions","organizations_url":"https://api.github.com/users/ericis/orgs","repos_url":"https://api.github.com/users/ericis/repos","events_url":"https://api.github.com/users/ericis/events{/privacy}","received_events_url":"https://api.github.com/users/ericis/received_events","type":"User","site_admin":false},"created_at":"2015-02-19T07:11:00Z","updated_at":"2015-02-19T07:11:00Z","body":"I did the same as @shailensukul.  However, I was able to use the \"subst\" command to re-root the project directory path to a new drive letter, delete the \"node_modules\" dir, commit, and then re-add bower/grunt to my project (using npm). Once I re-installed, __I was able to make an edit and commit without getting the error afterward__.  I will continue to see if I can make additional commits or if I get errors and report back!"}}