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

git: use go-git instead of commandline tools #164

Open
fho opened this issue Jul 2, 2020 · 1 comment
Open

git: use go-git instead of commandline tools #164

fho opened this issue Jul 2, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@fho
Copy link
Collaborator

fho commented Jul 2, 2020

Instead of using the git commandline tools, use https://github.com/go-git/go-git.
This way not external git binary will be required anymore to interact with git. It might also be a bit faster, then having to spawn an external tool

@fho fho added the enhancement New feature or request label Jul 2, 2020
@fho fho changed the title git: use https://github.com/go-git/go-git instead of commandline tools git: use go-git instead of commandline tools Sep 12, 2022
@fho
Copy link
Collaborator Author

fho commented Sep 12, 2022

As of now it is not possible to transition to go-git because of the following issues:

  • When using go-git to evaluate if files are untracked, it takes in our monorepo for one of the apps 1m42s to run baur ls inputs. With baur 2.0.0 it takes 0.5s. This is a blocker. There is a related open issue in go-git: Status() is slow with a large number of untracked files go-git/go-git#181

    func (r *Repository) WithoutUntrackedFiles(paths ...string) ([]string, error) {
    	wt, err := r.repo.Worktree()
    	if err != nil {
    		return nil, err
    	}   
    	status, err := wt.Status()
    	if err != nil {
    		return nil, fmt.Errorf("fetching worktree status failed: %w", err)
    	}    
    	res := make([]string, 0, len(paths))    
    	for _, p := range paths {
    		fmt.Printf("calling IsUntracked: %q\n", p)
    		if !status.IsUntracked(p) {
    			res = append(res, p)
    		}
    	}  
    	return res, nil
    }
  • According to worktree.Status() not respecting .gitignore go-git/go-git#500 go-git does not handle nested .gitignore files correctly

  • Retrieving the repository status fails if the new git fsmonitor is used: Worktree.Status() always fail go-git/go-git#299

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant