Repo indexer chokes with submodules #3714

Closed
opened 2025-11-02 05:22:46 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @guillep2k on GitHub (Aug 1, 2019).

  • Gitea version (or commit ref): v1.9.0
  • Git version: 2.22.0
  • Operating system: CentOS 7
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

When a repository has submodules, function models/repo_indexer.go:addUpdate() returns exit status 128 - fatal: git cat-file: could not get object info and further processing on the repo is aborted.

I've added additional logs to the function:

image

And I've got:

2019/08/01 15:56:01 .../xorm/session_raw.go:87:queryRow() [I] [SQL] SELECT count(*) FROM "notification" WHERE (user_id = $1) AND (status = $2) []interface {}{9, 0x1}
2019/08/01 15:56:03 ...dels/repo_indexer.go:207:addUpdate() [E] addUpdate: exit status 128 - fatal: git cat-file: could not get object info
        ; update.BlobSha: 9aef6c8b728958f722f160c8c34fc85790ec2ae8; repo.path: /home/git/gitea-repositories/gprandi/avl-comunicaciones.git, filename: avl-libs-bin

In this case, avl-libs-bin is a submodule. The following command fails as expected:

$ cd /home/git/gitea-repositories/gprandi/avl-comunicaciones.git
$ git cat-file -s 9aef6c8b728958f722f160c8c34fc85790ec2ae8:avl-libs-bin
fatal: Not a valid object name 9aef6c8b728958f722f160c8c34fc85790ec2ae8:avl-libs-bin

The hash 9aef6c8b728958f722f160c8c34fc85790ec2ae8 does not belong to this repository, but to the submodule's. The object type for that entry is "commit":

$ git ls-tree master
100644 blob 07f549803e107d232d61e0a89c179f6d3a5c1abf    .gitattributes
100644 blob 892ca8e3c1bd4bcddab831e6ecde2910d1d80bc0    .gitignore
100644 blob 166aa8b77976abf066e12abae4f20570202a28ca    .gitmodules
040000 tree 68f80510880d7078e7937b3944cf395a203333e2    CommLib
040000 tree 4ab4458e94f2d63c16eb30645949c57db7eb3fc6    FullDevLogReplicator
100644 blob d1ba69f092c97d9ed3c5a0fabd1d4004c4863897    README.md
100644 blob 08906d481771dcade1cf7390f24d4ad83ce07965    avl-comunicaciones.sln
160000 commit 9aef6c8b728958f722f160c8c34fc85790ec2ae8  avl-libs-bin
[...]

I'll attempt a PR about this.

Originally created by @guillep2k on GitHub (Aug 1, 2019). - Gitea version (or commit ref): v1.9.0 - Git version: 2.22.0 - Operating system: CentOS 7 - Database (use `[x]`): - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description When a repository has submodules, function `models/repo_indexer.go:addUpdate()` returns `exit status 128 - fatal: git cat-file: could not get object info` and further processing on the repo is aborted. I've added additional logs to the function: ![image](https://user-images.githubusercontent.com/18600385/62321335-c377e300-b478-11e9-97a8-a0689e5b8a87.png) And I've got: ``` 2019/08/01 15:56:01 .../xorm/session_raw.go:87:queryRow() [I] [SQL] SELECT count(*) FROM "notification" WHERE (user_id = $1) AND (status = $2) []interface {}{9, 0x1} 2019/08/01 15:56:03 ...dels/repo_indexer.go:207:addUpdate() [E] addUpdate: exit status 128 - fatal: git cat-file: could not get object info ; update.BlobSha: 9aef6c8b728958f722f160c8c34fc85790ec2ae8; repo.path: /home/git/gitea-repositories/gprandi/avl-comunicaciones.git, filename: avl-libs-bin ``` In this case, `avl-libs-bin` is a submodule. The following command fails as expected: ``` $ cd /home/git/gitea-repositories/gprandi/avl-comunicaciones.git $ git cat-file -s 9aef6c8b728958f722f160c8c34fc85790ec2ae8:avl-libs-bin fatal: Not a valid object name 9aef6c8b728958f722f160c8c34fc85790ec2ae8:avl-libs-bin ``` The hash 9aef6c8b728958f722f160c8c34fc85790ec2ae8 does not belong to this repository, but to the submodule's. The object type for that entry is "commit": ``` $ git ls-tree master 100644 blob 07f549803e107d232d61e0a89c179f6d3a5c1abf .gitattributes 100644 blob 892ca8e3c1bd4bcddab831e6ecde2910d1d80bc0 .gitignore 100644 blob 166aa8b77976abf066e12abae4f20570202a28ca .gitmodules 040000 tree 68f80510880d7078e7937b3944cf395a203333e2 CommLib 040000 tree 4ab4458e94f2d63c16eb30645949c57db7eb3fc6 FullDevLogReplicator 100644 blob d1ba69f092c97d9ed3c5a0fabd1d4004c4863897 README.md 100644 blob 08906d481771dcade1cf7390f24d4ad83ce07965 avl-comunicaciones.sln 160000 commit 9aef6c8b728958f722f160c8c34fc85790ec2ae8 avl-libs-bin [...] ``` I'll attempt a PR about this.
GiteaMirror added the type/bug label 2025-11-02 05:22:46 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#3714