Open Bug 1559446 Opened 6 years ago Updated 3 years ago

Git and HG lint commit hooks disagree about whether to block committing

Categories

(Developer Infrastructure :: Lint and Formatting, enhancement, P3)

enhancement

Tracking

(Not tracked)

ASSIGNED

People

(Reporter: mythmon, Assigned: mythmon)

Details

Attachments

(1 obsolete file)

In Mercurial, setting up the pre-commit hooks installs a hook that prints errors, but does not prevent committing code.

In Git, the equivalent hook does block creating the commit.

This is confusing, and doesn't match the expectations of at least some developers. These should be made more consistent, or at least better documented.

That's strange, git doesn't block for me when creating the commit:

$ git commit -m "temp" -a
/Users/mark/dev/gecko/browser/components/search/SearchTelemetry.jsm
  64:22  error  Parsing error: Unexpected token [  (eslint)

✖ 1 problem (1 error, 0 warnings)
[D34744 78747ae7a678d] temp
 1 file changed, 1 insertion(+), 1 deletion(-)
$ ls -l .git/hooks/pre-commit
lrwxr-xr-x  1 mark  staff  25  6 Jul  2017 .git/hooks/pre-commit -> ../../tools/lint/hooks.py

We originally decided not to block on pre-commit, so that developers could still do the commits and manage their work trees even with issues. We'd only block on push (although that doesn't work at the moment due to moz-phab, bug 1491880).

Flags: needinfo?(mcooper)

Oh, I think I misread the code, and made some assumptions about it. Re-reading it, you're right that it doesn't block. Sorry for the mistake.

My main concern was actually that I want the hooks to (optionally) block, because not blocking is a very surprising thing to me and some other developers I've talked to. Blocking is also how all the other hooks I've worked with outside of mozilla-central work.

Perhaps this bug should be re-summarized, or should be closed and I can file a new one.

Flags: needinfo?(mcooper)

It would be pretty easyl to offer both blocking and non-blocking hooks and let developers choose whichever they want.

I think as long as we keep it status quo for now, as in non-blocking by default, I'm fine with adding blocking options.

Attachment #9072228 - Attachment is obsolete: true
Priority: -- → P3

Sorry, there was a problem with the detection of inactive users. I'm reverting the change.

Assignee: nobody → mythmon
Status: NEW → ASSIGNED
Product: Firefox Build System → Developer Infrastructure
Severity: minor → S4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: