Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Add advice to "Files were modified…" error #1031
Conversation
| output.write('Files were modified by this hook.') | ||
| output.write('Files were modified by this hook.' \ | ||
| 'Please review them in Git\'s staging area, ' \ | ||
| 'and repeat the commit.') |
asottile
May 12, 2019
Member
seems fine to add more context here
maybe something like this?
output.write(
'Files were modified by this hook. '
'Review the changes, `git add`, and repeat the commit.',
)
hmmm, but it's not terribly uncommon for this message to show multiple times with lots of fixers (it's a bit redundant in that case) and now it'll wrap on narrow terminals 🤔
(the change won't be in the staging area, but will need to be added there)
seems fine to add more context here
maybe something like this?
output.write(
'Files were modified by this hook. '
'Review the changes, `git add`, and repeat the commit.',
)hmmm, but it's not terribly uncommon for this message to show multiple times with lots of fixers (it's a bit redundant in that case) and now it'll wrap on narrow terminals
(the change won't be in the staging area, but will need to be added there)
|
tl;dr I'm on the fence, it seems like a good idea but also seems a little verbose? |
|
True. Would a separate, final message be better, to avoid redundancy in case several files are modified? |
Ooh yeah that's a good idea, we already do something similar for There's a perf improvement that I've been meaning to make here as well, right now execution looks roughly like this:
But it could look like this:
with that second patern, it would be easy to compare the initial diff against the last returned diff to see if there was any changes across the whole set of hooks |
|
I think the work in #1566 will make this easier to accomplish |
Would it make sense to include something like this? If yes, please let me know whether the formatting for a string that should not be too long in the source code, but single-line in the out-put is correct.
Afterwards, I'll: