From patchwork Fri Oct 19 23:19:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Josh Steadmon X-Patchwork-Id: 10650215 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4DE94112B for ; Fri, 19 Oct 2018 23:19:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3DD0C27FA5 for ; Fri, 19 Oct 2018 23:19:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3120728458; Fri, 19 Oct 2018 23:19:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9C1D27FA5 for ; Fri, 19 Oct 2018 23:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726866AbeJTH1k (ORCPT ); Sat, 20 Oct 2018 03:27:40 -0400 Received: from mail-pg1-f201.google.com ([209.85.215.201]:39572 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbeJTH1j (ORCPT ); Sat, 20 Oct 2018 03:27:39 -0400 Received: by mail-pg1-f201.google.com with SMTP id n5-v6so4001763pgv.6 for ; Fri, 19 Oct 2018 16:19:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to :content-transfer-encoding; bh=l4SGLPDVfQ4+GVtK8OGRLuUzxCuPyq8Z1Afm0Ve2y2c=; b=tRr5xHaF5xvm1qva3Z1X7R+lIryw0pF6aEdHiG1Pedn0rWevJ0I1QyujHGO/ElfB6B Jy9GOWgSOvoHE3Lh/0r9d9PNdhWnBAsv7zF8nbjOqwL0HcDNKzW08Pav+wIN2w3H92eo tBouDv8Oye3Vtlv6nfRcpx5o68eOKmHO0RKPp/39wQvRctNeWHhJoc/HTJrq7ItQ6NOd WcOl8KSUkDcWsat6sgoREReyIx1TD77iRQyuapXKOPwfl+S67ysMQWeQ6U8gfSeGuJ5m 5vfsNFnh6EYspsOTecXvuGcuG6vHbfb7ybCRAdMVDPvEu7AuU0pkPg6QeKj6Xh6dFnqv SE7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to :content-transfer-encoding; bh=l4SGLPDVfQ4+GVtK8OGRLuUzxCuPyq8Z1Afm0Ve2y2c=; b=oZTe5NNY7eQ8XqFmNdtw0JcpeI0AXmfI04rz7xbLboNrcOmMsUx80tMWzPwNYv2G0z 6ws6Q6ex3gTt3EIg0v5E7QW4jRH8QJ9JopPXHfaCO29Pxffv6Hm2ECa/LzhdIkBV0WyQ Jamo1YhhSbTm8O5Du0OalqecF6RA6twCd7Cu7oYrjvNHYQ3fNxJi05NDFvzhiIAsnedS RiLnTpcaJBUOOMEVtJI71q8xZat1cJUj+eoNa+FgsYcET8oGgm7eX3764iHaD6AO+Fn5 liftg6jZwNpX5m9Qik55MmP/p2juXeD5VNl6U6F6nk8rkDEDSJluvTgccLV87hS4Ujg9 kN2w== X-Gm-Message-State: ABuFfojAtmQKBAg0j+8kkM6p6CWOeRzsnkYI9doRdS5R4WQJc5PYhrhU 90wEPgPva3HH2H5GnX/JB03OmI0MQXc47Inu8aH5Vv9hBWuNVP5VR36649vxUroLE1n/Qm0P8gH iXsUdE7JquFlYwfTVgwbyFnpnPGOueY8UgSj3pFQAIBbF5hrcM3BlsaoSVSGtKGo= X-Google-Smtp-Source: ACcGV61dgIoNEYNDthLCEQcevyC8I1CiaW9oh57ZsQZcqDXI0akbYEtXVfBpAX8tcJ9h1Q4pfH/JIGZi0TyVPA== X-Received: by 2002:a63:1b03:: with SMTP id b3-v6mr17893813pgb.13.1539991171407; Fri, 19 Oct 2018 16:19:31 -0700 (PDT) Date: Fri, 19 Oct 2018 16:19:27 -0700 Message-Id: Mime-Version: 1.0 X-Mailer: git-send-email 2.19.1.568.g152ad8e336-goog Subject: [PATCH 0/1] Fix format detection when archiving remotely From: steadmon@google.com To: git@vger.kernel.org Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, git-archive does not properly determine the desired archive format when both --output and --remote are provided, because run_remote_archiver() does not initialize the archivers prior to calling archive_format_from_filename(). This results in the remote archiver always returning a TAR file, regardless of the requested format. This patch initializes the TAR and ZIP archivers before calling archive_format_from_filename(), which fixes format detection. Steps to reproduce: ∫ git version git version 2.19.1.568.g152ad8e336-goog ∫ cd ~/src/git ∫ git archive --output ~/good.zip HEAD ∫ file ~/good.zip /home/steadmon/good.zip: Zip archive data, at least v1.0 to extract ∫ git archive --output ~/bad.zip --remote=. HEAD ∫ file ~/bad.zip /home/steadmon/bad.zip: POSIX tar archive (apply patch and build) ∫ ./bin-wrappers/git archive --output ~/fixed.zip --remote=. HEAD ∫ file ~/fixed.zip /home/steadmon/fixed.zip: Zip archive data, at least v1.0 to extract Josh Steadmon (1): archive: init archivers before determining format builtin/archive.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)