mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
fix: filter source control commits by branch (#286)
This commit is contained in:
1 parent
8d93f2f1f9
commit
bb1df259b6
6 files changed
+67
-11
No files matched your search
@@ -35,9 +35,9 @@ export async function fetchGitDiff(repoId: number, path: string): Promise<{ diff
|
||||
return { diff: data }
|
||||
}
|
||||
|
||||
export async function fetchGitLog(repoId: number, limit?: number): Promise<{ commits: GitCommit[] }> {
|
||||
export async function fetchGitLog(repoId: number, limit?: number, branch?: string): Promise<{ commits: GitCommit[] }> {
|
||||
return fetchWrapper(`${API_BASE_URL}/api/repos/${repoId}/git/log`, {
|
||||
params: { limit },
|
||||
params: { limit, branch },
|
||||
})
|
||||
}
|
||||
|
||||
@@ -130,10 +130,10 @@ export function useCommitFileDiff(repoId: number | undefined, commitHash: string
|
||||
})
|
||||
}
|
||||
|
||||
export function useGitLog(repoId: number | undefined, limit?: number) {
|
||||
export function useGitLog(repoId: number | undefined, limit?: number, branch?: string) {
|
||||
return useQuery({
|
||||
queryKey: ['gitLog', repoId, limit],
|
||||
queryFn: () => repoId ? fetchGitLog(repoId, limit) : Promise.reject(new Error('No repo ID')),
|
||||
queryKey: ['gitLog', repoId, limit, branch],
|
||||
queryFn: () => repoId ? fetchGitLog(repoId, limit, branch) : Promise.reject(new Error('No repo ID')),
|
||||
enabled: !!repoId,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user