Skip to content

fix(desktop): workspace git actions enhancement#3988

Open
kekexunxun wants to merge 2 commits into
esengine:main-v2from
kekexunxun:fix/workspace-git-actions
Open

fix(desktop): workspace git actions enhancement#3988
kekexunxun wants to merge 2 commits into
esengine:main-v2from
kekexunxun:fix/workspace-git-actions

Conversation

@kekexunxun

Copy link
Copy Markdown
Contributor

The previous PR was closed due to the handling of the branch; a new PR is now being submitted. A fallback mechanism has been implemented for the Git "unstage" operation, and code related to a horizontal scrolling overflow issue—which did not require a fix—has been removed.

#3822

@github-actions github-actions Bot added v2 Go rewrite (1.x) — main-v2 branch, active development desktop Wails desktop app (desktop/**) labels Jun 11, 2026
@kekexunxun kekexunxun force-pushed the fix/workspace-git-actions branch from 2483135 to f2a15c5 Compare June 12, 2026 09:23

@SivanCola SivanCola left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update here. I found two workspace-scoping issues that should be fixed before this lands:

  1. WorkspaceGitCommit currently runs git commit -m without a pathspec. If the user opens a repository subdirectory as the workspace, the UI only shows staged files inside that subdirectory, but Git still commits the entire repository index. I reproduced this with git -C sub commit, which committed both sub/a.txt and an already-staged other/b.txt. Please scope the commit to the active workspace, for example with -- . or an explicit repo-root-relative workspace pathspec.

  2. WorkspaceGitStageAll and WorkspaceGitUnstageAll have the same subdirectory leak: git -C sub add -A and git -C sub reset HEAD -- affect changes outside sub/. These bulk actions should also use the same workspace-scoped pathspec, including the unborn-HEAD fallback path.

The Go tests passed locally, and the frontend build passed after regenerating the ignored Wails bindings. A regression test that opens/uses a repo subdirectory would be a good guard for both cases.

`WorkspaceGitCommit`, `WorkspaceGitStageAll`, and `WorkspaceGitUnstageAll`
previously ran without a pathspec, leaking changes outside the workspace
when the workspace is a repository subdirectory.  Scope all three to
`-- .` (including the unborn-HEAD rm fallback) so only workspace-relative
files are affected.
@kekexunxun kekexunxun force-pushed the fix/workspace-git-actions branch from f2a15c5 to cfb8023 Compare June 12, 2026 11:34
@kekexunxun

Copy link
Copy Markdown
Contributor Author

Fixes an issue where Git batch operations "leaked" outside the workspace when the workspace was set to a repository subdirectory.

Issue

When a user opens a repository subdirectory (e.g., sub/) as the workspace:

  • git commit -m (without a pathspec) commits changes from the entire index, rather than just files within the workspace.
  • git add -A and git reset HEAD behave similarly, affecting files outside the subdirectory.

Fix

Added the -- . pathspec to three batch operations to restrict them to the workspace directory.

Testing

Added TestWorkspaceGitScopesToSubdirectory to verify that StageAll, UnstageAll, and Commit do not leak into the other/ directory when sub/ is the workspace, and to cover the rm --cached fallback path for an unborn HEAD. All relevant tests passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

desktop Wails desktop app (desktop/**) v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants