Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Source Control File Names With Spaces #1858

Merged

Conversation

thecoolwinter
Copy link
Collaborator

@thecoolwinter thecoolwinter commented Aug 24, 2024

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

  • Fixed file statuses toggling on and off when files are saved.
  • 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

Checklist

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

Screenshots

Before:

Screenshot 2024-08-24 at 5 30 30 PM

Screen.Recording.2024-08-24.at.5.32.02.PM.mov

After:

Screenshot 2024-08-24 at 5 32 38 PM

Screen.Recording.2024-08-24.at.5.33.06.PM.mov

@thecoolwinter thecoolwinter changed the title fix: Source Control File Names With Spaces Fix Source Control File Names With Spaces Aug 25, 2024
@thecoolwinter thecoolwinter added the bug Something isn't working label Aug 26, 2024
Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

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

Just a few small tweaks needed. Also, why was LICENSE.md renamed to LICENSE2.md?

@thecoolwinter
Copy link
Collaborator Author

Just a few small tweaks needed. Also, why was LICENSE.md renamed to LICENSE2.md?

Haha whoops, I made another PR fixing some renaming stuff and renamed that file in the demo video.

Copy link
Member

@tom-ludwig tom-ludwig left a comment

Choose a reason for hiding this comment

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

Ship it!

Copy link
Collaborator

@austincondiff austincondiff left a comment

Choose a reason for hiding this comment

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

This is some really nice work!

@thecoolwinter thecoolwinter merged commit a78e586 into CodeEditApp:main Aug 31, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🐞 Source control gives error when directory name has a space in it
3 participants