Skip to content

Fix stray <timestamp> tab when committing from untitled workspace - #362

Merged
spookylukey merged 1 commit into
kahole:developfrom
danmilon:fix/commit-editmsg-stray-tab
May 8, 2026
Merged

spookylukey merged 1 commit into
kahole:developfrom
danmilon:fix/commit-editmsg-stray-tab

Conversation

@danmilon

@danmilon danmilon commented Apr 22, 2026 •

Copy link
Copy Markdown
Contributor

I kept hitting into the issue reported in #346 and I think this MR fixes it.

When the open workspace is an unsaved multi-root workspace, workspace.workspaceFile is a URI with untitled: scheme whose fsPath is a bare Date.now() string (e.g. 1774006721975). Interpolating that into GIT_EDITOR caused code --reuse-window to receive it as a relative file path and open a stray empty tab alongside COMMIT_EDITMSG on every commit.

With the changes in the PR it we only pass workspaceFile.fsPath when its scheme is file. For untitled workspaces, omit the path argument entirely passing a folder path instead would regress #316 by prompting to save the untitled workspace.

When the open workspace is an unsaved multi-root workspace,
`workspace.workspaceFile` is set to `untitled:<timestamp>`. Interpolating that
into `GIT_EDITOR` caused `code --reuse-window` to receive it as a
relative file path and open a stray empty tab alongside `COMMIT_EDITMSG`
on every commit.

Lets only pass `workspaceFile.fsPath` when its scheme is `file`. For untitled
workspaces, omit the path argument entirely — passing a folder path
instead would regress kahole#316 by prompting to save the untitled workspace.

Fixes kahole#346.
@danmilon

Copy link
Copy Markdown
Contributor Author

FTR I've tested this locally.

@spookylukey

Copy link
Copy Markdown
Collaborator

I haven't tested this locally, but it looks sensible. Thanks for the PR!

@spookylukey
spookylukey merged commit 55c0862 into kahole:develop May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants