Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Skip installing .revision-hash if not running
make install
from a git checkout #723base: master
Are you sure you want to change the base?
Skip installing .revision-hash if not running
make install
from a git checkout #723Changes from all commits
2160c2d
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The incumbent code always creates .revision-hash; the PR does not. Should it?
This would manifest when running
make install
in a release tarball, for example.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so. The only place that .revision-hash is used is when defining ZSH_HIGHLIGHT_REVISION modified else-patch. There are three cases.
ZSH_HIGHLIGHT_REVISION=HEAD
)make install
'd from a git checkout copy (ZSH_HIGHLIGHT_REVISION=revision_id
)make install
'd from a non-git checkout copy (with PRZSH_HIGHLIGHT_REVISION
is not set; previouslyHEAD
)ZSH_HIGHLIGHT_REVISION=HEAD
doesn't give any extra information; however, it's an extra file to install and does cost a bit of time to do the pattern match in zsh-syntax-highlighting.zsh. Further since the third case should only happen from a release tarball,ZSH_HIGHLIGHT_VERSION
should be sufficient to know which version of the code is in use.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Factually wrong:
Wait, are you saying that the test
[[ $ZSH_HIGHLIGHT_REVISION == \$Format:* ]]
accounts for a measurable fraction of the start-up time? That'd be quite surprising. Perhaps it's the glob operator that slows it down? Is either[[ ${ZSH_HIGHLIGHT_REVISION[1,8]} == \$Format: ]]
or[[ ${ZSH_HIGHLIGHT_REVISION[1,8]} =~ '\$Format:' ]]
faster the incumbent code?We can't just use that substring trick without further ado because it breaks under KSH_ARRAYS. (That's another form of #688. I have a pending fix for that issue, but that fix should be merged after redrawhook in order to not confuse
git merge
.)I see your point, but I'm not sold. Right now, there's an invariant that
git show $ZSH_HIGHLIGHT_REVISION
will always DTRT regardless of whether one is in case 1/2/3. That's also useful when doing support: I can ask someone toecho $ZSH_HIGHLIGHT_REVISION
and it will always DTRT regardless of how they got z-sy-h. One, short command. Making that variable undefined in one case would break these.Circling back to your original issue
$ZSH_HIGHLIGHT_REVISION
having a wrong value aftermake install
from within another git repository, how about another approach:It's based on your fix, but I edited the changelog entry to use
$ZSH_HIGHLIGHT_REVISION
, which is the public API term.That leaves the pattern match in the driver, though. I'd be surprised if it's actually a performance hot spot, but if it is, let's handle it.
Hope this doesn't come across as bikeshedding — that's not my intention.