libgit2 / libgit2/rugged

"object not found - no match for id" in pre-receive hook

Open
#844 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

If I try to lookup the new commit hash from a pre-receive hook, I am getting the following error

object not found - no match for id

The lookup works correctly, when executed from the update hook.

But If I execute git show <new_hash> from the pre-receive hook, it is showing the diff.

I believe the following difference in the documentation for pre-commit and update hooksexplains why it is unavailable inpre-commit` hook.

pre-commit: Just before starting to update refs on the remote repository, the pre-receive hook is invoked.

update: Just before updating the ref on the remote repository, the update hook is invoked.

But still, why can't rugged access the received commit, even though the git executable is able to do it?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the lookup in a pre-receive hook and compare it with the update hook, including git show <new_hash> as described in the issue. Trace why Rugged cannot resolve the received commit while Git can; done means explaining the discrepancy and identifying the required fix or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, ruby
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.