resolveRef cannot find HEAD~1
See original GitHub issueI am using isomorphic-git 1.7.8 (aka the latest published version at the time of writing) with Node. I get the error below when passing HEAD~1
as ref
to the function resolveRef
.
NotFoundError: Could not find HEAD~1.
Since the ref
is passed as a command-line argument to my tool, a workaround is to fall back on git
and pass $(git rev-parse HEAD~1)
from the shell. But this is obviously not ideal…
Thank you for your support and for this great library!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
fatal: Failed to resolve HEAD as a valid ref - git - Stack Overflow
Looking around internet, I found it may be due to permission access. Could you give 777 permissions to the .git folder recursively ?...
Read more >Mark element at caret and FindUsage missing a resolved ...
When I do a "go to declaration" on this element, I correctly jump to the first "head=1". I have checked the reference connections...
Read more >isomorphic-git/index.d.ts - UNPKG
132, * - Server refs (they get returned by protocol version 1 whether you want ... Note that this option does not modify...
Read more >Diff - third_party/rapidjson - fuchsia Git repositories
See the License for the +// specific language governing permissions and ... + case kParseErrorObjectMissColon: return RAPIDJSON_ERROR_STRING("Missing a ...
Read more >[PATCH 0/9] Incremental po/git.pot update and new l10n workflow
We'd previously generate the header with xgettext(1), but now we'll be - carrying forward whatever header we find in po/git.pot. Right now this...
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 think it will be really hard to make it right. there are lot of references in git you can use a lot of different syntaxes. You would need to have a parser to implement them all. To give you perspective there are ^ that pick the branch if this is a merged branch. So you can use funky stuff like HEAD~2^1 and you probably I didn’t test combine ^ and ~ into the longer chain.
This is just an edge case that will need to complicate the library too much and it’s not worth it. if something will need ^ he will need to implement this herself. And it can be added into docs if something need this.
I prefer to document this as separated code where I show how to implement single
HEAD~2^2
and someone wants more he can implement a full parser on top of isomorphic-git.Actually, I can implement this in my project Git Web Terminal which is a better place for something like this. If I ever implement
HEAD .. ^
I probably be the only project that uses this.@jcubic would you be open to pull request adding something like the above to the library? Btw, thank you for picking development back up!