Skip to content

Commit 3db2f25

Browse files
feedback
1 parent 3b9a504 commit 3db2f25

File tree

9 files changed

+42
-43
lines changed

9 files changed

+42
-43
lines changed

packages/backend/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
"vitest": "^2.1.9"
2323
},
2424
"dependencies": {
25-
"@bull-board/api": "^6.13.0",
26-
"@bull-board/express": "^6.13.0",
2725
"@coderabbitai/bitbucket": "^1.1.3",
2826
"@gitbeaker/rest": "^40.5.1",
2927
"@octokit/rest": "^21.0.2",

packages/backend/src/git.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,8 @@ export const fetchRepository = async (
104104
signal?: AbortSignal
105105
}
106106
) => {
107+
const git = createGitClientForPath(path, onProgress, signal);
107108
try {
108-
const git = createGitClientForPath(path, onProgress, signal);
109-
110109
if (authHeader) {
111110
await git.addConfig("http.extraHeader", authHeader);
112111
}
@@ -129,12 +128,6 @@ export const fetchRepository = async (
129128
}
130129
} finally {
131130
if (authHeader) {
132-
const git = simpleGit({
133-
progress: onProgress,
134-
}).cwd({
135-
path: path,
136-
})
137-
138131
await git.raw(["config", "--unset", "http.extraHeader", authHeader]);
139132
}
140133
}
@@ -221,6 +214,10 @@ export const isPathAValidGitRepoRoot = async ({
221214
onProgress?: onProgressFn,
222215
signal?: AbortSignal
223216
}) => {
217+
if (!existsSync(path)) {
218+
return false;
219+
}
220+
224221
const git = createGitClientForPath(path, onProgress, signal);
225222

226223
try {

packages/backend/src/promClient.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class PromClient {
99
private registry: Registry;
1010
private app: express.Application;
1111
private server: Server;
12-
12+
1313
public activeRepoIndexingJobs: Gauge<string>;
1414
public pendingRepoIndexingJobs: Gauge<string>;
1515
public repoIndexingReattemptsTotal: Counter<string>;
@@ -80,7 +80,7 @@ export class PromClient {
8080
help: 'The number of repo garbage collection fails',
8181
labelNames: ['repo'],
8282
});
83-
this.registry.registerMetric(this.repoGarbageCollectionFailTotal);
83+
this.registry.registerMetric(this.repoGarbageCollectionFailTotal);
8484

8585
this.repoGarbageCollectionSuccessTotal = new Counter({
8686
name: 'repo_garbage_collection_successes',
@@ -106,7 +106,12 @@ export class PromClient {
106106
});
107107
}
108108

109-
dispose() {
110-
this.server.close();
109+
async dispose() {
110+
return new Promise<void>((resolve, reject) => {
111+
this.server.close((err) => {
112+
if (err) reject(err);
113+
else resolve();
114+
});
115+
});
111116
}
112117
}

packages/backend/src/repoIndexManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export class RepoIndexManager {
204204

205205
for (const job of jobs) {
206206
await this.queue.add({
207-
groupId: `repo:${job.repoId}_${job.repo.name}`,
207+
groupId: `repo:${job.repoId}`,
208208
data: {
209209
jobId: job.id,
210210
type,

packages/web/src/app/[domain]/browse/[...path]/components/pureCodePreviewPanel.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import { search } from "@codemirror/search";
1313
import CodeMirror, { EditorSelection, EditorView, ReactCodeMirrorRef, SelectionRange, ViewUpdate } from "@uiw/react-codemirror";
1414
import { useCallback, useEffect, useMemo, useState } from "react";
1515
import { EditorContextMenu } from "../../../components/editorContextMenu";
16-
import { BrowseHighlightRange, HIGHLIGHT_RANGE_QUERY_PARAM, useBrowseNavigation } from "../../hooks/useBrowseNavigation";
16+
import { BrowseHighlightRange, useBrowseNavigation } from "../../hooks/useBrowseNavigation";
17+
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../../hooks/utils";
1718
import { useBrowseState } from "../../hooks/useBrowseState";
1819
import { rangeHighlightingExtension } from "./rangeHighlightingExtension";
1920
import useCaptureEvent from "@/hooks/useCaptureEvent";

packages/web/src/app/[domain]/browse/hooks/useBrowseNavigation.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,7 @@
33
import { useRouter } from "next/navigation";
44
import { useDomain } from "@/hooks/useDomain";
55
import { useCallback } from "react";
6-
import { BrowseState } from "../browseStateProvider";
7-
import { getBrowsePath } from "./utils";
8-
9-
export type BrowseHighlightRange = {
10-
start: { lineNumber: number; column: number; };
11-
end: { lineNumber: number; column: number; };
12-
} | {
13-
start: { lineNumber: number; };
14-
end: { lineNumber: number; };
15-
}
16-
17-
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
18-
19-
export interface GetBrowsePathProps {
20-
repoName: string;
21-
revisionName?: string;
22-
path: string;
23-
pathType: 'blob' | 'tree';
24-
highlightRange?: BrowseHighlightRange;
25-
setBrowseState?: Partial<BrowseState>;
26-
domain: string;
27-
}
6+
import { getBrowsePath, GetBrowsePathProps } from "./utils";
287

298
export const useBrowseNavigation = () => {
309
const router = useRouter();

packages/web/src/app/[domain]/browse/hooks/useBrowsePath.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
'use client';
22

33
import { useMemo } from "react";
4-
import { GetBrowsePathProps } from "./useBrowseNavigation";
5-
import { getBrowsePath } from "./utils";
4+
import { getBrowsePath, GetBrowsePathProps } from "./utils";
65
import { useDomain } from "@/hooks/useDomain";
76

87
export const useBrowsePath = ({

packages/web/src/app/[domain]/browse/hooks/utils.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
1-
import { SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
2-
import { GetBrowsePathProps, HIGHLIGHT_RANGE_QUERY_PARAM } from "./useBrowseNavigation";
1+
import { BrowseState, SET_BROWSE_STATE_QUERY_PARAM } from "../browseStateProvider";
2+
3+
export const HIGHLIGHT_RANGE_QUERY_PARAM = 'highlightRange';
4+
5+
export type BrowseHighlightRange = {
6+
start: { lineNumber: number; column: number; };
7+
end: { lineNumber: number; column: number; };
8+
} | {
9+
start: { lineNumber: number; };
10+
end: { lineNumber: number; };
11+
}
12+
13+
export interface GetBrowsePathProps {
14+
repoName: string;
15+
revisionName?: string;
16+
path: string;
17+
pathType: 'blob' | 'tree';
18+
highlightRange?: BrowseHighlightRange;
19+
setBrowseState?: Partial<BrowseState>;
20+
domain: string;
21+
}
322

423
export const getBrowseParamsFromPathParam = (pathParam: string) => {
524
const sentinelIndex = pathParam.search(/\/-\/(tree|blob)/);
@@ -67,3 +86,4 @@ export const getBrowsePath = ({
6786
const browsePath = `/${domain}/browse/${repoName}@${revisionName}/-/${pathType}/${encodedPath}${params.size > 0 ? `?${params.toString()}` : ''}`;
6887
return browsePath;
6988
};
89+

packages/web/src/app/[domain]/components/editorContextMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Link2Icon } from "@radix-ui/react-icons";
99
import { EditorView, SelectionRange } from "@uiw/react-codemirror";
1010
import { useCallback, useEffect, useRef } from "react";
1111
import { useDomain } from "@/hooks/useDomain";
12-
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "@/app/[domain]/browse/hooks/useBrowseNavigation";
12+
import { HIGHLIGHT_RANGE_QUERY_PARAM } from "../browse/hooks/utils";
1313

1414
interface ContextMenuProps {
1515
view: EditorView;

0 commit comments

Comments
 (0)