#665 pre-push-check command not found
Closed: Fixed by onosek. Opened by lcrpkking.

Hi,
Im using the 1.6.6-3.fc37 rpkg, it seems a new push hook added after the clone:

git push
.git/hooks/pre-push: line 11: pre-push-check: command not found

Where can i found the pre-push-check command


Hi,
can I ask how your .git/hooks/pre-push file looks?
The pre-push command is built in the fedpkg tool: fedpkg pre-push-check.
The hook script itself is generated after a dist-git repository is cloned by fedpkg clone.

Line 11 in my hook scripts look like:

fedpkg pre-push-check "$local_sha"

Btw, aren't you using rhpkg in this case?

Hello,
here's the pre-push file:

$ cat /tmp/mylcr/.git/hooks/pre-push
#!/bin/bash
_remote="$1"
_url="$2"
exit_code=0
while read -r _local_ref local_sha _remote_ref _remote_sha
do
    command -v  >/dev/null 2>&1 || { echo >&2 "Warning: '' is missing, \
pre-push check is omitted. See .git/hooks/pre-push"; exit 0; }
     pre-push-check "$local_sha"
    ret_code=$?
    if [ $ret_code -ne 0 ] && [ $exit_code -eq 0 ]; then
        exit_code=$ret_code
    fi
done
exit $exit_code

My use case is in my local copr dev environment, the dockerfile
Copr will using rpkg to import srpm into its own distgit and there's no fedpkg installed

Oh, I didn't expect the situation, where the executable tool is missing (fedpkg, rhpkg). I need to understand that.
For now, I can offer you a workaround

git push --no-verify

Removing the hook script after the clone also works.

Gotcha, already rollback to 1.65 :)

How is the clone itself performed on your side? The functionality is in the python3-rpkg library, but it is usually triggered by fedpkg|rhpkg.
You can, of course, clone manually by "git clone", but in this case, there is not hook script created.

Yeah, copr-distgit call the pyrpkg to clone from its inner distgit, the code

Thanks. That explains it.
I can fix that with some additional check (=code is executed without the fedpkg tool), so in this case, the hook script won't be generated. And thus its functionality will not be available.
I am sorry, I didn't expect this use case. Please, stay at 1.65 or use the workaround until the fix is released.

Commit 30f18973 fixes this issue

In F37 stable now.

I don't think it is common that sys.argv[0] is empty. Would you mind installing something like this?

-        if not tool_name:
+        if tool_name and "copr-distgit-process-import" in tool_name:

Or even better, perhaps only ever install the hook if fedpkg in tool_name?

I don't think it is common that sys.argv[0] is empty. Would you mind installing something like this?

-        if not tool_name:
+        if tool_name and "copr-distgit-process-import" in tool_name:

Or even better, perhaps only ever install the hook if fedpkg in tool_name?

Metadata Update from @onosek:
- Issue set to the milestone: 1.67

Metadata
Related Pull Requests