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

[FIX] Store full commit hash in version sync file instead of short #205

Open
isak102 opened this issue Apr 27, 2024 · 7 comments · May be fixed by #208
Open

[FIX] Store full commit hash in version sync file instead of short #205

isak102 opened this issue Apr 27, 2024 · 7 comments · May be fixed by #208
Labels
bug Something isn't working

Comments

@isak102
Copy link

isak102 commented Apr 27, 2024

I regularly run into this problem when trying to use bob sync

❯ bob sync
Apr 27 11:56:08.087  INFO Starting sync process
Apr 27 11:56:08.087  INFO Using version 15c6909 set in /home/isak102/.local/share/chezmoi/dot_config/nvim/nvim.version
fatal: couldn't find remote ref 15c6909
Apr 27 11:56:08.553 ERROR Error: fetching remote failed, try providing the full commit hash

Is there any specific reason why the short hash is stored in the version sync file and not the full hash? If not, I am willing to open a PR to fix this

@MordechaiHadad MordechaiHadad added the bug Something isn't working label Apr 30, 2024
@MordechaiHadad
Copy link
Owner

MordechaiHadad commented Apr 30, 2024

Hello apologies for the delayed response, please go ahead.
All you need to do is:
go to this function here:
https://github.com/MordechaiHadad/bob/blob/master/src/handlers/use_handler.rs#L55

and everywhere u see fs::write(..., &version.tag_name) change it so it checks if VersionType of version is hash pass the non_parsed_version otherwise pass tag_name

EDIT: you can create a var called file_version which will have an if clause which will either be tag_name or non_parsed_version depending on the VersionType

@MordechaiHadad MordechaiHadad linked a pull request May 9, 2024 that will close this issue
@MordechaiHadad
Copy link
Owner

@isak102 hello can you confirm this PR works for you?

@isak102
Copy link
Author

isak102 commented May 9, 2024

Thanks! Yes it is working

@MordechaiHadad
Copy link
Owner

Thanks! Yes it is working

Great I'll have to tweak it a bit before i can finally ship it since bob currently saves the build with the shortened hash which needs to be tweaked (ill probably write the full hash in a file.

@isak102
Copy link
Author

isak102 commented May 9, 2024

Yeah my bad, I didnt test actually opening Neovim, I just looked if it was saving the full hash in the file. When I try to open neovim I get this error

thread 'main' panicked at src/main.rs:97:14:
Failed to spawn child process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@MordechaiHadad
Copy link
Owner

Yeah my bad, I didnt test actually opening Neovim, I just looked if it was saving the full hash in the file. When I try to open neovim I get this error

thread 'main' panicked at src/main.rs:97:14:
Failed to spawn child process: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

ye lol

@MordechaiHadad
Copy link
Owner

@isak102 It should work now, the steps to test is:

  1. Copy newest bob version to nvim-bin
  2. Remove the old binary
  3. Rename the copy to nvim
  4. Use bob use <hash> (if it gives an error to already built version add file called full-hash.txt with the full hash of the commit to the root directory of the version)
  5. Execute neovim like you would normally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants