Closed Bug 1906082 Opened 1 year ago Closed 1 year ago

L10n lint setup fails when called from git hooks

Categories

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

Tracking

(firefox129 fixed)

RESOLVED FIXED
129 Branch
Tracking Status
firefox129 --- fixed

People

(Reporter: standard8, Assigned: standard8)

Details

Attachments

(1 file)

I've been noticing this problem for a bit, but only just got around to figuring it out.

STR

  1. Have a git cinnabar repository set up for mozilla-unified.
  2. Install the git hooks for the repository.
  3. Trigger the lint setup so that ~/.mozbuild/l10n-source gets installed.
  4. At least couple of days later, create a commit or apply a phab patch that will trigger the l10n lint setup.

Expected Results

L10n source directory is set-up correctly and lint is checked.

Actual Results

From https://github.com/mozilla-l10n/firefox-l10n-source
 * branch                HEAD       -> FETCH_HEAD
Updating 46e4be1e7..c6a3b3efe
error: Your local changes to the following files would be overwritten by merge:
	_data/master.json
        ...
Please commit your changes or stash them before you merge.
Aborting
Traceback (most recent call last):
  File "/Users/mark/dev/gecko/python/mozlint/mozlint/roller.py", line 234, in setup
    res = findobject(linter["setup"])(
  File "/Users/mark/dev/gecko/tools/lint/python/l10n_lint.py", line 108, in source_repo_setup
    check_call([git, "pull", L10N_SOURCE_REPO], cwd=gs)
  File "/opt/homebrew/Cellar/python@3.9/3.9.19/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/homebrew/opt/git/libexec/git-core/git', 'pull', 'https://github.com/mozilla-l10n/firefox-l10n-source.git']' returned non-zero exit status 1.
error: problem with lint setup, skipping android-api-lint, android-checkstyle, android-format, android-javadoc, android-lint, android-test, l10n

I've tracked the issue down to this being triggered within the hooks process for git. I think the subprocess is seeing the GIT_INDEX_FILE environment variable from the git process that's triggering the hook, and it is getting confused as to which repository is being used.

If I delete that environment variable before the subprocess is run, then it seems to work fine.

Pushed by mbanner@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c29caab8dace Fix calling the L10n linter setup from the git hooks. r=linter-reviewers,sylvestre
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: