CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

Fix Source Control File Names With Spaces

Open thecoolwinter opened this issue 1 year ago • 0 comments

Description

Main Changes

  • Modifies the GitClient to use GitChangedFiles or URLs instead of CEWorkspaceFiles. The CEWorkspaceFiles created by these methods were disconnected from the workspace's file manager and it becomes messy to store things like old file names (in the case of renames) and the staged and unstaged statuses.
  • Updates GitChangedFile to be able to much more accurately represent a git file change. It now tracks two statuses, provides multiple helper methods and properties for use in UI.
  • Replaces GitClient. getChangedFiles and GitClient. getStagedFiles with GitClient. getStatus. Also adds a Status struct to the GitClient. This new method uses the porcelain v2 version of git status to fetch more information per file. It also uses the -z option to get a easily-readable format.
  • Updates related UI to use GitChangedFile or URL in place of CEWorkspaceFIle where possible and only fetch CEWorkspaceFiles when necessary.

This also sets up the required changes to view file renames correctly in source control lists.

Other Changes

  • Updates GitClient. getCommitHistory to correctly specify the branch name and file. Fixes an untracked bug where a file with the same name as a branch would cause an error (eg a file named main on the main branch).
  • Renames GitType to GitStatus.
  • Adds a logger to the GitClient and logs errors in a few key methods.
  • Fixes a small bug with the workspace document where the URL would not have a trailing / caused issues when using relative URLs.
  • Consolidates list view rows for git changes into one View that's reused in a few different lists.
  • Updates GitClient.add and GitClient.reset to use quoted, relative, paths.

Related Issues

  • closes #1852

Checklist

  • [x] I read and understood the contributing guide as well as the code of conduct
  • [x] The issues this PR addresses are related to each other
  • [x] My changes generate no new warnings
  • [x] My code builds and runs on my machine
  • [x] My changes are all related to the related issue above
  • [x] I documented my code

Screenshots

Before:

Screenshot 2024-08-24 at 5 30 30 PM

https://github.com/user-attachments/assets/51f59c20-58e3-487b-9c32-7b379e360480

After:

Screenshot 2024-08-24 at 5 32 38 PM

https://github.com/user-attachments/assets/99b5b10d-b18d-4763-9497-1abc12340ad2

thecoolwinter avatar Aug 24 '24 22:08 thecoolwinter