Enhance git metadata handling and improve change detection logic

- Introduced a new function `getGitMetadata` in `ApiContext` to fetch current git metadata, including new file IDs.
- Updated the `PatchTree.build` function to handle new file IDs, allowing for better differentiation between tracked and untracked files during patch processing.
- Modified the `git_changed_files` function to return both tracked and untracked files, improving accuracy in change detection.
- Enhanced the `App` component to debounce git metadata refreshes, ensuring the UI reflects the latest changes without unnecessary calls.

These changes aim to improve the integration with git and enhance the accuracy of change detection in the application.
This commit is contained in:
Joe 2026-03-01 07:10:14 -06:00
parent b8bd92d665
commit 640b2d3d97
7 changed files with 128 additions and 30 deletions

View file

@ -271,6 +271,12 @@ function ApiContext:write(patch, stageIds)
end)
end
function ApiContext:getGitMetadata()
local url = ("%s/api/git-metadata"):format(self.__baseUrl)
return Http.get(url):andThen(rejectFailedRequests):andThen(Http.Response.msgpack)
end
function ApiContext:connectWebSocket(packetHandlers)
local url = ("%s/api/socket/%s"):format(self.__baseUrl, self.__messageCursor)
-- Convert HTTP/HTTPS URL to WS/WSS