A new branch raise an error even if the job is done #1674

Closed
opened 2025-11-02 04:09:10 -06:00 by GiteaMirror · 8 comments
Owner

Originally created by @tst2005 on GitHub (Apr 3, 2018).

  • Gitea version (or commit ref): 1.4.0 (final release) (issue initially got on 1.4.0rc3)
  • Git version: 2.1.4
  • Operating system:
  • 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

Done on any repo (test made on a fresh new repo, after the initial commit)

  1. I'm creating a "new file" (named test.md) in a "new branch" (a banch named test) with a commit message test
  2. I got the following error message, with a HL on the filename (like a bad file name)
PushUpdate: newCommit.CommitsBeforeLimit: exit status 129 - error: unknown option `contains' usage: git for-each-ref [options] [] -s, --shell quote placeholders suitably for shells -p, --perl quote placeholders suitably for perl --python quote placeholders suitably for python --tcl quote placeholders suitably for tcl --count show only matched refs --format format to use for the output --sort field name to sort on
  1. in fact the branch test successfully is created.

It seems a "post-*" hook issue.

Screenshots

  1. and 2. create a new file in a new branch

  2. the-branch-is-created

Originally created by @tst2005 on GitHub (Apr 3, 2018). - Gitea version (or commit ref): 1.4.0 (final release) (issue initially got on 1.4.0rc3) - Git version: 2.1.4 - Operating system: - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description Done on any repo (test made on a fresh new repo, after the initial commit) 1. I'm creating a "new file" (named `test.md`) in a "new branch" (a banch named `test`) with a commit message `test` 2. I got the following error message, with a HL on the filename (like a bad file name) ``` PushUpdate: newCommit.CommitsBeforeLimit: exit status 129 - error: unknown option `contains' usage: git for-each-ref [options] [] -s, --shell quote placeholders suitably for shells -p, --perl quote placeholders suitably for perl --python quote placeholders suitably for python --tcl quote placeholders suitably for tcl --count show only matched refs --format format to use for the output --sort field name to sort on ``` 3. in fact the branch `test` successfully is created. It seems a "post-*" hook issue. ## Screenshots 1. and 2. ![create a new file in a new branch](https://user-images.githubusercontent.com/1117821/38262877-be3219e8-376e-11e8-98cb-24771dca2ae6.png) 3. ![the-branch-is-created](https://user-images.githubusercontent.com/1117821/38262879-c23be7d0-376e-11e8-802d-80ddfa965a39.png)
GiteaMirror added the type/bug label 2025-11-02 04:09:10 -06:00
Author
Owner

@berkus commented on GitHub (Jun 4, 2018):

Getting this with pushes to repo, any idea how it could be fixed?

This in the logs:

2018/06/04 23:40:27 [T] PushUpdate: http://0.0.0.0:3000/api/internal/push/update
2018/06/04 23:40:27 [...io/gitea/cmd/hook.go:212 runHookPostReceive()] [E] Update: Failed to update public key: newCommit.CommitsBeforeLimit: exit status 129 - error: unknown option `contains'
usage: git for-each-ref [options] [<pattern>]

    -s, --shell           quote placeholders suitably for shells
    -p, --perl            quote placeholders suitably for perl
    --python              quote placeholders suitably for python
    --tcl                 quote placeholders suitably for tcl

    --count <n>           show only <n> matched refs
    --format <format>     format to use for the output
    --sort <key>          field name to sort on
@berkus commented on GitHub (Jun 4, 2018): Getting this with pushes to repo, any idea how it could be fixed? This in the logs: ``` 2018/06/04 23:40:27 [T] PushUpdate: http://0.0.0.0:3000/api/internal/push/update 2018/06/04 23:40:27 [...io/gitea/cmd/hook.go:212 runHookPostReceive()] [E] Update: Failed to update public key: newCommit.CommitsBeforeLimit: exit status 129 - error: unknown option `contains' usage: git for-each-ref [options] [<pattern>] -s, --shell quote placeholders suitably for shells -p, --perl quote placeholders suitably for perl --python quote placeholders suitably for python --tcl quote placeholders suitably for tcl --count <n> show only <n> matched refs --format <format> format to use for the output --sort <key> field name to sort on ```
Author
Owner

@techknowlogick commented on GitHub (Jun 4, 2018):

@berkus What version of Gitea are you using (and also what version of Git are you using)?

@techknowlogick commented on GitHub (Jun 4, 2018): @berkus What version of Gitea are you using (and also what version of Git are you using)?
Author
Owner

@lafriks commented on GitHub (Jun 5, 2018):

Can you please check if 1.4.2 has fixed this issue?

@lafriks commented on GitHub (Jun 5, 2018): Can you please check if 1.4.2 has fixed this issue?
Author
Owner

@tst2005 commented on GitHub (Jun 5, 2018):

Yes I confirmed : 1.4.1 = bug ; 1.4.2 = FIXED
(FYI I still have git version 2.1.4)

@tst2005 commented on GitHub (Jun 5, 2018): Yes I confirmed : 1.4.1 = bug ; 1.4.2 = FIXED (FYI I still have git version 2.1.4)
Author
Owner

@tst2005 commented on GitHub (Jun 5, 2018):

Do you know what is changed to fix the issue ?

@tst2005 commented on GitHub (Jun 5, 2018): Do you know what is changed to fix the issue ?
Author
Owner

@daviian commented on GitHub (Jun 5, 2018):

We had a bug in our git package that used --contains option which isn't available in older git version.
It was fixed by implementing a fallback solution for versions not supporting it.

@daviian commented on GitHub (Jun 5, 2018): We had a bug in our git package that used `--contains` option which isn't available in older git version. It was fixed by implementing a fallback solution for versions not supporting it.
Author
Owner

@berkus commented on GitHub (Jun 5, 2018):

I tried with the build from master (would be 1.5.0) and it works fine now!

@berkus commented on GitHub (Jun 5, 2018): I tried with the build from `master` (would be 1.5.0) and it works fine now!
Author
Owner

@lafriks commented on GitHub (Jun 5, 2018):

Closing issue as fixed, please reopen if issue persists in latest version

@lafriks commented on GitHub (Jun 5, 2018): Closing issue as fixed, please reopen if issue persists in latest version
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1674