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

Source Control Settings #1926

Open
wants to merge 26 commits into
base: main
Choose a base branch
from

Conversation

austincondiff
Copy link
Collaborator

@austincondiff austincondiff commented Oct 29, 2024

Description

Our source control settings currently do not work. This PR enables many of these settings. Some of these settings use the users git config so we are introducing functionality to get and set based on config keys. As the user types, we want to debounce the set function, so we are also introducing Limiter which has debounce and throttle methods.

Related Issues

Checklist

  • Enable source control
  • Refresh local status automatically
  • Fetch and refresh server status automatically
  • Default branch name
  • Author Name
  • Author Email
  • Prefer to rebase when pulling
  • Show merge commits in per-file log
  • Ignored Files

  • 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

Screen.Recording.2024-10-28.at.10.30.31.PM.mov
Screen.Recording.2024-10-28.at.10.50.04.PM.mov
Screen.Recording.2024-10-28.at.10.58.13.PM.mov
image image image

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.

Some improvements are needed before merging.

@austincondiff austincondiff changed the title Enabled Source Control Settings Source Control Settings Dec 2, 2024
ignoreGlobPatterns.append(GlobPattern(value: ""))
}

func removePatterns(_ selection: Set<UUID>? = nil) {
Copy link
Member

Choose a reason for hiding this comment

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

Because we are using a set here, we can take advantage of its constant look up times:

if let selection, !selection.isEmpty {
    let patternsToRemove = Set(selection.compactMap { getPattern(for: $0) })
    ignoreGlobPatterns.subtract(patternsToRemove)
}
self.selection.removeAll()

@@ -130,6 +133,15 @@ struct WorkspaceView: View {
: themeModel.selectedLightTheme
}
}
.onChange(of: sourceControlIsEnabled) { newValue in
if !newValue {
Copy link
Member

Choose a reason for hiding this comment

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

Im still confused by this, can someone take a look at this too? The branches seem to be inverted. When source control gets enabled, we will set the branch to nil. When it gets disabled, we refresh the current branch.

FileManager.default.createFile(atPath: fileURL.path, contents: nil)
}

NSDocumentController.shared.openDocument(
Copy link
Member

Choose a reason for hiding this comment

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

Will this need an await like in line 224 in the openGitIgnoreFile function?

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.

3 participants