-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with gitcommit for a repository in a sub-directory #79
Comments
I've now tried the same with v0.3.0-alpha and got similar results with the |
Hi, got the same problem. Any idea when it would be resolved? regards |
Thank you for bringing this up. I've traced the issue to lib/command_commit.js, which references each file's
and the grunt files directive that you've supplied: files: [{
expand: true,
cwd: 'dist',
src: ['**/*']
}] The resulting files array for the task will look like this: [{ src: [ 'dist/foo.html' ],
orig: { expand: true, src: [ '**/*' ] },
dest: 'foo.html' }] I would expect the The solution may be to use the file's I will continue investigating, and submit a fix when I'm confident in the solution. |
Has anyone found a workaround for this in the meantime? |
This is because the grunt file API returns paths relative to the Gruntfile, Respectfully, On Tue, Dec 16, 2014 at 10:53 PM, Peter Sieg notifications@github.com
|
@dylancwood thanks for your work on this! I found a workaround yesterday that I will use until this is solved. For anyone needing an immediate workaround solution, you can use grunt.util.spawn to run git commands: grunt.registerTask('gitcommitworkaround', '', function() {
var done, child;
done = this.async();
child = grunt.util.spawn({
cmd: 'git',
args: ['-C', 'the/path/to/your/subdirectory', 'commit', '-m', 'This is a commit message.'],
}, function(err, result, code) {
done();
});
child.stdout.pipe(process.stdout);
child.stderr.pipe(process.stderr);
}); |
any news on this issue? grunt is still giving us the cwd relative to the gruntfile? |
I've found another possible workaroud, which is ugly too, this issue affects all grunt-git tasks, not just gitcommit: var rootPath = process.cwd();
grunt.registerTask("cd", function(subpath) {
var path = require('path');
if(env === 'restore') {
return grunt.file.setBase(rootPath);
}
return grunt.file.setBase(path.resolve('my/subdir/' + subpath));
});
grunt.registerTask("taskName", function(env) {
grunt.task.run("cd:" + env);
grunt.task.run("gitreset:" + env);
grunt.task.run("gitpull:" + env);
grunt.task.run("cd:restore");
grunt.task.run("othertasks...");
}); |
I'm attempting to use
gitcommit
against a repository in a sub-directory within my project. Thecwd
option doesn't seem to be working properly.My
gitcommit
task looks like this:And when I run it, I get something like this:
Or, with verbose mode:
It appears that the
dist/
portion is still being included despite mycwd
, given that the file is in the appropriate location:Am I doing something incorrectly or is this a bug?
node v0.10.28
grunt-cli v0.1.13
grunt v0.4.4
grunt-git v0.2.14
The text was updated successfully, but these errors were encountered: