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"
},
"dependencies": {
"@bull-board/api": "^6.13.0",
"@bull-board/express": "^6.13.0",
"@coderabbitai/bitbucket": "^1.1.3",
"@gitbeaker/rest": "^40.5.1",
"@octokit/rest": "^21.0.2",

View file

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

View file

@ -106,7 +106,12 @@ export class PromClient {
});
}
dispose() {
this.server.close();
async dispose() {
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) {
await this.queue.add({
groupId: `repo:${job.repoId}_${job.repo.name}`,
groupId: `repo:${job.repoId}`,
data: {
jobId: job.id,
type,

View file

@ -13,7 +13,8 @@ import { search } from "@codemirror/search";
import CodeMirror, { EditorSelection, EditorView, ReactCodeMirrorRef, SelectionRange, ViewUpdate } from "@uiw/react-codemirror";
import { useCallback, useEffect, useMemo, useState } from "react";
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 { rangeHighlightingExtension } from "./rangeHighlightingExtension";
import useCaptureEvent from "@/hooks/useCaptureEvent";

View file

@ -3,28 +3,7 @@
import { useRouter } from "next/navigation";
import { useDomain } from "@/hooks/useDomain";
import { useCallback } from "react";
import { BrowseState } from "../browseStateProvider";
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;
}
import { getBrowsePath, GetBrowsePathProps } from "./utils";
export const useBrowseNavigation = () => {
const router = useRouter();

View file

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

View file

@ -1,5 +1,24 @@
import { SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
import { GetBrowsePathProps, HIGHLIGHT_RANGE_QUERY_PARAM } from "./useBrowseNavigation";
import { BrowseState, SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
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) => {
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()}` : ''}`;
return browsePath;
};

View file

@ -9,7 +9,7 @@ import { Link2Icon } from "@radix-ui/react-icons";
import { EditorView, SelectionRange } from "@uiw/react-codemirror";
import { useCallback, useEffect, useRef } from "react";
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 {
view: EditorView;