From patchwork Sat Jan 26 20:49:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Staudt X-Patchwork-Id: 10782593 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 7630391E for ; Sat, 26 Jan 2019 20:51:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60EC42A9EC for ; Sat, 26 Jan 2019 20:51:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54E322CB45; Sat, 26 Jan 2019 20:51:08 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 02F242A9EC for ; Sat, 26 Jan 2019 20:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726370AbfAZUvG (ORCPT ); Sat, 26 Jan 2019 15:51:06 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:35596 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbfAZUvG (ORCPT ); Sat, 26 Jan 2019 15:51:06 -0500 Received: by mail-wm1-f68.google.com with SMTP id t200so9924712wmt.0 for ; Sat, 26 Jan 2019 12:51:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R8vG8/46ExJkrXbvChwtuYGy1qMXioW6XwG14U3wnuU=; b=kkeF4Ns9Xnc5PyggfqNmNSlCVDkf00voERUugbnRkdCpuGNfOfODe/SU4g6glwAFtG HVyUttB1VJsoXZCdwlt5tQTtIl3DWe5fuL0li/F5xJnLSnMLhWtEieOk0I9FCS0re2kr fgKrbt04c+/uMdfwabjXO2dzfDcztsSUj//BBKhO6Aj6cDQD4tF7rbi5jJUigIaU4qPh lSD3Kf1Qhqhp49a9u/pI8fjKf+RsYN3BwdJti2HES263J37O0Ix5VLcf4UesxNeLzMeA REjwuM4H7OEJ9iRqHI5GF3VA0L72S3w9xJZTnnM5BzzpAkiU/1BfHC/sb7yASdXRqUca D1Fw== 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:mime-version :content-transfer-encoding; bh=R8vG8/46ExJkrXbvChwtuYGy1qMXioW6XwG14U3wnuU=; b=YGux7mRHMCitzZdHT8cSxbdIV0qE0T1EVFYbXUihnObF/V6xO81wPEY1nIFwfzdPGp PCanwHiBkMAXniSBmCLGMSxxYaRLlYl2I9dLUSjw7nVTnXyCq/IH2Rxzm6iEMkfAsjOv OBzWniNRXrMywLZeXh+GCWG2wH3vwo9NaGtBaakx9y+x1o5NjMjTehwyvouAV2I1OYEp bNBmD1fxVWdsdri68um5dPeNe0UktEaV/JTKzNj2KN8J1P9TUA2W9pjZEg3nEyZQ7yrm +Sdu8TPIbGo2JOuDIu/cx/Bei8aceRg50R9YsdBEbCREbcR3UC12S5cVkl0DgQv6/2yW nB3Q== X-Gm-Message-State: AJcUukfjGqN0ikM2AULozZHPoi1KHPZFNemQOn/0NFpyGG1P5QaZnxBN s1G1+l1/HFeEZu14q1vofUPCV0zaFvE= X-Google-Smtp-Source: ALg8bN7zjzX1gvm22fsQRkPrHww9/Xv5qQq7czOjtEc02u6rECQc6W5irJQHOme20VSc1WTsR19eLg== X-Received: by 2002:a1c:2314:: with SMTP id j20mr11219973wmj.142.1548535863685; Sat, 26 Jan 2019 12:51:03 -0800 (PST) Received: from localhost.localdomain (ip5b43d796.dynamic.kabel-deutschland.de. [91.67.215.150]) by smtp.gmail.com with ESMTPSA id m21sm48049415wmi.43.2019.01.26.12.51.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Jan 2019 12:51:02 -0800 (PST) From: Sebastian Staudt To: Git Mailing List Cc: Junio C Hamano , Jeff King , Duy Nguyen , Sebastian Staudt Subject: [PATCH v2 1/3] Add tests for describe with --work-tree Date: Sat, 26 Jan 2019 21:49:49 +0100 Message-Id: <20190126204951.42455-1-koraktor@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The dirty ones are already passing, but just because describe is comparing with the wrong working tree. Signed-off-by: Sebastian Staudt --- t/t6120-describe.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index d639d94696..9a6bd1541f 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -28,6 +28,24 @@ check_describe () { ' } +check_describe_worktree () { + cd "$TEST_DIRECTORY" + expect="$1" + shift + R=$(git --git-dir "$TRASH_DIRECTORY/.git" --work-tree "$TRASH_DIRECTORY" describe "$@" 2>err.actual) + S=$? + cat err.actual >&3 + test_expect_success "describe with --work-tree $*" ' + test $S = 0 && + case "$R" in + $expect) echo happy ;; + *) echo "Oops - $R is not $expect"; + false ;; + esac + ' + cd "$TRASH_DIRECTORY" +} + test_expect_success setup ' test_tick && @@ -145,14 +163,20 @@ check_describe A-* HEAD check_describe "A-*[0-9a-f]" --dirty +check_describe_worktree "A-*[0-9a-f]" --dirty + test_expect_success 'set-up dirty work tree' ' echo >>file ' check_describe "A-*[0-9a-f]-dirty" --dirty +check_describe_worktree "A-*[0-9a-f]-dirty" --dirty + check_describe "A-*[0-9a-f].mod" --dirty=.mod +check_describe_worktree "A-*[0-9a-f].mod" --dirty=.mod + test_expect_success 'describe --dirty HEAD' ' test_must_fail git describe --dirty HEAD ' From patchwork Sat Jan 26 20:49:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Staudt X-Patchwork-Id: 10782595 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 A139D922 for ; Sat, 26 Jan 2019 20:51:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 923F02A9EC for ; Sat, 26 Jan 2019 20:51:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86D2B2CB45; Sat, 26 Jan 2019 20:51:09 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 42FD22A9EC for ; Sat, 26 Jan 2019 20:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726380AbfAZUvH (ORCPT ); Sat, 26 Jan 2019 15:51:07 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42259 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726361AbfAZUvH (ORCPT ); Sat, 26 Jan 2019 15:51:07 -0500 Received: by mail-wr1-f68.google.com with SMTP id q18so13800979wrx.9 for ; Sat, 26 Jan 2019 12:51:06 -0800 (PST) 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=vWc5/f532QW6EynJZlIY671NQMxy3PpskJg8B9OXVE8=; b=jtpeeijwFscHWb9+IB9NYVnC4NRJg/GtPt2vlkfKoHvM5vMB1hftjm9+aE6/HJAzwu bGqGchhdmFVtIRWWXwJuICvrmkFOqguBtYBJh/LhNpR15PWfKllfnnaHmw1vM/xbsosT iEUzwRNW7PyGi4zpfZfxjpwWv9o0cJxHu7SPJnChbiOGumb5iEMDeK6uhTSVf3pTOaF0 rj1XG6qLasHF29KndZq2U8Wan7z2NV1hluhQCGIc8/gZXQPI1WEVN/P88/NvJ2gkTqCD 3oWY762kACJSrQpQxbTMYIxp31Wzkbo+UqT61X+ZhuKr6qQhTZHCsjd4WmjSDHh/vjM8 qijw== 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=vWc5/f532QW6EynJZlIY671NQMxy3PpskJg8B9OXVE8=; b=bWy1Nad5b0vgcj+WxpvkPa5yYWKPtmYR1kuXNyb15JfHZW0X6VVnoFyVZQIMU/psWk vYHdt1XyZOpmVVrTqCNoH790WFdBQNTAiuFFcXsOhHPeXij/kwCfZEgMYsqpO3UIwBJ+ ldb6paR5GOSfP85g6LLwu2CemEd638TObZNOX/0eEhPeDbcZSBFEjO5sE77twyf1FT9W x4pPMd7poCBIDEGzvCmiHdypwwXTCTQ7j1SduijGl+TK6fMeNcvjLaj7/FS8WAjffktM wd72KxJsSCnTQFWPDc3Fc3Z2rw8AfQUj39BTbd4Iu/yv4cLHX902k10mpkQdwKxozSna rCzA== X-Gm-Message-State: AJcUukf/0hWPdrZPI1rx+iFoD5la97zp1P3Byg/Hv22wJa4/BF3qmXQl 8MlAKHfnOKhjp4++S4QyJLCAhBDEwYE= X-Google-Smtp-Source: ALg8bN6OBY5/9Qpg68gQqHWjQ25zmH18PQMpd6g/lVhgd50HInJOkgOhNXim75Rrk+5pthkX0ovGzw== X-Received: by 2002:a5d:60cc:: with SMTP id x12mr15439746wrt.193.1548535865135; Sat, 26 Jan 2019 12:51:05 -0800 (PST) Received: from localhost.localdomain (ip5b43d796.dynamic.kabel-deutschland.de. [91.67.215.150]) by smtp.gmail.com with ESMTPSA id m21sm48049415wmi.43.2019.01.26.12.51.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Jan 2019 12:51:04 -0800 (PST) From: Sebastian Staudt To: Git Mailing List Cc: Junio C Hamano , Jeff King , Duy Nguyen , Sebastian Staudt Subject: [PATCH v2 2/3] Setup working tree in describe Date: Sat, 26 Jan 2019 21:49:50 +0100 Message-Id: <20190126204951.42455-2-koraktor@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190126204951.42455-1-koraktor@gmail.com> References: <20190126204951.42455-1-koraktor@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This ensures the given working tree is used for --dirty. The implementation of --broken uses diff-index which calls setup_work_tree() itself. Signed-off-by: Sebastian Staudt --- builtin/describe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/builtin/describe.c b/builtin/describe.c index cc118448ee..b5b7abdc8f 100644 --- a/builtin/describe.c +++ b/builtin/describe.c @@ -629,6 +629,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix) struct argv_array args = ARGV_ARRAY_INIT; int fd, result; + setup_work_tree(); read_cache(); refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL); From patchwork Sat Jan 26 20:49:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Staudt X-Patchwork-Id: 10782597 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 CEBBC922 for ; Sat, 26 Jan 2019 20:51:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEED92A9EC for ; Sat, 26 Jan 2019 20:51:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B383F2CB45; Sat, 26 Jan 2019 20:51:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 675422A9EC for ; Sat, 26 Jan 2019 20:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726249AbfAZUvJ (ORCPT ); Sat, 26 Jan 2019 15:51:09 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:38244 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726377AbfAZUvI (ORCPT ); Sat, 26 Jan 2019 15:51:08 -0500 Received: by mail-wm1-f67.google.com with SMTP id m22so9891506wml.3 for ; Sat, 26 Jan 2019 12:51:07 -0800 (PST) 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=vdSQN4ktLNcVQtX23FyHwyMCUqovRbimBqlqzriziG0=; b=A9zUgeZ957jh0vH5ustrhEXyzjHyUxGgUl2G9mgpFZPpsru0YZ5Yh7CCNpgP7Lhrg0 kFJ/4k4Flla8twzF+UY1ytQf/ppApLLY83mY0zbSLgbTWOOOZBaghPsMb8/mSNMZUE86 sG2ey1DzpSMdW9KUETMxzjT00IeyGxpVmo2mJWYrGltSZxz72NAk9RhV1oAtmlrpnngS dYrtb4fLeX9oodPaC8ccAk+rPVODagQw8fjFXGKT4izMImveDz+vRbNwJLcnz+JexjXj obpPFvLH5GMR+CmmHLMZAANl1CSev34HfFDG4XnhTAfkt2fWLqjNZn78SbxGeT1V4w1Z jCiA== 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=vdSQN4ktLNcVQtX23FyHwyMCUqovRbimBqlqzriziG0=; b=edv/mFKRUfHrDKVBbPGLsv1dNCFqQEsx6kxideMo0bZulwTtw6UhYDau9OH94NIapg 9qrOKpRIc8reBre8f/OjeS8jI1Osn/fzSHOS78n3LCuIKlQzHZdFmozALHZnhxV63Y4U bXHVWcuaGqe/2mOmLoH1tjZtxFJOK/sCf1M1p1osBZWId1mB6QTikGSaleeEJXL9t0mi Kw6+gtgN4yaIchbG7gOXTuAqnfNEy7J1gI2U19FAsvnjU129qzht+NlcCVlT6ejw/txO UaxF/aKReEnuNyiadpEiUoewIz4ULiRMj4Te6CnR0PgyNwfMDwbiRTR27ezuKYVzgUBH xTkg== X-Gm-Message-State: AJcUukfBX2IY6l3hotlGrxGYj1qDaHHn/BPg6dEQfPcKPw+LuEKfC+yD poFg/c8TOFp72DNj/3JumINF9/BfwHE= X-Google-Smtp-Source: ALg8bN5bgN+A9KFaZuvcCCs7ZAg9wOM/R/Dl3dJ8kUzTRU6EaYNZB7z5mXyu5rVByci4aJug0hrtyw== X-Received: by 2002:a1c:9c0a:: with SMTP id f10mr11633418wme.73.1548535866363; Sat, 26 Jan 2019 12:51:06 -0800 (PST) Received: from localhost.localdomain (ip5b43d796.dynamic.kabel-deutschland.de. [91.67.215.150]) by smtp.gmail.com with ESMTPSA id m21sm48049415wmi.43.2019.01.26.12.51.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 26 Jan 2019 12:51:05 -0800 (PST) From: Sebastian Staudt To: Git Mailing List Cc: Junio C Hamano , Jeff King , Duy Nguyen , Sebastian Staudt Subject: [PATCH v2 3/3] Add test for describe with a bare repository Date: Sat, 26 Jan 2019 21:49:51 +0100 Message-Id: <20190126204951.42455-3-koraktor@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190126204951.42455-1-koraktor@gmail.com> References: <20190126204951.42455-1-koraktor@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This ensures that nothing breaks the basic functionality of describe for bare repositories. Please note that --broken and --dirty need a working tree. Signed-off-by: Sebastian Staudt --- t/t6120-describe.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh index 9a6bd1541f..ddd8cc307d 100755 --- a/t/t6120-describe.sh +++ b/t/t6120-describe.sh @@ -409,4 +409,11 @@ test_expect_success 'describe complains about missing object' ' test_must_fail git describe $ZERO_OID ' +test_expect_success 'describe works from outside repo using --git-dir' " + BARE_CLONE=$(mktemp -d) && + git clone --bare '$TRASH_DIRECTORY' \$BARE_CLONE >/Users/koraktor/open-source/others/git/t/out && + echo $PWD >/Users/koraktor/open-source/others/git/t/out && + git --git-dir \$BARE_CLONE describe 2>&1 >/Users/koraktor/open-source/others/git/t/out +" + test_done