jgm / gitit

A wiki using HAppS, pandoc, and git
GNU General Public License v2.0
2.16k stars 226 forks source link

Display error message when commit fails (due to pre-commit hook) #567

Open raphael-proust opened 8 years ago

raphael-proust commented 8 years ago

If a pre-commit hook is used, edits on the website may fail. When this is the case, the page simply doesn't update on “Save”, but it is not made clear to the person who tried to edit the page. Could gitit check the return code of the commit action (I'm not sure exactly how gitit performs the commit)

Ideally, the output of the pre-commit hook should be displayed (if any) along with a failure notice (if the exit code is not 0). Alternatively, a simple, generic error message would already be useful.

Should I look into adding this feature? Would that better be handled as a plugin? (Would a plugin have access to all the same info as a git hook?)

jgm commented 8 years ago

I believe gitit does check the return status of the git commit command (which runs the pre-commit hook). I am surprised that the git commit would succeed if the pre-commit hook fails.

+++ Raphaël Proust [Sep 08 16 01:39 ]:

If a pre-commit hook is used, edits on the website may fail. When this is the case, the page simply doesn't update on “Save”, but it is not made clear to the person who tried to edit the page. Could gitit check the return code of the commit action (I'm not sure exactly how gitit performs the commit)

Ideally, the output of the pre-commit hook should be displayed (if any) along with a failure notice (if the exit code is not 0). Alternatively, a simple, generic error message would already be useful.

Should I look into adding this feature? Would that better be handled as a plugin? (Would a plugin have access to all the same info as a git hook?)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, [1]view it on GitHub, or [2]mute the thread.

References

  1. https://github.com/jgm/gitit/issues/567
  2. https://github.com/notifications/unsubscribe-auth/AAAL5AZAdYJW0h4CFRwOdVSKAnkorph1ks5qn8nHgaJpZM4J3vsq
raphael-proust commented 8 years ago

The git commit does fail when the hook exits with non-zero. The issue is with the feedback to the person editing the wiki: there isn't any. The page is not updated, but the person editing the page doesn't receive a message telling them it failed.

jgm commented 8 years ago

OK, I see. It ought to give you a message. I don't have time to look into this now, though.

+++ Raphaël Proust [Sep 12 16 07:37 ]:

The git commit does fail when the hook exits with non-zero. The issue is with the feedback to the person editing the wiki: there isn't any. The page is not updated, but the person editing the page doesn't receive a message telling them it failed.

— You are receiving this because you commented. Reply to this email directly, [1]view it on GitHub, or [2]mute the thread.

References

  1. https://github.com/jgm/gitit/issues/567#issuecomment-246368173
  2. https://github.com/notifications/unsubscribe-auth/AAAL5GfR8CyJt3InnONbH0dbKr3KYU1tks5qpWOpgaJpZM4J3vsq
raphael-proust commented 8 years ago

I'll check if it's a version thing. Or if I need to pipe the message to stdin rather than stderr in the hook. Will report back in a bit.