mirror of
https://github.com/open-webui/computer.git
synced 2026-11-30 00:45:14 -05:00
refac
This commit is contained in:
1 parent
e46db91f04
commit
049280219b
6 files changed
+206
-7
No files matched your search
+3
-1
@@ -8,6 +8,7 @@ from __future__ import annotations
|
||||
|
||||
import asyncio
|
||||
import os
|
||||
import sys
|
||||
from typing import Any
|
||||
|
||||
|
||||
@@ -130,9 +131,10 @@ async def diff(
|
||||
"""Get diff output as structured data."""
|
||||
if untracked and file:
|
||||
# Untracked files: use --no-index to diff against empty
|
||||
null_device = "NUL" if sys.platform == "win32" else "/dev/null"
|
||||
_, out, _ = await _run(
|
||||
"diff", "--no-index", "--unified=3",
|
||||
"--", "/dev/null", file,
|
||||
"--", null_device, file,
|
||||
cwd=root, check=False,
|
||||
)
|
||||
return _parse_diff(out)
|
||||
|
||||
+1
-1
@@ -227,7 +227,7 @@ async def _search_rg(
|
||||
raise FileNotFoundError(err) if "not found" in err.lower() else Exception(err)
|
||||
|
||||
# Make paths relative
|
||||
prefix = str(full) + "/"
|
||||
prefix = str(full) + os.sep
|
||||
lines = output.splitlines()[:50]
|
||||
result = [line.replace(prefix, "") for line in lines]
|
||||
return "\n".join(result) if result else "No matches found."
|
||||
|
||||
Reference in new issue
Block a user