Skip to content

Conversation

@dzbarsky
Copy link
Contributor

Before:
image

After:
image

"""
if not file.is_source:
if file.path.startswith(file.root.path + "/"):
# TODO(zbarsky): is this always the case?
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that this should always be true and we can unconditionally strip the root path with slash. But I wanted to guarantee parity with the former native implementation, which did this.

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 don't have a strong opinion, though I think as-written the PR is guaranteed not to change the behavior because it checks before stripping. Simplifying it to just strip and dropping the lines below would be a pretty minimal speedup compared to what this already achieves

Copy link
Collaborator

@armandomontanez armandomontanez Nov 26, 2025

Choose a reason for hiding this comment

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

I can approve this if you can do some double checking so we can confidently remove this TODO.

Edit: Or update the comment to include reasons/sources of uncertainty.

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 also feel like this should always be true but wasn't sure if Google had any internal weirdness that made the previous impl necessary - didn't want to mix a perf improvement with a potential semantic change. But given the import process will make sure google3 is happy anyway, we can give it a shot! Updated

Copy link
Collaborator

Choose a reason for hiding this comment

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

@dzbarsky dzbarsky force-pushed the zbarsky/root_relative_path branch from 210737e to 0119ae8 Compare November 28, 2025 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants