-
-
Notifications
You must be signed in to change notification settings - Fork 366
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
Staging a deleted file throws "Could not read file" #1042
Comments
In git Web terminal I've used this code: if (!long_options.includes(/--cached/)) {
git.remove({fs, dir, filepath}).then(() => fs.unlink(path_name));
} else {
git.remove({fs, dir, filepath})
} So you can use hack, create empty file in place of deleted file use git.remove and then unlink. Maybe git.remove should handle deleted files. |
Thanks @jcubic for the workaround, I will try! Regarding:
That sounds kind of different from my expectation, my thought is that "git.add" should handle it, because I'm "adding changes" to the staging area, no matter what the change type is (add/modify/delete)? |
Yeah. That's probably not a bad idea. Or maybe we could make two new commands and call them But yes, the short answer / workaround for now is |
Thanks for replies! Closing as it's clear now. |
I'm working on a case where I renamed a file which resulted in 1 untracked and 1 deleted file.
It works but I'm still confused. I though Anyway, to add up, we can remove the deleted-and-staged file from staging by creating an empty file of the same name , add it to staging, then unlink the file. Still, a little weird, but the status matrix does match up with a local git repository. await compoFile.TaskAddFile('style.css', '');
git.add({fs, dir:'/', filepath:'style.css'}).then(() => fs.promises.unlink('/style.css')); |
Hey guys, thanks for working on this awesome project! I'm using it with Node.js, and it works pretty well.
The only confusing stuff to me is that I don't know how to add a deleted file to the staging area.
I'm trying to use git.add to accomplish this, but when the file is a deleted file (manually deleted in the file system), it throws a Could not read file "FILE NAME" exception.
Is there any way to do that? I suppose there must be something I missed, but I couldn't find it in the documentation site.
Thanks in advance.
The text was updated successfully, but these errors were encountered: