Skip to content
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

latest release breaks changelog commit (note, this issue seems to potentially be related to dotgitignore) #231

Closed
cludden opened this issue Jan 7, 2018 · 25 comments

Comments

@cludden
Copy link

cludden commented Jan 7, 2018

error:

$ standard-version
✔ outputting changes to CHANGELOG.md
✔ committing CHANGELOG.md
Command failed: git commit CHANGELOG.md -m "chore(release): 1.0.0"

Command failed: git commit CHANGELOG.md -m "chore(release): 1.0.0"

rolling back to 4.2.0 fixes issue

@bcoe bcoe added the bug label Jan 9, 2018
@bcoe
Copy link
Member

bcoe commented Jan 9, 2018

git commit CHANGELOG.md -m "chore(release): 1.0.0" looks like a valid command, any chance you could try upgrading again and see if the problem continues -- we might need to add some more debug information.

@bcoe
Copy link
Member

bcoe commented Jan 15, 2018

@Tapppi @nexdrew @Tapppi, don't suppose any of you have bumped into bugs like this on the latest release? seems to have been working okay on a few of my projects.

@nexdrew
Copy link
Member

nexdrew commented Jan 15, 2018

From the output given in the OP, it looks like you're skipping the "bump" step (because the first line is "outputting changes to CHANGELOG.md" instead of "bumping version in package.json"), which happens if you use a CLI command like standard-version --skip.bump true or if you configure standard-version in your package.json like this:

{
  "standard-version": {
    "skip": {
      "bump": true
    }
  }
}

Since the OP doesn't pass any flags to standard-version, I presume the latter.

