Repository navigation
Conversation
There was a problem hiding this comment.
This fixes the reported failure, but it introduces one regression that should be fixed before merge.
I checked it by running the new test against the base code: it fails there with fatal: Unable to process path a.txt, the error from the issue, and passes with this change. test/snapshot.test.ts passes. tsc -b for packages/core succeeds. I tested on Linux at the Git capture layer only, not on Windows, where the issue was reported.
Public API: unchanged.
The regression: fs.stat follows symlinks, so a symlink that points to a socket (for example docker.sock -> /var/run/docker.sock) is now dropped from the snapshot, though Git could record it as a link before. I confirmed this with a temporary test: the base captures link.sock and this change doesn't. Details are inline.
Related: #48657
ef20803 to
193d153
Compare
There was a problem hiding this comment.
The symlink regression from my last review is fixed: paths whose type is neither file nor directory are now checked with readLink, and symlinks are kept, so a symlink to a socket is captured as a link again. The new test checks that it is stored as a link.
In packages/core, test/git.test.ts and test/snapshot.test.ts pass (29 tests), and tsc -b succeeds. The socket test fails on the base with the error from the issue and passes here. I tested on Linux only, not on Windows, where the issue was reported.
Public API: unchanged.
No new concerns.
|
@jlongster this one is ready for a look when you have a moment. It fixes #58371: The bot review found a symlink regression on the first revision and reports no new concerns on the current head. |
193d153 to
077fc11
Compare
There was a problem hiding this comment.
The new push leaves the code exactly as it was at my last review: the tree is identical, and only the commit was rewritten. My earlier results still apply. Symlinks are now kept, which fixes my earlier point, the tests pass, and tsc -b succeeds. I tested on Linux only, not on Windows, where the issue was reported.
Public API: unchanged.
No new concerns.
Dextheking1
left a comment
There was a problem hiding this comment.
one stat driving both checks is clean. symlinks kept, the rest skipped. good.
|
@rekram1-node could you take a look at this one when you get a chance? It fixes #58371: The review bot reports no new concerns — it caught a symlink regression on the first revision, which is fixed in the current head. |
|
@rekram1-node — this one still applies cleanly after #59419 and #59417: Status right now: If you'd rather have it without the docs line, or with the two socket tests merged into one, say which and I'll adjust. |
Issue for this PR
Closes #58371
Type of change
What does this PR do?
Snapshot capture aborts when the work tree contains a path that is not a regular file.
Git.tree.capturelists the changed and untracked paths and hands them togit update-index --add --remove --replace, and Git refuses sockets, FIFOs and device nodes (fatal: Unable to process path …). One such path fails the wholeupdate-indexcall, so the capture throws and no snapshot exists for that step.The change stats the candidates once and leaves out the paths Git refuses, so the rest of the tree is still captured. A path that no longer exists has no stat information and is still passed through, because
--removehandles deletions; directories are passed through as well, since a tracked path replaced by an embedded repository is recorded as a gitlink.fs.statfollows links, so a symlink to a socket reports the socket's type. Git records a link itself and never opens its target, so those paths are kept: the ones with another type are only dropped whenreadLinkshows they are not links.This is driven by the path type rather than by which list produced it, so it covers both a tracked path that became a socket and an untracked socket that Git lists on Windows. Snapshot docs now list non-regular paths among what capture leaves out.
How did you verify your code works?
packages/core/test/git.test.ts: a tracked file replaced by a unix socket is left out of the tree while capture succeeds and records an unrelated edit made in the same capture; a symlink whose target is a socket is still recorded as a link (120000 blob). Ondevthe first fails withfatal: Unable to process path a.txt, the error from the issue.bun test test/git.test.ts test/snapshot.test.tsinpackages/core, plusbun run typecheck:tscandoxlinton the changed files.Screenshots / recordings
Not a UI change.
Checklist
Added by the opencode bot (AI-generated).
Related: #48657