[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] The pre-push hook reports unfetched remote commits clearly
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH] The pre-push hook reports unfetched remote commits clearly |
Date: |
Mon, 05 Apr 2021 15:38:19 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
Hi Ege.
LGTM.
OK for both master and maint/poke-1.
> Regards
> Ege
>
> commit 1bf71407c6c1017115d398ac2bdd5feae6a0f988
> Author: Egeyar Bagcioglu <egeyar@gmail.com>
> Date: Mon Apr 5 15:25:15 2021 +0200
>
> The pre-push hook reports unfetched remote commits
>
> 2021-04-05 Egeyar Bagcioglu <egeyar@gmail.com>
>
> * etc/git-hooks/pre-push: Report it clearly when the pre-push hook
> fails due to remote containing unfetched commits.
>
> diff --git a/ChangeLog b/ChangeLog
> index c3955cbf..29c636da 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +
> +2021-04-05 Egeyar Bagcioglu <egeyar@gmail.com>
> +
> + * etc/git-hooks/pre-push: Report it clearly when the pre-push hook
> + fails due to remote containing unfetched commits.
> +
> 2021-04-05 Jose E. Marchesi <jemarch@gnu.org>
>
> * poke/poke.c (initialize): Load pk-hserver.pk directly.
> diff --git a/etc/git-hooks/pre-push b/etc/git-hooks/pre-push
> index b7c5d2ff..943945b9 100755
> --- a/etc/git-hooks/pre-push
> +++ b/etc/git-hooks/pre-push
> @@ -42,8 +42,17 @@ do
> # New branch, examine all commits
> range="$local_sha"
> else
> - # Update to existing branch, examine new commits
> - range="$remote_sha..$local_sha"
> + # Without this check, the "git diff-tree" below fails
> and
> + # this hook falsely reports "ChangeLog is missing."
> when the
> + # remote has unfetched commits.
> + if test $(git cat-file -t $remote_sha^{commit})
> + then
> + # Update to existing branch, examine new commits
> + range="$remote_sha..$local_sha"
> + else
> + echo "Remote contains unfetched commits"
> + exit 1
> + fi
> fi
>
> # Check for ChangeLog being in each commits