In my local testing, I also see this problem when skipping the "bump" step, but I see it when using version 4.2.0 as well. We have this test for skipping "bump" and "changelog" together, which looks like it should fail (via rejected promise) if the test has this problem (and I don't think the test fails), but I run into the failed "git commit CHANGELOG.md" command no matter what else I pass when skipping the "bump" step, so I'm not sure what's going on.

That's all I've found so far. Hopefully this gets us one step closer to the root problem (and solution). In the meantime, @cludden can you please confirm that your package.json is configuring standard-version to skip the "bump" step?

@cludden
Copy link
Author

cludden commented Jan 16, 2018

@nexdrew I'm using standard-version as a global npm install, and running as

$ standard-version --release-as major

The package.json from the project that I pasted the output above from does not have a standard-version attribute

@bcoe
Copy link
Member

bcoe commented Jan 17, 2018

@cludden interesting, perhaps there's a bug related specifically to global behavior; we'll need to dig into this.

@bcoe
Copy link
Member

bcoe commented Jan 17, 2018

@cludden I believe I see the issue; do you have package.json in your .gitignore? the problem seems to crop up when package.json isn't committed, as a result of us now respecting .gitignore; quite odd.

@matheo
Copy link

matheo commented Jan 27, 2018

@bcoe I found a conflict with the Lifecycle scripts, being parsed by git as git-hooks because I was using husky. The "standard-version.precommit" was executed on every commit, and well, that's annoying.
Basically, it's a problem of the .git/hooks/ scripts to detect hooks in the package.json, a shame :(

@cludden
Copy link
Author

cludden commented Jan 27, 2018

@bcoe sorry for the late response. package.json is not included in the .gitignore file

@hugomrdias
Copy link

i ran into this with just "release": "standard-version", in the package.json and running npm run release

@denouche
Copy link

Same problem for me.
In my case the package.json is included in the .gitignore, and the changelog is never outputed with the 4.3.0

@jboothe
Copy link

jboothe commented Oct 17, 2018

Having same issue with 4.3.0, upgraded to 4.4.0 and still have same issue with:
standard-version --preset angular --release-count 0 "--release-as-patch"
I receive the following error:

Command failed: git commit CHANGELOG.md -m "chore(release): 1.9.7"

Command failed: git commit CHANGELOG.md -m "chore(release): 1.9.7"

Error is outputted twice.
Rolling to 4.2.0 fixed the issue for me as well.

@simonfox
Copy link

simonfox commented Mar 12, 2019

I just got this issue on 5.0.1.

Using global standard-version install (via yarn) with no package.json config.

We would normally remove the tag prefix via standard-version -t "" and this causes the above. If I run without the prefix flag - standard-version - it works, but it did --skip-bump without it being set .

This is only on a specific project as well - same install works fine on a different project. The project that fails is actually a dotnet project so the project.json is very simple - it has name, version, description, repository, author, license, bugs, homepage properties set. The .gitignore is the default from GitHub for Visual Studio projects.

@bcoe bcoe added the triaged label Mar 12, 2019
@bcoe
Copy link
Member

bcoe commented Mar 12, 2019

@simonfox any chance you could provide a link to a GitHub repo that minimally reproduces this issue? or even better a failing test case. Happy to try to help dig into this, but have been unable to reproduce this issue on any of my own projects.

@simonfox
Copy link

simonfox commented Mar 12, 2019

OK odd - just copied source of problematic project to a new folder and did git init to start putting a repro together and then tested standard-version -t "" and it worked just fine!

So I dumped the problematic project and re-cloned and all working fine in there as well. Something in .git is somehow messing with standard-version?

cc @bcoe

@simonfox
Copy link

@bcoe actually apologies it's definitely acting wierd....this seems to break - https://github.com/simonfox/sv-repro

image

@bcoe
Copy link
Member

bcoe commented Mar 13, 2019

@simonfox fascinating, did you potentially have any git hooks configured is a thought?

https://medium.com/the-andela-way/git-hooks-beautifully-automate-tasks-stages-bfb29f42fea1

can we close this potentially?

@simonfox
Copy link

@bcoe no hooks configured...does my repro not fail for you?

I've just used repro (linked above ☝️ ) to confirm there is definitely oddness - bump step is skipped for some reason:

image

@simonfox
Copy link

@bcoe ok sorry this seems to be a different issue related to the change to respect .gitignore

Problematic lines are comment lines
https://github.com/simonfox/sv-repro/blob/98333c6d619895c71b45cd275e03cf606b6d5a52/.gitignore#L168
and
https://github.com/simonfox/sv-repro/blob/98333c6d619895c71b45cd275e03cf606b6d5a52/.gitignore#L279

I've traced the issue back the dotgitignore version that standard-version is using. If I update dotgitignore to the very latest commit (currently bafd1e0) it works fine (2.0.1 doesn't work either). Looks like it is the minimatch usage in previous versions that is incorrect.

Hope that helps!

@bcoe
Copy link
Member

bcoe commented Mar 15, 2019

@simonfox this is a big help, would you mind submitting a patch with the latest version of dotgitignore? I can work on getting a new release out ASAP.

@bcoe bcoe changed the title latest release breaks changelog commit latest release breaks changelog commit (note, this issue seems to potentially be related to dotgitignore) Mar 15, 2019
@simonfox
Copy link

simonfox commented Mar 15, 2019

@bcoe sure can - need latest on dotgitignore to be released first though as current release (2.0) does not solve the issue.

@bcoe
Copy link
Member

bcoe commented Mar 16, 2019

@simonfox tried to release dotgitignore, interestingly it actually has the bug described in this issue (I think for slightly different reasons than described here); will try to dig into it this weekend.

@bcoe bcoe closed this as completed in 3593b5a Mar 16, 2019
@bcoe
Copy link
Member

bcoe commented Mar 16, 2019

@simonfox I've gone ahead and published the newer dotgitignore, I believe it should address the issues you were bumping into.

@simonfox
Copy link

simonfox commented Mar 19, 2019

@bcoe thanks confirming latest release fixes the issue that I was hitting.

@huchenme
Copy link

huchenme commented May 3, 2019

@bcoe Seems this issue still not resolved in 5.0.2, which contains latest dotgitignore

@bcoe
Copy link
Member

bcoe commented May 3, 2019

@huchenme mind opening a new issue, ideally with a repo that reproduces your issue; hopefully we can figure out the remaining causes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

9 participants