Closed Bug 1156388 Opened 9 years ago Closed 9 years ago

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

Categories

(Input :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: lgp171188, Assigned: willkg)

Details

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

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.
On Debian/Ubuntu systems, using /usr/bin/editor would have been a good workaround.
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
Closed: 9 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.