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

No error when git fails to add/commit #276

Open
jorgen99 opened this issue Sep 30, 2023 · 1 comment
Open

No error when git fails to add/commit #276

jorgen99 opened this issue Sep 30, 2023 · 1 comment

Comments

@jorgen99
Copy link

jorgen99 commented Sep 30, 2023

I had problems importing multiple files. It looked like the files are imported ok. But running "nb git log" I could see that some imports was not commited. "nb git status" lists them as untracked.

It's my git config that doesn't let me add files with CRLF line terminators so nb fails to add them to the index.

Since the repo is now out of sync with the files on disk, when I try to delete one of them I get an error:

fatal: pathspec '/Users/jorgen/.nb/home/somefile.org' did not match any files

The workaround of course is to fix my files so that git will accept them, but it would also be nice if nb would tell you that something went wrong.

How to reproduce:

$ git config --global core.safecrlf true
<create file with CRLF>
$ nb import <file>
<file is imported fine>
$ nb delete <id> // will be an error
$ nb git status // the file will be listed as untracked
@xwmx
Copy link
Owner

xwmx commented Oct 4, 2023

@jorgen99 Thanks for the information.

Currently the git operations are handled in the background after the item is added to the .index. Checking for git errors seems like it would require revering that order of operations and waiting for the git operations to finish. It might be better to allow them in the .index and ignore the git error during operations like delete, though this would result in clones having entries in .index that reference files that aren't in the repo.

I'll have to think more about how to handle these files.

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

No branches or pull requests

2 participants