Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Run installer Git from a short view with core.longpaths set on every call

Bowen Xue70f523dce0cf
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index c8f6a73..28194a4 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -31,7 +31,7 @@ from .install_tuning import build_parallelism, required_models, cache_compatible
from .terminal_ui import TerminalUI, LogProgress
from .locking import runtime_lock, LOCK_ENV
from .environments import (ENVIRONMENTS, environment_names, select_layout, role_pythons, constraints_file,
- bootstrap_versions, uv_file_arguments, uv_build_environment)
+ bootstrap_versions, uv_file_arguments, uv_build_environment, git_long_path_environment)
from . import disk_space
from . import network
from . import processes
@@ -1407,6 +1407,9 @@ class Installer:
env = dict(env, FREEVIDEO_INSTALL_PROGRESS='1')
args, cwd = uv_file_arguments(args, cwd)
env = uv_build_environment(args, self.root, env)
+ if label == 'vdn-source':
+ # Its Git folders are made below a deep root; see git_long_path_environment.
+ env = git_long_path_environment(self.root, env)
with self.state_lock:
index = len(self.state['steps'])
log = self.run_dir / ('%02d-%s.log' % (index, label))
diff --git a/freevideo_engine/environments.py b/freevideo_engine/environments.py
index 276df74..5f727fd 100644
--- a/freevideo_engine/environments.py
+++ b/freevideo_engine/environments.py
@@ -36,37 +36,53 @@ UV_FILE_LIST_OPTIONS = frozenset(('-c', '--constraint', '--constraints', '-b', '
UV_BUILD_PATH_CHARS = 200
-def uv_build_environment(command, root, environ):
- """Windows uv pip builds use a short view of the existing cache and scratch.
+# Git creates and enters its own folders with the ordinary 259-character limit
+# even when core.longpaths lets it write deep files. Reserve the clone folder,
+# its ".partial-<ns>" name and the longest object path below it.
+GIT_PATH_CHARS = 140
- TEMP alone does not move uv's sdist source tree or isolated build venv.
- Mark only this child's view: processes.popen translates its paths, while
- installation settings, cache ownership and the parent's environment stay put.
- """
- if (not command or Path(command[0]).name.lower() not in ('uv', 'uv.exe')
- or list(command[1:2]) != ['pip']):
- return environ
+
+def _short_view(root, environ, reserve):
+ """The view that leaves `reserve` characters below `root`, or None when none can be had."""
from . import launch_view, runtime_alias
- from .long_paths import io_path, path_chars, plain
+ from .long_paths import path_chars, plain
from .package_paths import WINDOWS_PATH_LIMIT
- from .triton_compat import TEMP_KEYS, TEMP_ROOT_ENV, _writable_temporary
if not runtime_alias._backend.windows():
- return environ
+ return None
root = Path(os.path.abspath(plain(root)))
view = launch_view.current(environ)
if (view is None or not root.is_relative_to(view.real)
- or path_chars(launch_view.value(root, view)) + 1 + UV_BUILD_PATH_CHARS > WINDOWS_PATH_LIMIT):
+ or path_chars(launch_view.value(root, view)) + 1 + reserve > WINDOWS_PATH_LIMIT):
try:
- view = launch_view.View(root, runtime_alias.runtime_view(root, longest=UV_BUILD_PATH_CHARS))
+ view = launch_view.View(root, runtime_alias.runtime_view(root, longest=reserve))
except OSError as error:
- if (path_chars(root) + 1 + UV_BUILD_PATH_CHARS <= WINDOWS_PATH_LIMIT
+ if (path_chars(root) + 1 + reserve <= WINDOWS_PATH_LIMIT
and runtime_alias._backend.ansi_path(root)):
view = launch_view.View(root, root)
else:
- return environ # No short entry: keep the old behaviour; packages without source builds still install.
- if path_chars(launch_view.value(root, view)) + 1 + UV_BUILD_PATH_CHARS > WINDOWS_PATH_LIMIT:
+ return None # No short entry: keep the old behaviour.
+ if path_chars(launch_view.value(root, view)) + 1 + reserve > WINDOWS_PATH_LIMIT:
+ return None
+ return view
+
+
+def uv_build_environment(command, root, environ):
+ """Windows uv pip builds use a short view of the existing cache and scratch.
+
+ TEMP alone does not move uv's sdist source tree or isolated build venv.
+ Mark only this child's view: processes.popen translates its paths, while
+ installation settings, cache ownership and the parent's environment stay put.
+ """
+ if (not command or Path(command[0]).name.lower() not in ('uv', 'uv.exe')
+ or list(command[1:2]) != ['pip']):
return environ
- temporary = Path(launch_view.value(root / 'tmp' / 'uv', view))
+ from . import launch_view, runtime_alias
+ from .long_paths import io_path
+ from .triton_compat import TEMP_KEYS, TEMP_ROOT_ENV, _writable_temporary
+ view = _short_view(root, environ, UV_BUILD_PATH_CHARS)
+ if view is None:
+ return environ
+ temporary = Path(launch_view.value(Path(os.path.abspath(root)) / 'tmp' / 'uv', view))
try:
for path in (temporary.parent, temporary):
folder = io_path(path)
@@ -82,6 +98,23 @@ def uv_build_environment(command, root, environ):
**{key: str(temporary) for key in (*TEMP_KEYS, TEMP_ROOT_ENV)})
+def git_long_path_environment(path, environ):
+ """Windows Git, and the Python that runs it, work from a short view of the install root.
+
+ `path` is any folder below the install root (the folder holding setup.lock,
+ which the short entry is verified through). Only this child's environment is
+ marked; paths on screen, in receipts and in the checkout keep their real spelling.
+ """
+ from . import launch_view
+ from .long_paths import path_chars, plain
+ path = Path(os.path.abspath(plain(path)))
+ root = next((parent for parent in (path, *path.parents) if os.path.isfile(parent / 'setup.lock')), None)
+ if root is None:
+ return environ
+ view = _short_view(root, environ, GIT_PATH_CHARS + path_chars(path) - path_chars(root))
+ return environ if view is None else launch_view.environment_view(environ, view)
+
+
def uv_file_arguments(command, cwd=None):
"""Return (command, cwd) for which uv reads constraint files in folders with spaces.
diff --git a/freevideo_engine/install.py b/freevideo_engine/install.py
index 4d4b00d..a32bc3a 100644
--- a/freevideo_engine/install.py
+++ b/freevideo_engine/install.py
@@ -7,6 +7,7 @@ import subprocess
import sys
import time
from . import execution_paths
+from .long_paths import io_path
from .paths import vdn_root
from . import network, subprocess_output
@@ -16,8 +17,8 @@ def install(root=None, *, packages=False):
spec = dependencies['vdn']
root = (root or vdn_root()).expanduser().resolve()
network.clone(root, spec['url'], spec['commit'])
- head = subprocess_output.output_external(['git', 'rev-parse', 'HEAD'], cwd=root).strip()
- dirty = subprocess_output.output_external(['git', 'status', '--porcelain', '--untracked-files=no'], cwd=root)
+ head = subprocess_output.output_external(['git', '-c', 'core.longpaths=true', 'rev-parse', 'HEAD'], cwd=root).strip()
+ dirty = subprocess_output.output_external(['git', '-c', 'core.longpaths=true', 'status', '--porcelain', '--untracked-files=no'], cwd=root)
if head != spec['commit'] or dirty:
raise RuntimeError('Existing VDN checkout does not match the clean pinned dependency; use another --vdn-root.')
diffusers = prepare_diffusers(root, dependencies)
@@ -76,22 +77,22 @@ def prepare_diffusers(root, dependencies):
"""Build the official two-patch tree atomically; never reset a user checkout."""
spec = dependencies['diffusers']
target = root / dependencies['vdn']['diffusers_subdirectory']
- if not target.exists():
+ if not io_path(target).exists():
checkout = root / ('engine-diffusers-' + str(time.time_ns()))
network.clone(checkout, spec['url'], spec['base'])
- patches = sorted((root / 'diffusers_patches').glob('*.patch'))
+ patches = sorted(io_path(root / 'diffusers_patches').glob('*.patch'))
if len(patches) != 2:
raise RuntimeError('Expected the two pinned VDN Diffusers patches')
for path in patches:
- execution_paths.run(['git', 'apply', '--index', str(path)], cwd=checkout, check=True)
- tree = subprocess_output.output_external(['git', 'write-tree'], cwd=checkout).strip()
+ execution_paths.run(['git', '-c', 'core.longpaths=true', 'apply', '--index', str(path)], cwd=checkout, check=True)
+ tree = subprocess_output.output_external(['git', '-c', 'core.longpaths=true', 'write-tree'], cwd=checkout).strip()
if tree != spec['patched_tree']:
raise RuntimeError('Patched Diffusers source tree does not match the tested dependency')
- execution_paths.run(['git', '-c', 'user.name=VDN Engine dependency setup', '-c', 'user.email=engine@localhost',
+ execution_paths.run(['git', '-c', 'core.longpaths=true', '-c', 'user.name=VDN Engine dependency setup', '-c', 'user.email=engine@localhost',
'commit', '--quiet', '-m', 'Apply pinned OpenVDN MiniMax H3 patches'], cwd=checkout, check=True)
- checkout.rename(target)
- tree = subprocess_output.output_external(['git', 'rev-parse', 'HEAD^{tree}'], cwd=target).strip()
- dirty = subprocess_output.output_external(['git', 'status', '--porcelain', '--untracked-files=no'], cwd=target)
+ io_path(checkout).rename(io_path(target))
+ tree = subprocess_output.output_external(['git', '-c', 'core.longpaths=true', 'rev-parse', 'HEAD^{tree}'], cwd=target).strip()
+ dirty = subprocess_output.output_external(['git', '-c', 'core.longpaths=true', 'status', '--porcelain', '--untracked-files=no'], cwd=target)
if tree != spec['patched_tree'] or dirty:
raise RuntimeError('Existing Diffusers differs from the clean tested tree; use another VDN dependency directory.')
return target
diff --git a/freevideo_engine/network.py b/freevideo_engine/network.py
index 3fdd6a6..0812ddf 100644
--- a/freevideo_engine/network.py
+++ b/freevideo_engine/network.py
@@ -1209,25 +1209,29 @@ def clone(target, url, commit, *, sparse=None, run=None, network=None, env=None)
env = proxy_environment(env)
env.update(GIT_TERMINAL_PROMPT='0', GIT_HTTP_LOW_SPEED_LIMIT='1024', GIT_HTTP_LOW_SPEED_TIME='20')
git = env.get('FREEVIDEO_GIT') or 'git'
- version = git_version(git, env) if not target.exists() else None
+ version = git_version(git, env) if not io_path(target).exists() else None
if version and version < MIN_GIT:
raise RuntimeError(old_git_message(version))
def execute(label, command):
- command = [git, *command[1:]]
+ # Git makes its own folders with the ordinary limit unless told otherwise on the command line;
+ # the repository's config only exists after `init` has already made the folder.
+ command = [git, '-c', 'core.longpaths=true', *command[1:]]
if run:
return run(label, command, env=env)
result = subprocess_output.run_external(list(map(str, command)), env=env, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, **hidden_console())
if result.returncode:
raise RuntimeError(result.stdout[-2500:])
- if target.exists():
- if not (target / '.git').exists():
+ if io_path(target).exists():
+ if not io_path(target / '.git').exists():
raise ValueError('Existing dependency is not a Git checkout of the pinned source: ' + str(target))
- head = subprocess_output.output_external([git, '-C', str(target), 'rev-parse', 'HEAD'], env=env, **hidden_console()).strip()
- dirty = subprocess_output.output_external([git, '-C', str(target), 'status', '--porcelain', '--untracked-files=no'], env=env, **hidden_console())
+ head = subprocess_output.output_external([git, '-c', 'core.longpaths=true', '-C', str(target), 'rev-parse', 'HEAD'], env=env, **hidden_console()).strip()
+ dirty = subprocess_output.output_external([git, '-c', 'core.longpaths=true', '-C', str(target), 'status', '--porcelain', '--untracked-files=no'], env=env, **hidden_console())
if head != commit or dirty:
raise ValueError('Existing dependency differs from the pinned clean source: ' + str(target))
return target
- target.parent.mkdir(parents=True, exist_ok=True)
+ io_path(target.parent).mkdir(parents=True, exist_ok=True)
+ from .environments import git_long_path_environment
+ env = git_long_path_environment(target.parent, env)
candidates = urls(dict(network, sources=dict(network.get('sources', {}), github=network.get('sources', {}).get('git', [{'id': 'official'}]))), 'github', url, env)
configured_env = env
for name, endpoint, route in [(name, endpoint, route) for name, endpoint in candidates
@@ -1246,8 +1250,8 @@ def clone(target, url, commit, *, sparse=None, run=None, network=None, env=None)
# set --no-cone` writes; every Git reads it at checkout.
execute(target.name + '-sparse', ['git', '-C', temporary, 'config', 'core.sparseCheckout', 'true'])
execute(target.name + '-sparse-cone', ['git', '-C', temporary, 'config', 'core.sparseCheckoutCone', 'false'])
- (temporary / '.git' / 'info').mkdir(exist_ok=True)
- (temporary / '.git' / 'info' / 'sparse-checkout').write_text(''.join(p + '\n' for p in sparse), encoding='utf-8')
+ io_path(temporary / '.git' / 'info').mkdir(exist_ok=True)
+ io_path(temporary / '.git' / 'info' / 'sparse-checkout').write_text(''.join(p + '\n' for p in sparse), encoding='utf-8')
# The URL reaches Git the way `git -c` hands settings to its own
# children, in every Git version: never in process arguments, logs
# or the repository's config, even if the fetch is killed.
@@ -1259,10 +1263,10 @@ def clone(target, url, commit, *, sparse=None, run=None, network=None, env=None)
finally:
env = original
execute(target.name + '-checkout', ['git', '-C', temporary, 'checkout', '--detach', commit])
- actual = subprocess_output.output_external([git, '-C', str(temporary), 'rev-parse', 'HEAD'], env=env, **hidden_console()).strip()
+ actual = subprocess_output.output_external([git, '-c', 'core.longpaths=true', '-C', str(temporary), 'rev-parse', 'HEAD'], env=env, **hidden_console()).strip()
if actual != commit:
raise ValueError('Downloaded source did not match its pinned commit')
- temporary.rename(target)
+ io_path(temporary).rename(io_path(target))
source_health(network, 'git', name, True)
route_health(network, 'git', name, route)
event(network, category='git', source=name, route=route, file=target.name, action='verified', commit=commit)