Reconsider git.add supporting multiple files
See original GitHub issueHi there!
Firstly let me thank you for this project - It has been very useful to us in implementing the git functions we want to support!
That said I am now looking into some key performance issues and am finding the git.add to be a pain point for us.
I am wondering if you would reconsider implementing multi file support for git.add … I am asking because it appears to be very slow to add lots of files in a loop for specific git repositories.
On average it is taking 46ms for each call to await git.add
and we are looking to want to add 50-100 files at a time. Even on faster repositories its averaging around 30ms
perhaps something like this?
await git.add(file1.txt folder/file2.txt file3.txt file4.txt file5.txt)
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (9 by maintainers)
Top Results From Across the Web
git add multiple files at once - Stack Overflow
How to add multiple files with different extensions to git all at one time... You can add to git by explicitly listing each...
Read more >Learn Git Basics - Nulab
You can modify the most recent commit in the same branch by running git commit –amend. This command is convenient for adding new...
Read more >Introducing git-revise - NIKA:\>
git -revise uses a custom merge backend, which doesn't attempt to handle file renames or copies. For changes which need to be merged...
Read more >git-revise(1) – Efficiently update, split, and rearrange git commits
git revise is a git(1) subcommand to efficiently update, split, and rearrange commits. It is heavily inspired by git-rebase(1), however tries to be...
Read more >git-add Documentation - Git
This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’d like to implement this feature @wmhilton. For my usage, I’d like to see an aggregate of errors rather than failing on first step. I think we could
throw
an array ofError
s? What do you think?I think I need
add .
But will this work?
I’m confused because
git.listFiles({ fs, dir: '/tutorial' })
will return all files, not just non-added files.I can see faq have a similar snippet https://isomorphic-git.org/docs/en/faq#how-to-add-all-untracked-files-with-gitadd
I think both
globby(['./**', './**/.*'], { gitignore: true })
andgit.listFiles({ fs, dir: '/tutorial' })
will return all files. Which might makegit.add
run on many files that don’t need to be added?Maybe I should follow https://isomorphic-git.org/docs/en/statusMatrix#q-what-files-have-unstaged-changes
To use: