Commit message validation hook errors out if EDITOR environment variable is not set

RESOLVED FIXED

Status

Input
General
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: L. Guruprasad, Assigned: willkg)

Tracking

Details

(Whiteboard: u=contributor c=codequality p=1 s=input.2015q2)

(Reporter)

Description

3 years ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Firefox/31.0 Iceweasel/31.6.0
Build ID: 20150331233809

Steps to reproduce:

Do a commit in the vagrant VM without having the EDITOR environment variable set


Actual results:

Linting the commit message...
Traceback (most recent call last):
  File "./bin/lint_commit_msg.py", line 142, in <module>
    editor = os.environ['EDITOR']
  File "/home/vagrant/.virtualenvs/fjordvagrant/lib/python2.7/UserDict.py", line 23, in __getitem__
    raise KeyError(key)
KeyError: 'EDITOR'



Expected results:

Should have caught the exception and instead used an editor known to be installed on a Linux system like nano or vi.
(Reporter)

Comment 1

3 years ago
On Debian/Ubuntu systems, using /usr/bin/editor would have been a good workaround.
(Reporter)

Comment 2

3 years ago
As discussed on #input, asking the user to set the EDITOR environment variable if it doesn't exist instead of erroring out would be a good fix to this issue.
We talked about this on IRC.

I'll fix it so that if EDITOR isn't in the environment, we'll get into the loop and treat it as if the user typed "i" for ignore. We'll tell the user to set EDITOR in the environment. We'll also walk the user through how to edit the commit message using "git commit --amend".
Assignee: nobody → willkg
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Whiteboard: u=contributor c=codequality p= s=input.2015q2
Landed in: https://github.com/mozilla/fjord/commit/0576150681b1dda85ea5040a1a7c3b1f5c404702

This isn't related to server environments, so I'm closing it out.
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Whiteboard: u=contributor c=codequality p= s=input.2015q2 → u=contributor c=codequality p=1 s=input.2015q2
You need to log in before you can comment on or make changes to this bug.