gfold icon indicating copy to clipboard operation
gfold copied to clipboard

Error: no reference found for shorthand 'origin/HEAD'

Open BerkeleyTrue opened this issue 2 years ago • 4 comments

After updating to 4.0 recently I started experiencing this issue.

Error: no reference found for shorthand 'origin/HEAD'; class=Reference (4); code=NotFound (-3)

image

Downgrading back to 3.0 doesn't show the same issue image

I saw there was a PR for a similar issue that was merged in quite some time ago. Did that not make it into the new release?

BerkeleyTrue avatar May 12 '22 02:05 BerkeleyTrue

Ah yes, I thought it had been fixed with #192 or another issue that I am not recalling at the moment. Thanks for filing the issue; I'll look into it.

Would you mind running with RUST_LOG=debug RUST_BACKTRACE=1 gfold? Please feel free to redact any sensitive information, though I doubt that'll be the case.

nickgerace avatar May 12 '22 19:05 nickgerace

@nickgerace Here is the output in a gist

https://gist.github.com/BerkeleyTrue/b9699f9dbd27e6b11e71ce57b314d2a6

BerkeleyTrue avatar May 16 '22 15:05 BerkeleyTrue

I'm also still seeing this issue when the remote is something else then origin.

AckslD avatar May 23 '22 11:05 AckslD

Thank you @BerkeleyTrue and @AckslD. I'll try to catch this bug by adjusting the integration test payload and see what I can do.

nickgerace avatar May 23 '22 16:05 nickgerace

@nickgerace I made an attempt to add a failing test reproducing this in #210. My rust skills are not very high but I hope it can help to find the underlying issue :)

AckslD avatar Nov 09 '22 21:11 AckslD

Merged #210 and going to look further. CI needs to catch this as well if it does not.

nickgerace avatar Dec 19 '22 23:12 nickgerace

Thank to @AckslD's PR, I think I figured it out.

The app tries to determine if a repository (with its current checked out branch) is in the "unpushed" state by checking if the local branch has a corresponding remote. If it does, then we check if the commits match. If it doesn't then we assume that the state is "unpushed". The problem here was in the latter check. During that check, we try to resolve the reference with a given short name, but we would fail if we could not. Well, if a remote branch doesn't exist with that short name (e.g. origin/HEAD), then we will always fail, which is undesired behavior. I believe #215 should solve the issue.

EDIT: if #215 did not solve the problem, I'll re-open this issue.

nickgerace avatar Dec 20 '22 19:12 nickgerace

Thanks @nickgerace, things seem to indeed work now for me :)

AckslD avatar Jan 04 '23 02:01 AckslD

Glad to hear!

nickgerace avatar Jan 04 '23 19:01 nickgerace