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

Error message: "Could not parse OID from string ref:refs/heads/main" #1321

Closed
jblebrun opened this issue May 22, 2024 · 5 comments · Fixed by #1322
Closed

Error message: "Could not parse OID from string ref:refs/heads/main" #1321

jblebrun opened this issue May 22, 2024 · 5 comments · Fixed by #1322
Labels
bug Something isn't working

Comments

@jblebrun
Copy link
Contributor

Description of the bug

I've started to see an error appearing when I navigate between branches in git branchless:

2024-05-22T18:25:56.228109Z ERROR git_branchless_hook: Could not parse reference-transaction-line err=
   0: Could not parse OID from string ref:refs/heads/main
   1: Git error GenericError: unable to parse OID - contains invalid characters

Location:
   git-branchless-lib/src/git/repo.rs:289

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   0: git_branchless_hook::reference_transaction::parse_reference_transaction_line with line="0000000000000000000000000000000000000000 ref:refs/heads/main HEAD"
      at git-branchless-hook/src/lib.rs:289
   1: git_branchless_hook::hook_reference_transaction with effects=<Output fancy=false> transaction_state="committed"
      at git-branchless-hook/src/lib.rs:418
   2: git_branchless_hook::command_main with ctx=CommandContext { effects: <Output fancy=false>, git_run_info: <GitRunInfo path_to_git="git" working_directory="/usr/local/google/home/jibbl/Projects/oak" env=not shown> } args=HookArgs { subcommand: ReferenceTransaction { transaction_state: "committed" } }
      at git-branchless-hook/src/lib.rs:527

It seems that it somehow gets the value ref:refs/heads/main in a position where a commit hash is expected.

I'm still digging into this more, but figured I'd file a bug in case anyone else has any hunches about what might be happening.
So far, all I can say is that I can't find any entry in the SQLite db that contains ref:refs/heads/main in that position; so I'm not sure where that's being introduced.

It seems that it's related to the state of the repository; even when I check out a fresh copy of the repository, this is happening. It just started happening yesterday or today, so perhaps it's somehow related to some commit metadata?

Functionally, everything still seems to work OK (it still switches tot he branch, for example).

Expected behavior

I expect the message not to appear.

Actual behavior

The message appears.

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

0.8.0

Version of git

2.45.1.288.patched (internal company version)

@jblebrun jblebrun added the bug Something isn't working label May 22, 2024
@jblebrun
Copy link
Contributor Author

It looks like this may be related to this recent change in git:

git/git@a8ae923

@jblebrun
Copy link
Contributor Author

I think I have a fix.

jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, this change runs the source string for MaybeZeroOid
conversions through git2::Oid::hash_object rather than using `parse` directly,
since `parse` into a `git2::Oid` object only supports 40 hex characters.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 22, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue May 23, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 8, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 8, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 8, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 8, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 8, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 10, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
jblebrun added a commit to jblebrun/git-branchless that referenced this issue Jun 10, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
arxanas pushed a commit that referenced this issue Jun 15, 2024
In git 2.45, reference transactions now support symbolic refs (see:
git/git@a8ae923)

To support this, we add a transaction reference resolver that's capable of
looking up the Oid for a named reference. It requires a repository object to
do this successfully.

To support the functionality, a new `refname_to_id` function is added to the
Repo object that calls the similarly named method on the inner repository to
get the `git2::Oid` for a given reference name.
@tperami
Copy link

tperami commented Aug 20, 2024

Hi,

Sorry if this was already planned, but since it seems to me that this was fixed more than 2 months ago, do you think it would be possible to make a new release that contains the fix?

@edward-evans-aiven
Copy link

#1388 and #1381 seem to be duplicates

@arxanas
Copy link
Owner

arxanas commented Oct 9, 2024

Closing as duplicate of #1388; follow there for updates.

@arxanas arxanas closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2024
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.

4 participants