From patchwork Wed Sep 23 09:38:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Denton Liu X-Patchwork-Id: 11794419 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 80DAB112C for ; Wed, 23 Sep 2020 09:39:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 629382371F for ; Wed, 23 Sep 2020 09:39:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="twprkCyr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726419AbgIWJjA (ORCPT ); Wed, 23 Sep 2020 05:39:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726102AbgIWJi5 (ORCPT ); Wed, 23 Sep 2020 05:38:57 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B17AC0613CE for ; Wed, 23 Sep 2020 02:38:57 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id u3so2877350pjr.3 for ; Wed, 23 Sep 2020 02:38:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aKUQW6AJ67TDxeKFE8lBYlSpxope2iA8F8Iyakiw5L8=; b=twprkCyr64UiFz9mnWJUbN15wazHKAhU9aCbH8gQcyiUG81ULoPkAAimSRMzjZICok RSq4x/QzFF4eF1CDciZxQjiVBvggxD3aGSQszs22lHc56BMQa3D9iv1939F6DVeWl9Dk fxT/m3NbJI8yaD159mwbR5DTmxQA38rHdTTYVMw64slCW0v1xPF/Ku2lER8nGY5RjA58 L3ZZ8pR/5PK0FNhnOB6L0uM4GFk+gfWVRhVysxKeoO9E4NHrqItrBQYKyG/UK9xDTUDt JeGQPxv1bpLn9tbzGE61zVu3jB44wbBb2oAORXS0a0R4quLKYRzOdIgssIIjrcNuPijp NLPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aKUQW6AJ67TDxeKFE8lBYlSpxope2iA8F8Iyakiw5L8=; b=ATzazv1NY8+04kJCrRNHaDmR09iHb83qKNJ28N/Q92+J53JjNc4QM6l0Ln8VE5+d5r u4bUHTsOWY+gjr7cTOnRdqYzO5qJyTnW28PqvCD3ludc9HFDX7+yCFqr+hJwgHC4EHy+ 3j8mi8fMi3TTv59OEHOoTIRKjQndu7UOZBNW5h9H4flASHfpEXxkT8AiWfqT2ZTVebYV lXDfA9SLUwosMZ/bsGPvTIox5tHvJt6hENd96NSpkKoFDOqlG/516SCkudxl+cIdxLzJ DjM1edFtFPH33ME172xaFAkZXA/w+hcHzDLuqjW6IJwLl/uMZNDCsOklWEgYi8Ekqtey QnZA== X-Gm-Message-State: AOAM530mygNcoqtBNbWv5mtgpY/Qri+096q4OMkHjbzylKBQ1YPGTAQ6 YHemYTh1q3fWynqTJR9WjV7Wi/CBHLA= X-Google-Smtp-Source: ABdhPJzwhcpihm02wOafPwpxRJaO5bPbL2LecjvYWfFMkXFmJMT6hHblUqtwKv0yQhwu9gmd+M+TXA== X-Received: by 2002:a17:90b:4a47:: with SMTP id lb7mr7434258pjb.196.1600853936923; Wed, 23 Sep 2020 02:38:56 -0700 (PDT) Received: from archbookpro.hsd1.ca.comcast.net ([2601:647:4201:c540::414c]) by smtp.gmail.com with ESMTPSA id gm17sm4564464pjb.46.2020.09.23.02.38.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Sep 2020 02:38:56 -0700 (PDT) From: Denton Liu To: Git Mailing List Cc: "brian m . carlson" , Eric Sunshine , Taylor Blau , Junio C Hamano , Chris Torek , Andreas Schwab Subject: [PATCH v2 2/3] hooks--pre-push.sample: use hash-agnostic zero OID Date: Wed, 23 Sep 2020 02:38:44 -0700 Message-Id: X-Mailer: git-send-email 2.28.0.760.g8d73e04208 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The pre-push sample hook has the zero OID hardcoded as 40 zeros. However, with the introduction of SHA-256 support, this assumption no longer holds true. Replace the hardcoded $z40 with a call to git hash-object --stdin --- templates/hooks--pre-push.sample | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/hooks--pre-push.sample b/templates/hooks--pre-push.sample index d0f30190ac..4ce688d32b 100755 --- a/templates/hooks--pre-push.sample +++ b/templates/hooks--pre-push.sample @@ -22,16 +22,16 @@ remote="$1" url="$2" -z40=0000000000000000000000000000000000000000 +zero=$(git hash-object --stdin