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

Feature: Use installed git.exe instead of libgit2 #16738

Open
3 tasks
heftymouse opened this issue Jan 26, 2025 · 3 comments
Open
3 tasks

Feature: Use installed git.exe instead of libgit2 #16738

heftymouse opened this issue Jan 26, 2025 · 3 comments

Comments

@heftymouse
Copy link
Contributor

What feature or improvement do you think would benefit Files?

Having this as an option would allow Files to easily support the full range of Git features, including automatically respecting the user's Git settings, using any authentication methods they have already configured, and pushing to ssh remotes. This is a fairly common way of implementing Git support, seen in software like vscode. Files can fall back to libgit2 for basic support if Git is not already installed (unlikely on a developer's machine)

Requirements

  • Introduce an IGitService abstraction and refactor the existing GitHelpers implementation to use it
  • Implement existing Git operations through git.exe and use this implementation if git.exe is found
  • Add configuration options

Files Version

3.8.13

Windows Version

10.0.27774.1000

Comments

No response

@Lamparter
Copy link
Contributor

I wrote just the thing for this!
Might need a bit more work, but it's a start.

@0x5bfa
Copy link
Member

0x5bfa commented Jan 26, 2025

I remember someone told me porcelain is better, perhaps you, and I think this is a good idea. Here's my thoughts:

I have been thinking about this being a standalone class like below and I think this would be instantiated through GitRepositoryFactory static class (e.g. GetOrCreate()) to retrieve one identical instance per the same git repo among tabs, panes and windows. This way prevents us from putting string path in each method.

public static class GitRepositoryFactory
{
    private Dictionary<string, GitRepository> lookupTable = [];

    public GitRepository? GetOrCreate(string path) {}
}
public partial sealed class GitRepository : IDisposable
{
    public GitRepository(string rootPath) {} // Ideally, not string but IFolder in the future.
}

I still haven't evaluate how difficult this is and how suitable this is so I can't say which is better for now but IGitRepositorySevice would work in this current codebase and be easier.

@yaira2 yaira2 moved this from 🆕 New to 📋 Planning stage in Files task board Jan 26, 2025
@yaira2
Copy link
Member

yaira2 commented Jan 27, 2025

Introduce an IGitService abstraction and refactor the existing GitHelpers implementation to use it

I need more time to review the full proposal, but we can certainly implement an abstraction for the existing git implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Planning stage
Development

No branches or pull requests

4 participants