tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit c60664c3a13fc7ecb80485331fafee56bacf272d
parent 82f667dd75955b22c285fea6f44992a8cd862903
Author: Michael Froman <mjfroman@mac.com>
Date:   Wed, 17 Dec 2025 18:33:48 +0000

Bug 2001715 - add check for proper git config on macOS. r=dbaker DONTBUILD

Differential Revision: https://phabricator.services.mozilla.com/D275117

Diffstat:
Mdom/media/webrtc/third_party_build/run_operations.py | 25+++++++++++++++++++++++++
Mdom/media/webrtc/third_party_build/save_patch_stack.py | 27+++++++++++++++++++++++++++
2 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/dom/media/webrtc/third_party_build/run_operations.py b/dom/media/webrtc/third_party_build/run_operations.py @@ -2,6 +2,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. import os +import platform import subprocess import sys from enum import Enum, auto @@ -174,3 +175,27 @@ def check_repo_status(repo_type): return git_status(".", "third_party/libwebrtc") else: return run_hg("hg status third_party/libwebrtc") + + +def is_mac_os(): + return platform.system() == "Darwin" + + +def git_get_config(config_name, working_dir): + # using run_shell rather than run_git because a config name that is + # unset returns a non-zero error code. + stdout_lines = run_shell(f"cd {working_dir} ; git config {config_name} || true") + line_cnt = len(stdout_lines) + if line_cnt > 1: + print(f"Error: {config_name} returned multiple values ({line_cnt})") + sys.exit(1) + elif line_cnt == 1: + return stdout_lines[0] + return None + + +def git_is_config_set(config_name, working_dir): + config_val = git_get_config(config_name, working_dir) + if config_val is not None and config_val == "true": + return True + return False diff --git a/dom/media/webrtc/third_party_build/save_patch_stack.py b/dom/media/webrtc/third_party_build/save_patch_stack.py @@ -13,7 +13,9 @@ from run_operations import ( RepoType, check_repo_status, detect_repo_type, + git_is_config_set, git_status, + is_mac_os, run_git, run_hg, run_shell, @@ -264,6 +266,28 @@ def save_patch_stack( stdout_lines = run_shell(cmd) +def verify_git_repo_configuration(): + config_help = [ + "This script fails frequently on macOS (Darwin) without running the", + "following configuration steps:", + " git config set feature.manyFiles true", + " git update-index --index-version 4", + " git config set core.fsmonitor true", + "", + "Note: this configuration should be safe to remain set in the firefox", + "repository, and may increase everyday performance. If you would like", + "to revert the effects after using this script, please use:", + " git config unset core.fsmonitor", + " git config unset feature.manyFiles", + ] + if is_mac_os() and not ( + git_is_config_set("feature.manyfiles", ".") + and git_is_config_set("core.fsmonitor", ".") + ): + error_help.set_help("\n".join(config_help)) + sys.exit(1) + + if __name__ == "__main__": # first, check which repo we're in, git or hg repo_type = detect_repo_type() @@ -327,6 +351,9 @@ if __name__ == "__main__": ) args = parser.parse_args() + if repo_type == RepoType.GIT: + verify_git_repo_configuration() + if not args.skip_startup_sanity: # make sure the mercurial repo is clean before beginning error_help.set_help(