( workingDir: string | undefined, filePath: string | null, type: 'uncommitted' | 'committed' )
| 48 | export type GitLogResponse = { |
| 49 | commits: GitLogEntry[] |
| 50 | } |
| 51 | |
| 52 | export type GitCommitFilesResponse = { |
| 53 | files: GitChangeEntry[] |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * Git queries load once over REST. While the task's workspace subscription is live |
| 58 | * (`useWorkspaceGitSubscription`), pushes keep them current; otherwise they refetch on window |
| 59 | * focus and reconnect. None of them polls. |
| 60 | */ |
| 61 | function useWorkingDirRefetchOptions(workingDir: string | undefined) { |
| 62 | const subscriptions = getWorkspaceGitSubscriptions(useQueryClient()) |
| 63 | return gitRestRefetchOptions(() => subscriptions.coversWorkingDir(workingDir)) |
| 64 | } |
| 65 | |
| 66 | export function useGitChanges(workingDir: string | undefined, options: { enabled?: boolean } = {}) { |
| 67 | const refetchOptions = useWorkingDirRefetchOptions(workingDir) |
| 68 | |
| 69 | return useQuery({ |
| 70 | queryKey: queryKeys.git.changes(workingDir || ''), |
no test coverage detected