{"action":"created","issue":{"url":"https://api.github.com/repos/rubenv/grunt-git/issues/79","labels_url":"https://api.github.com/repos/rubenv/grunt-git/issues/79/labels{/name}","comments_url":"https://api.github.com/repos/rubenv/grunt-git/issues/79/comments","events_url":"https://api.github.com/repos/rubenv/grunt-git/issues/79/events","html_url":"https://github.com/rubenv/grunt-git/issues/79","id":45270407,"number":79,"title":"Problems with gitcommit for a repository in a sub-directory","user":{"login":"djmccormick","id":40710,"avatar_url":"https://avatars.githubusercontent.com/u/40710?v=3","gravatar_id":"","url":"https://api.github.com/users/djmccormick","html_url":"https://github.com/djmccormick","followers_url":"https://api.github.com/users/djmccormick/followers","following_url":"https://api.github.com/users/djmccormick/following{/other_user}","gists_url":"https://api.github.com/users/djmccormick/gists{/gist_id}","starred_url":"https://api.github.com/users/djmccormick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djmccormick/subscriptions","organizations_url":"https://api.github.com/users/djmccormick/orgs","repos_url":"https://api.github.com/users/djmccormick/repos","events_url":"https://api.github.com/users/djmccormick/events{/privacy}","received_events_url":"https://api.github.com/users/djmccormick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2014-10-08T17:13:43Z","updated_at":"2015-07-25T19:38:20Z","closed_at":null,"body":"I'm attempting to use `gitcommit` against a repository in a sub-directory within my project. The `cwd` option doesn't seem to be working properly.\r\n\r\nMy `gitcommit` task looks like this:\r\n\r\n\tgitcommit: {\r\n\t\tdist: {\r\n\t\t\toptions: {\r\n\t\t\t\texpand: true,\r\n\t\t\t\tcwd: 'dist',\r\n\t\t\t\tmessage: 'v<%= pkg.version %>'\r\n\t\t\t},\r\n\t\t\tfiles: [{\r\n\t\t\t\texpand: true,\r\n\t\t\t\tcwd: 'dist',\r\n\t\t\t\tsrc: ['**/*']\r\n\t\t\t}]\r\n\t\t}\r\n\t},\r\n\r\nAnd when I run it, I get something like this:\r\n\r\n\tRunning \"gitcommit:dist\" (gitcommit) task\r\n\tWarning: fatal: pathspec 'dist/about.html' did not match any files Use --force to continue.\r\n\r\n\tAborted due to warnings.\r\n\r\nOr, with verbose mode:\r\n\r\n\tRunning \"gitcommit:dist\" (gitcommit) task\r\n\tVerifying property gitcommit.dist exists in config...OK\r\n\tFiles: dist/whatsnew.html -> whatsnew.html\r\n\tOptions: message=\"v0.0.84\", ignoreEmpty=false, noVerify=false, noStatus=false, expand, cwd=\"dist\"\r\n\tOptions: verbose=false, expand, cwd=\"dist\", message=\"v0.0.84\"\r\n\tWarning: fatal: pathspec 'dist/about.html' did not match any files Use --force to continue.\r\n\r\n\tAborted due to warnings.\r\n\r\nIt appears that the `dist/` portion is still being included despite my `cwd`, given that the file is in the appropriate location:\r\n\r\n\tdjmccormick at computer in ~/Projects/some-category/some-project on some-branch\r\n\t± ls dist/\r\n\r\n\tabout.html\r\n\r\nAm I doing something incorrectly or is this a bug?\r\n\r\nnode v0.10.28\r\ngrunt-cli v0.1.13\r\ngrunt v0.4.4\r\ngrunt-git v0.2.14"},"comment":{"url":"https://api.github.com/repos/rubenv/grunt-git/issues/comments/124877833","html_url":"https://github.com/rubenv/grunt-git/issues/79#issuecomment-124877833","issue_url":"https://api.github.com/repos/rubenv/grunt-git/issues/79","id":124877833,"user":{"login":"whallz","id":842842,"avatar_url":"https://avatars.githubusercontent.com/u/842842?v=3","gravatar_id":"","url":"https://api.github.com/users/whallz","html_url":"https://github.com/whallz","followers_url":"https://api.github.com/users/whallz/followers","following_url":"https://api.github.com/users/whallz/following{/other_user}","gists_url":"https://api.github.com/users/whallz/gists{/gist_id}","starred_url":"https://api.github.com/users/whallz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whallz/subscriptions","organizations_url":"https://api.github.com/users/whallz/orgs","repos_url":"https://api.github.com/users/whallz/repos","events_url":"https://api.github.com/users/whallz/events{/privacy}","received_events_url":"https://api.github.com/users/whallz/received_events","type":"User","site_admin":false},"created_at":"2015-07-25T19:38:19Z","updated_at":"2015-07-25T19:38:19Z","body":"I've found another possible workaroud, which is ugly too:\r\n\r\n```javascript\r\nvar rootPath = process.cwd();\r\n\r\ngrunt.registerTask(\"cd\", function(subpath) {\r\n\r\n\tvar path = require('path');\r\n\r\n\tif(env === 'restore') {\r\n\t\treturn grunt.file.setBase(rootPath);\r\n\t}\r\n\r\n\treturn grunt.file.setBase(path.resolve('my/subdir/' + subpath));\r\n\r\n});\r\n\r\ngrunt.registerTask(\"taskName\", function(env) {\r\n\t\tgrunt.task.run(\"cd:\" + env);\r\n\r\n\t\tgrunt.task.run(\"gitreset:\" + env);\r\n\t\tgrunt.task.run(\"gitpull:\" + env);\r\n\r\n\t\tgrunt.task.run(\"cd:restore\");\r\n\r\n\t\tgrunt.task.run(\"othertasks...\");\r\n});\r\n\r\n```"}}