shipshapecode / ember-cli-release

Ember CLI addon for versioned release management
MIT License
90 stars 18 forks source link

Untracked files added to commit when tree modified #23

Closed avdv closed 8 years ago

avdv commented 8 years ago

I just tried the latest ember-cli-release addon and ran ember release in my working dir.

[?] Your working tree contains modifications that will be added to the release commit, proceed?: Yes

After hitting yes, not only are the modified files added to the commit, but also all untracked files. Very surprising.

I see that you call git add -a and git commit in case the working tree is dirty.

I think you should just use git commit --all which does exactly the right thing, IMO - ie. it adds all changed files to the commit.

rwjblue commented 8 years ago

Ya, I've nearly been bit by this also. I do think we should add all changed files, but untracked ones should stay untracked.

@slindberg - What do you think?

DingoEatingFuzz commented 8 years ago

Is there a chance that a beforeCommit hook may create files on the first release? If so, untracked files would need to be added.

And not to change the subject, but how is it you are prepared to make a release with untracked files in your repo that you don't want? Some more context may help figure out requirements.

rwjblue commented 8 years ago

It is not uncommon for me to keep untracked files in a repo. Often these are things that are not used by all team members (which is why they don't go into .gitignore) and cannot be ignored globally (which is why they can't go into the global .gitignore). Things like small non-versioned scripts, .ember-cli config file so I don't have to supply --port when I have multiple apps going at once, etc.

slindberg commented 8 years ago

I'm not opposed to doing a commit --all, since I can't remember the original use case for adding untracked files. I do think it's good to avoid surprises, and it's certainly better than having to move files out of the repo and back after doing a release (and untracked files can always be added manually by staging them before the release).

@DingoEatingFuzz is correct that adding files in the beforeCommit hook will not end up getting added to the release commit unless shelling out and adding manually. Perhaps passing a git object to the hooks with a minimal API will ease this if it becomes a problem in the future.