lindell / multi-gitter

Update multiple repositories in with one command
Apache License 2.0
851 stars 63 forks source link

Sometimes, .gitignore is not respected and files listed in .gitignore are included in the commits created by multi-gitter #356

Open andyren0110 opened 1 year ago

andyren0110 commented 1 year ago

Describe the bug I don't know how to produce a minimum repro. But I used multi-gitter to make some changes in about 30 repos, and ran yarn install, and then commit the changes. In some of the PRs it created, node_modules folder is included. node_modules are added to all the repos .gitignore. I checked out those branches, did a git reset HEAD~ and then commit all the changes again, node_modules files are no long included in the commit. I'm wondering how multi-gitter commits changes? Does it sometimes use a -f flag when committing the changes with git commit?

Expected behavior Changes resulted from running a script but are explicitly listed in .gitignore should not be included in the PR created by multi-gitter.

Additional context Add any other context about the problem here. It is for example often useful to include detailed logs from a run with --log-level=trace.

lindell commented 1 year ago

Thanks for the bug report, but without any repro, it will be hard to solve, or even verify if it actually is a problem. Maybe it does repro with some specific git ignore files that you can share?

I still have two questions.

  1. Does this also happen when running with --git-type=cmd
  2. Does it always happen on the same repos?
andyren0110 commented 1 year ago

Totally understand that it's hard to solve without a repro. Let me try to work on a minimal repro. I read somewhere that having multiple .gitignore could cause issues and indeed all these repos have multiple .gitignore files. Regarding your questions:

  1. Let me try that.
  2. It doesn't. It's a different set of repos that get node_modules included in the PR in different runs.
lindell commented 1 year ago

Any progress on a minimal set of .gitignore that sometimes repro this, and/or running it with --git-type=cmd?

andyren0110 commented 1 year ago

Yes. --git-type=cmd fixed the issue.

I don't have a minimal repro yet. Still working on it.

lindell commented 1 year ago

@andyren0110 Any update on this?

lindell commented 11 months ago

@andyren0110 Any update on this?

lindell commented 10 months ago

@andyren0110 Any update on this?

nwsparks commented 4 months ago

git-xargs had/has the same problem https://github.com/gruntwork-io/git-xargs/issues/53

this leads me to believe it is a problem with go-git. a quick search in the issues there reveals quite a few problems around gitignore unfortunately. seems like changing --git-type or appending git clean -fxd / -fXd to the end of scripts are the best options if it is happening.