This commit is contained in:
bkellam 2025-10-18 16:12:25 -07:00
parent 3b9a504890
commit 3db2f2563a
9 changed files with 42 additions and 43 deletions

View file

@ -22,8 +22,6 @@
"vitest": "^2.1.9" "vitest": "^2.1.9"
}, },
"dependencies": { "dependencies": {
"@bull-board/api": "^6.13.0",
"@bull-board/express": "^6.13.0",
"@coderabbitai/bitbucket": "^1.1.3", "@coderabbitai/bitbucket": "^1.1.3",
"@gitbeaker/rest": "^40.5.1", "@gitbeaker/rest": "^40.5.1",
"@octokit/rest": "^21.0.2", "@octokit/rest": "^21.0.2",

View file

@ -104,9 +104,8 @@ export const fetchRepository = async (
signal?: AbortSignal signal?: AbortSignal
} }
) => { ) => {
try {
const git = createGitClientForPath(path, onProgress, signal); const git = createGitClientForPath(path, onProgress, signal);
try {
if (authHeader) { if (authHeader) {
await git.addConfig("http.extraHeader", authHeader); await git.addConfig("http.extraHeader", authHeader);
} }
@ -129,12 +128,6 @@ export const fetchRepository = async (
} }
} finally { } finally {
if (authHeader) { if (authHeader) {
const git = simpleGit({
progress: onProgress,
}).cwd({
path: path,
})
await git.raw(["config", "--unset", "http.extraHeader", authHeader]); await git.raw(["config", "--unset", "http.extraHeader", authHeader]);
} }
} }
@ -221,6 +214,10 @@ export const isPathAValidGitRepoRoot = async ({
onProgress?: onProgressFn, onProgress?: onProgressFn,
signal?: AbortSignal signal?: AbortSignal
}) => { }) => {
if (!existsSync(path)) {
return false;
}
const git = createGitClientForPath(path, onProgress, signal); const git = createGitClientForPath(path, onProgress, signal);
try { try {

View file

@ -106,7 +106,12 @@ export class PromClient {
}); });
} }
dispose() { async dispose() {
this.server.close(); return new Promise<void>((resolve, reject) => {
this.server.close((err) => {
if (err) reject(err);
else resolve();
});
});
} }
} }

View file

@ -204,7 +204,7 @@ export class RepoIndexManager {
for (const job of jobs) { for (const job of jobs) {
await this.queue.add({ await this.queue.add({
groupId: `repo:${job.repoId}_${job.repo.name}`, groupId: `repo:${job.repoId}`,
data: { data: {
jobId: job.id, jobId: job.id,
type, type,

View file

@ -13,7 +13,8 @@ import { search } from "@codemirror/search";
import CodeMirror, { EditorSelection, EditorView, ReactCodeMirrorRef, SelectionRange, ViewUpdate } from "@uiw/react-codemirror"; import CodeMirror, { EditorSelection, EditorView, ReactCodeMirrorRef, SelectionRange, ViewUpdate } from "@uiw/react-codemirror";
import { useCallback, useEffect, useMemo, useState } from "react"; import { useCallback, useEffect, useMemo, useState } from "react";
import { EditorContextMenu } from "../../../components/editorContextMenu"; import { EditorContextMenu } from "../../../components/editorContextMenu";
import { BrowseHighlightRange, HIGHLIGHT_RANGE_QUERY_PARAM, useBrowseNavigation } from "../../hooks/useBrowseNavigation"; import { BrowseHighlightRange, useBrowseNavigation } from "../../hooks/useBrowseNavigation";
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../../hooks/utils";
import { useBrowseState } from "../../hooks/useBrowseState"; import { useBrowseState } from "../../hooks/useBrowseState";
import { rangeHighlightingExtension } from "./rangeHighlightingExtension"; import { rangeHighlightingExtension } from "./rangeHighlightingExtension";
import useCaptureEvent from "@/hooks/useCaptureEvent"; import useCaptureEvent from "@/hooks/useCaptureEvent";

View file

@ -3,28 +3,7 @@
import { useRouter } from "next/navigation"; import { useRouter } from "next/navigation";
import { useDomain } from "@/hooks/useDomain"; import { useDomain } from "@/hooks/useDomain";
import { useCallback } from "react"; import { useCallback } from "react";
import { BrowseState } from "../browseStateProvider"; import { getBrowsePath, GetBrowsePathProps } from "./utils";
import { getBrowsePath } from "./utils";
export type BrowseHighlightRange = {
start: { lineNumber: number; column: number; };
end: { lineNumber: number; column: number; };
} | {
start: { lineNumber: number; };
end: { lineNumber: number; };
}
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
export interface GetBrowsePathProps {
repoName: string;
revisionName?: string;
path: string;
pathType: 'blob' | 'tree';
highlightRange?: BrowseHighlightRange;
setBrowseState?: Partial<BrowseState>;
domain: string;
}
export const useBrowseNavigation = () => { export const useBrowseNavigation = () => {
const router = useRouter(); const router = useRouter();

View file

@ -1,8 +1,7 @@
'use client'; 'use client';
import { useMemo } from "react"; import { useMemo } from "react";
import { GetBrowsePathProps } from "./useBrowseNavigation"; import { getBrowsePath, GetBrowsePathProps } from "./utils";
import { getBrowsePath } from "./utils";
import { useDomain } from "@/hooks/useDomain"; import { useDomain } from "@/hooks/useDomain";
export const useBrowsePath = ({ export const useBrowsePath = ({

View file

@ -1,5 +1,24 @@
import { SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider"; import { BrowseState, SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
import { GetBrowsePathProps, HIGHLIGHT_RANGE_QUERY_PARAM } from "./useBrowseNavigation";
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
export type BrowseHighlightRange = {
start: { lineNumber: number; column: number; };
end: { lineNumber: number; column: number; };
} | {
start: { lineNumber: number; };
end: { lineNumber: number; };
}
export interface GetBrowsePathProps {
repoName: string;
revisionName?: string;
path: string;
pathType: 'blob' | 'tree';
highlightRange?: BrowseHighlightRange;
setBrowseState?: Partial<BrowseState>;
domain: string;
}
export const getBrowseParamsFromPathParam = (pathParam: string) => { export const getBrowseParamsFromPathParam = (pathParam: string) => {
const sentinelIndex = pathParam.search(/\/-\/(tree|blob)/); const sentinelIndex = pathParam.search(/\/-\/(tree|blob)/);
@ -67,3 +86,4 @@ export const getBrowsePath = ({
const browsePath = `/${domain}/browse/${repoName}@${revisionName}/-/${pathType}/${encodedPath}${params.size > 0 ? `?${params.toString()}` : ''}`; const browsePath = `/${domain}/browse/${repoName}@${revisionName}/-/${pathType}/${encodedPath}${params.size > 0 ? `?${params.toString()}` : ''}`;
return browsePath; return browsePath;
}; };

View file

@ -9,7 +9,7 @@ import { Link2Icon } from "@radix-ui/react-icons";
import { EditorView, SelectionRange } from "@uiw/react-codemirror"; import { EditorView, SelectionRange } from "@uiw/react-codemirror";
import { useCallback, useEffect, useRef } from "react"; import { useCallback, useEffect, useRef } from "react";
import { useDomain } from "@/hooks/useDomain"; import { useDomain } from "@/hooks/useDomain";
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "@/app/[domain]/browse/hooks/useBrowseNavigation"; import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../browse/hooks/utils";
interface ContextMenuProps { interface ContextMenuProps {
view: EditorView; view: EditorView;