MCPcopy Create free account
hub / github.com/agent-tower/core / useGitDiff

Function useGitDiff

packages/web/src/hooks/use-git.ts:50–67  ·  view source on GitHub ↗
(
  workingDir: string | undefined,
  filePath: string | null,
  type: 'uncommitted' | 'committed'
)

Source from the content-addressed store, hash-verified

48export type GitLogResponse = {
49 commits: GitLogEntry[]
50}
51
52export 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 */
61function useWorkingDirRefetchOptions(workingDir: string | undefined) {
62 const subscriptions = getWorkspaceGitSubscriptions(useQueryClient())
63 return gitRestRefetchOptions(() => subscriptions.coversWorkingDir(workingDir))
64}
65
66export function useGitChanges(workingDir: string | undefined, options: { enabled?: boolean } = {}) {
67 const refetchOptions = useWorkingDirRefetchOptions(workingDir)
68
69 return useQuery({
70 queryKey: queryKeys.git.changes(workingDir || ''),

Callers 2

WorkingDiffBodyFunction · 0.90
InlineDiffFunction · 0.90

Calls 1

getMethod · 0.45

Tested by

no test coverage detected