Skip to content

Enhancing pre-commit bash script documentation.#3638

Merged
azz merged 7 commits intoprettier:masterfrom
migrachev:master
Feb 24, 2018
Merged

Enhancing pre-commit bash script documentation.#3638
azz merged 7 commits intoprettier:masterfrom
migrachev:master

Conversation

@migrachev
Copy link
Copy Markdown
Contributor

As discussed in the issue, here is my proposition of the documentation enhancement.

Comment thread docs/precommit.md Outdated
exit 0
```

In case you experience a problem causing your prettified files to appear modified according to git. You may also need a post-commit script in `.git/hooks/pre-commit` as described in [this issue](https://github.com/prettier/prettier/issues/2978#issuecomment-334408427).
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

.git/hooks/post-commit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, corrected.

Comment thread docs/precommit.md Outdated
exit 0
```

In case you experience a problem causing your prettified files to appear modified according to git. You may also need a post-commit script in `.git/hooks/post-commit` as described in [this issue](https://github.com/prettier/prettier/issues/2978#issuecomment-334408427). Here is the code of the post-commit hook:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Slight grammar tweak, maybe something like:

If git is reporting that your prettified files are still modified after committing, you may need to add a post-commit script to update git's index as described in this issue.

Add something like the following to .git/hooks/post-commit:

#!/bin/sh
git update-index -g
exit 0

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍

Comment thread docs/precommit.md Outdated
If git is reporting that your prettified files are still modified after committing, you may need to add a post-commit script to update git's index as described in [this issue](https://github.com/prettier/prettier/issues/2978#issuecomment-334408427).

In case you experience a problem causing your prettified files to appear modified according to git. You may also need a post-commit script in `.git/hooks/post-commit` as described in [this issue](https://github.com/prettier/prettier/issues/2978#issuecomment-334408427). Here is the code of the post-commit hook:
Add something like the following to .git/hooks/post-commit:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you mark up .git/hooks/post-commit as `code`?

Mark .git/hooks/post-commit as ```code```
Comment thread docs/precommit.md Outdated
If git is reporting that your prettified files are still modified after committing, you may need to add a post-commit script to update git's index as described in [this issue](https://github.com/prettier/prettier/issues/2978#issuecomment-334408427).

Add something like the following to .git/hooks/post-commit:
Add something like the following to ```.git/hooks/post-commit```:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you just need one ` on each side (`.git/hooks/post-commit`).

Comment thread docs/precommit.md Outdated
```bash
#!/bin/sh
git update-index -g
exit 0
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

exit 0 shouldn't be required, it's the default for a terminating script.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Corrected. I tested it for several commits it works as expected.

@azz azz merged commit 29ef3f0 into prettier:master Feb 24, 2018
@lock lock Bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jan 18, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants