grunt-bump icon indicating copy to clipboard operation
grunt-bump copied to clipboard

Add option to add untracked files before a commit is performed

Open eddiemonge opened this issue 10 years ago • 7 comments

I think if the added files were part of a grunt/glob match then I would feel far more comfortable. Then you can specify which files would be generated that are to be added instead of adding everything blindly.

see https://github.com/vojtajina/grunt-bump/pull/87 for more discussion on the issue

eddiemonge avatar Jan 29 '15 01:01 eddiemonge

I just ran into this issue when following the example of grunt bump-only, grunt changelog, grunt bump-commit. If changelog generates a new file instead of appending, then that file is untracked and not included in the bump-commit operation.

joshuahiggins avatar Apr 15 '15 20:04 joshuahiggins

Create the blank changelog and then commit it. then it will work.

eddiemonge avatar Apr 19 '15 19:04 eddiemonge

I should create a blank file and add it to tracking then run grunt-bump? That's not a solution at all and makes the process manual again, which removes the point of using grunt-bump in the first place.

joshuahiggins avatar Apr 20 '15 12:04 joshuahiggins

its a one time add. It should be a separate commit anyway saying you are adding a changelog. After that, its automated. You might have to add changelog.md to your commitFiles

eddiemonge avatar Apr 21 '15 17:04 eddiemonge

Saying it should be a separate commit is making assumptions about all projects. If we want our vX.XX commit to include nothing more then the version bumped files and a changelog detailing out the work performed in this version, then that's our team's call.

If you're not going to support all files, then take -a out of the examples and only allow Grunt globs. That seems to be the direction you'd like to take anyway.

joshuahiggins avatar Apr 22 '15 16:04 joshuahiggins

-a only adds tracked files with changes, not untracked files. Its a different use case then adding untracked files.

eddiemonge avatar Apr 23 '15 18:04 eddiemonge

In our projects we have auto-generated files and the file name is a unique id based on a SHA of the file contents like "dist/i/f2e4bdcfaeb8aeec3b91d47fd8266c2c7fe4cbdb.png". We therefore cannot add the file ahead of time.

In order to get these files added we do the following as part of our grunt release task:

grunt.task.run('bump-only:' + releaseType);
grunt.task.run('default');
grunt.task.run('gitadd');
grunt.task.run('bump-commit');

The gitadd tasks uses grunt-git to add untracked files in our "dist/" directory:

gitadd: {
    files: {
        src: ['dist/**/*']
    }
}

enure avatar Oct 01 '15 17:10 enure