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

tools,build: .gitignore tweaks #17380

Closed
wants to merge 3 commits into from
Closed

Conversation

refack
Copy link
Contributor

@refack refack commented Nov 28, 2017

Using git ls-files -i --exclude-standard to find tracked files that match ignore patterns.

Before

https://gist.github.com/refack/62edafbbc788783ca9a7b8ee8354ae1c

After

deps/v8/test/mjsunit/tools/profviz-test.log
deps/v8/test/mjsunit/tools/tickprocessor-test-func-info.log
deps/v8/test/mjsunit/tools/tickprocessor-test.log
tools/doc/package-lock.json
tools/remark-cli/package-lock.json
tools/remark-preset-lint-node/package-lock.json

The mismatch with package-lock.json files is fixed in #17330

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

tools,build

@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Nov 28, 2017
Copy link
Contributor

@MylesBorins MylesBorins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handful of questions that I think repeat throughout the document

I'll dig through again after getting answers to the first bit

!test/fixtures/**/.*
!tools/eslint/**/.*
!tools/doc/node_modules/**/.*
!deps/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm guessing this would trump #17363

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll check. exclusion rules seem to be tricky (CSS style), but I think these are stronger:

node/.gitignore

Lines 111 to 120 in a84f58d

# npm stuff
node_modules
package-lock.json
!/deps/npm/node_modules**
/deps/npm/node_modules/node-gyp/gyp/**/*.pyc
!/tools/eslint/node_modules**
!/tools/doc/node_modules**
!/test/fixtures/**
# not needed and causes issues for distro packagers
/deps/npm/node_modules/.bin/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it at the very least be at the bottom to avoid other rules combatting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I saw while testing is that most of the rules below apply for /deps (only conflict is debug/release), so IMO it makes sense to keep it up here.

@@ -24,9 +22,8 @@ perf.data.old
tags
.lock-wscript
*.pyc
doc/api.xml
/doc/api.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean why was this not an absolute path? This PR makes it one right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made all relative paths absolute, since we have all sorts of path patterns deeper in the tree.

.gitignore Outdated
!/deps/v8/src/base/debug
!/deps/v8/src/debug
/deps/v8/src/debug/obj
deps/v8/src/inspector/Debug/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are whitelisting all of deps/ above do we need to do this here?
Also should we be ignoring anything in the deps tree at all? this seems odd to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because the debug/ pattern re-ignores all paths that have it in anywhere in the path. So we need to do a checkerboard.

  1. ignore `/debug/
  2. exclude the 3 listed dirs explicitly
  3. but ignore build artifacts within them

Probably should try to upstream renaming those directories from debug to something like debugSrc

RE: the last one I'll double check.

@MylesBorins
Copy link
Contributor

MylesBorins commented Nov 29, 2017

Should we simply move !deps/ to the bottom? Should we be ignoring anything in the deps folder?

@@ -24,9 +22,8 @@ perf.data.old
tags
.lock-wscript
*.pyc
doc/api.xml
/doc/api.xml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean why was this not an absolute path? This PR makes it one right?

@refack
Copy link
Contributor Author

refack commented Nov 29, 2017

General comments:

  • I made all relative paths absolute, since we have all sorts of path patterns deeper in the tree.
  • Can't wildcard exclude /deps/** since building put artifacts within the /deps/ tree, so we need to do some checkerboarding

@MylesBorins
Copy link
Contributor

@refack could we explicitly whitelist deps here and put a .gitignore in the deps folder to ignore the specific build artifacts? That seems a bit cleaner and less error prone

Copy link
Contributor

@MylesBorins MylesBorins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I agree with how we are currently white listing the deps folder. I'd like to see a response to my earlier comment about whitelisting all of deps and introducing a new .gitignore in the deps/ directory

@refack refack added the wip Issues and PRs that are still a work in progress. label Nov 30, 2017
@refack
Copy link
Contributor Author

refack commented Nov 30, 2017

could we explicitly whitelist deps here and put a .gitignore in the deps folder to ignore the specific build artifacts? That seems a bit cleaner and less error prone

It's the classical single-point-of-change vs. modularity issue...
My main concern is that git still lacks good exclusion traceability, i.e. it's not easy to correlate an actual exclusion with a .gitignore rule. So tracking them down in multiple files will increase that challenge.

AFAICT most of the noise in this file is due to debug/release directories created during build, I'll try to figure out a better strategy to handle those. That might simplify this file extensively.

@MylesBorins
Copy link
Contributor

MylesBorins commented Nov 30, 2017 via email

@refack
Copy link
Contributor Author

refack commented Nov 30, 2017

Since solving the debug release issue might take a while, i've refactored the deps patterns into /deps/.gitignore, so we can have something in the meanwhile.

@refack refack removed the wip Issues and PRs that are still a work in progress. label Nov 30, 2017
@MylesBorins
Copy link
Contributor

MylesBorins commented Nov 30, 2017 via email

/openssl/openssl.targets
/openssl/openssl.xml

!/npm/node_modules**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be !/npm?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other files in /deps/npm aren't ignores by any other rule, only node_modules is. So this is the minimal glob needed.

!test/fixtures/**/.*
!tools/eslint/**/.*
!tools/doc/node_modules/**/.*
!deps/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it at the very least be at the bottom to avoid other rules combatting it?

@MylesBorins MylesBorins dismissed their stale review November 30, 2017 09:44

Not longer needs to block, not ready to sign off just yet

@gibfahn
Copy link
Member

gibfahn commented Nov 30, 2017

It's the classical single-point-of-change vs. modularity issue...
My main concern is that git still lacks good exclusion traceability, i.e. it's not easy to correlate an actual exclusion with a .gitignore rule. So tracking them down in multiple files will increase that challenge.

FWIW I'd rather we have a single file. Yes it might look complex, but you don't have to worry about how rules in different files affect each other.

@MylesBorins
Copy link
Contributor

Just hit an edge case on my machine

I gitignore global node_modules/... which in turn can trump our .gitignore in the project. Is there a way using .gitignore in the project to ensure that we trump rules in globalgitignore?

@refack
Copy link
Contributor Author

refack commented Dec 4, 2017

According to the git manual our .gitignore should trump core.excludesfile - https://git-scm.com/docs/gitignore, so I'd assume the patterns in this PR should work (starts with ignoring all node_modules then explicitly exclude the ones we track)

BTW: I've found the command to trace an ignored file to it's exclude rule - git check-ignore -v --no-index THE_IGNORED_FILENAME

@BridgeAR
Copy link
Member

This needs a rebase @refack

@BridgeAR
Copy link
Member

BridgeAR commented Feb 7, 2018

Ping @refack again

@BridgeAR
Copy link
Member

I am closing this due to the long inactivity. @refack please feel free to reopen in case you would like to work on this again!

@BridgeAR BridgeAR closed this Feb 16, 2018
@refack refack deleted the git-ignore-tweaks branch September 5, 2018 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta Issues and PRs related to the general management of the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants