Issue #323: git hook error on push of first commit (conservancy/kallithea)

Thomas De Schampheleire issues-reply at bitbucket.org
Fri Jun 15 18:54:47 UTC 2018


New issue 323: git hook error on push of first commit
https://bitbucket.org/conservancy/kallithea/issues/323/git-hook-error-on-push-of-first-commit

Thomas De Schampheleire:

Kallithea default branch, commit eddb927e3473.
Steps to reproduce:

1. create new git repository via web UI
2. clone this repo to a filesystem location (via a terminal)
3. add a file and commit it
4. git push

Results in terminal:

```
$ git push                                                                                                                                                                                                      
Password for 'http://user@localhost:5000': 
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 1.32 MiB | 7.61 MiB/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: No handlers could be found for logger "kallithea.lib.vcs.backends.git.repository"
remote: Traceback (most recent call last):
remote:   File "hooks/post-receive", line 30, in <module>
remote:     main()
remote:   File "hooks/post-receive", line 26, in main
remote:     sys.exit(_handler(repo_path, git_stdin_lines, os.environ))
remote:   File "/home/tdescham/repo/contrib/kallithea/kallithea-release/kallithea/lib/hooks.py", line 372, in handle_git_post_receive
remote:     return handle_git_receive(repo_path, git_stdin_lines, env, hook_type='post')
remote:   File "/home/tdescham/repo/contrib/kallithea/kallithea-release/kallithea/lib/hooks.py", line 456, in handle_git_receive
remote:     git_revs += repo.run_git_command(cmd)[0].splitlines()
remote:   File "/home/tdescham/repo/contrib/kallithea/kallithea-release/kallithea/lib/vcs/backends/git/repository.py", line 158, in run_git_command
remote:     return self._run_git_command(cmd, **opts)
remote:   File "/home/tdescham/repo/contrib/kallithea/kallithea-release/kallithea/lib/vcs/backends/git/repository.py", line 150, in _run_git_command
remote:     raise RepositoryError(tb_err)
remote: kallithea.lib.vcs.exceptions.RepositoryError: Couldn't run git command (['git', '-c', 'core.quotepath=false', 'log', '3020a2edb3161ade744d605c27215fafdf4daad6', '--reverse', '--pretty=format:%H', '--not', '']).
remote: Original error was:Subprocess exited due to an error:
remote: fatal: ambiguous argument '': unknown revision or path not in the working tree.
remote: Use '--' to separate paths from revisions, like this:
remote: 'git <command> [<revision>...] -- [<file>...]'
remote: 
remote: 
To http://localhost:5000/gitrepo
 * [new branch]      master -> master
```

The commit gets pushed correctly, but the error sent to the client is disturbing. Problem seems to be the empty argument '' which is calculated from 

```
                    heads = heads.replace(push_ref['ref'], '')
                    for l in heads.splitlines():
                        cmd.append(l.strip())
```
(see kallithea/lib/hooks.py line 451)




More information about the kallithea-general mailing list