Skip to content

Commit 13d8c0a

Browse files
authored
Skip check when remote_oid is zero
Without this change, a command like ``` git push origin HEAD:refs/heads/new-branch ``` will produce this error: ``` fatal: bad object 0000000000000000000000000000000000000000 ```
1 parent e12f685 commit 13d8c0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pre-push.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ zero="$(git hash-object --stdin </dev/null | tr '0-9a-f' '0')"
55
# shellcheck disable=SC2034
66
while read -r local_ref local_oid remote_ref remote_oid
77
do
8-
if [ "$local_oid" = "$zero" ]; then
8+
if [ "$local_oid" = "$zero" ] || [ "$remote_oid" = "$zero" ]; then
99
continue
1010
fi
1111

0 commit comments

Comments
 (0)