From patchwork Fri Jan 17 20:44:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11339735 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 D62CF17EA for ; Fri, 17 Jan 2020 20:44:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B48CF2082F for ; Fri, 17 Jan 2020 20:44:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="MUu1t4nT" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729792AbgAQUoy (ORCPT ); Fri, 17 Jan 2020 15:44:54 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:44998 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729684AbgAQUoy (ORCPT ); Fri, 17 Jan 2020 15:44:54 -0500 Received: by mail-pl1-f193.google.com with SMTP id az3so10306380plb.11 for ; Fri, 17 Jan 2020 12:44:54 -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=40ZTcfDlFLunQq8bCXR5tpFIJvrH/nDhTSeCDfIKH+U=; b=MUu1t4nTI0aOjM63kgX7iLj8OJRUU46G/ibDvOVgNT/CmgHH3iO0j9fu7qNxZ/KukY ZraOpoq7yHLBXCCAyQIXScbg7ndeo9VRuQK4njtElKMYSzSXj5TeT1zTDh99c4p2mLNf nsCWA3QgVq5yxSRe3pMfhoCApg1FHYURQY8bBC8Wp/6nV6F2SdDBElSaAgDQXKbfjPEN L6yq1OWOLVvqblukF30HtQre7MjxN3yLN6ct/5THh+lPWxKFI8bNlZ6B+pCC3g1a7hy8 vpsg3KVLEpPUI0oc26ol8nuJyCd2+jlykQdP5DQR4BUrkTqAYy5LjyIfKVZXhI6l0/2S rPUQ== 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=40ZTcfDlFLunQq8bCXR5tpFIJvrH/nDhTSeCDfIKH+U=; b=ZngxSNHNYVugCxChZzAJpVb/vPnyK/1ahrPUqJIRWzTlVTEM8bvi0jkAVboBmoAWKt ZYiq80VNG3Nfpwl1o3GTTyLbmuyl282aCeSc4W5GhrZluC4YPHwECV1KuM4V9lPFrphI /Xx3iClTygZtrU5bkZYDzucLGljiOccz1ibw0Bes+XlMXvP5AvKA97PYSCVlcZmSp0Dh idgDGz1iy2D4YY5ygvXPW56JuS+rVrRJwCBWE0vuUHUV7Mkhamexpd/tzBFZU9gOj4Vq 1Qlk/xnj3mtJphJ8eAr/1bdaX7XA8G0DE8xEaOBoeBRNkXMBgV7KIbrnsPTWWQ3gcMYK 6dQg== X-Gm-Message-State: APjAAAUJm20rizm0N+PkW00XzqeUfZbeGmefNT+qBYKOJioqVeWD0kPb POXvQ+xWQfFlXdlCMV2nViJqF5v8zZvNug== X-Google-Smtp-Source: APXvYqwLW2gP1tqdpsFt2j29/lDeNgEDM0pSGefnroQto7o2imIgDFbCmA1guABte+mDUr1vk6Yi7w== X-Received: by 2002:a17:902:bd94:: with SMTP id q20mr1026128pls.343.1579293893517; Fri, 17 Jan 2020 12:44:53 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id u20sm28844190pgf.29.2020.01.17.12.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 12:44:52 -0800 (PST) From: Shourya Shukla To: gitster@pobox.com Cc: git@vger.kernel.org, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 1/3] t6025: modernize style Date: Sat, 18 Jan 2020 02:14:24 +0530 Message-Id: <20200117204426.9347-2-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200117204426.9347-1-shouryashukla.oo@gmail.com> References: <20200117204426.9347-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The tests in `t6025-merge-symlinks.sh` were written a long time ago, and has a lot of style violations, including the mixed-use of tabs and spaces, missing indentations, and other shell script style violations. Update it to match the CodingGuidelines. Signed-off-by: Shourya Shukla --- t/t6025-merge-symlinks.sh | 97 ++++++++++++++++++++------------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index 433c4de08f..7a19ba8520 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -10,52 +10,55 @@ if core.symlinks is false.' . ./test-lib.sh -test_expect_success \ -'setup' ' -git config core.symlinks false && -> file && -git add file && -git commit -m initial && -git branch b-symlink && -git branch b-file && -l=$(printf file | git hash-object -t blob -w --stdin) && -echo "120000 $l symlink" | git update-index --index-info && -git commit -m master && -git checkout b-symlink && -l=$(printf file-different | git hash-object -t blob -w --stdin) && -echo "120000 $l symlink" | git update-index --index-info && -git commit -m b-symlink && -git checkout b-file && -echo plain-file > symlink && -git add symlink && -git commit -m b-file' - -test_expect_success \ -'merge master into b-symlink, which has a different symbolic link' ' -git checkout b-symlink && -test_must_fail git merge master' - -test_expect_success \ -'the merge result must be a file' ' -test -f symlink' - -test_expect_success \ -'merge master into b-file, which has a file instead of a symbolic link' ' -git reset --hard && git checkout b-file && -test_must_fail git merge master' - -test_expect_success \ -'the merge result must be a file' ' -test -f symlink' - -test_expect_success \ -'merge b-file, which has a file instead of a symbolic link, into master' ' -git reset --hard && -git checkout master && -test_must_fail git merge b-file' - -test_expect_success \ -'the merge result must be a file' ' -test -f symlink' +test_expect_success 'setup' ' + git config core.symlinks false && + >file && + git add file && + git commit -m initial && + git branch b-symlink && + git branch b-file && + l=$(printf file | git hash-object -t blob -w --stdin) && + echo "120000 $l symlink" | + git update-index --index-info && + git commit -m master && + git checkout b-symlink && + l=$(printf file-different | git hash-object -t blob -w --stdin) && + echo "120000 $l symlink" | + git update-index --index-info && + git commit -m b-symlink && + git checkout b-file && + echo plain-file >symlink && + git add symlink && + git commit -m b-file +' + +test_expect_success 'merge master into b-symlink, which has a different symbolic link' ' + git checkout b-symlink && + test_must_fail git merge master +' + +test_expect_success 'the merge result must be a file' ' + test -f symlink +' + +test_expect_success 'merge master into b-file, which has a file instead of a symbolic link' ' + git reset --hard && + git checkout b-file && + test_must_fail git merge master +' + +test_expect_success 'the merge result must be a file' ' + test -f symlink +' + +test_expect_success 'merge b-file, which has a file instead of a symbolic link, into master' ' + git reset --hard && + git checkout master && + test_must_fail git merge b-file +' + +test_expect_success 'the merge result must be a file' ' + test -f symlink +' test_done From patchwork Fri Jan 17 20:44:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11339737 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 81B2392A for ; Fri, 17 Jan 2020 20:44:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5B8F92083E for ; Fri, 17 Jan 2020 20:44:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EYhSX0q1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729798AbgAQUo5 (ORCPT ); Fri, 17 Jan 2020 15:44:57 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:42186 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729684AbgAQUo5 (ORCPT ); Fri, 17 Jan 2020 15:44:57 -0500 Received: by mail-pl1-f195.google.com with SMTP id p9so10317139plk.9 for ; Fri, 17 Jan 2020 12:44:56 -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=982Oj3qGp6Tym15pxaUXvMYy00rUqC7Uj+32S6Kz9fI=; b=EYhSX0q1//S55XpPob1j3PhCRMy0INYJCc/QmNoFH/dgVRHPqDMnxQ/igeNgFhlJBP LGUxmmCb34rRpDE3yx4TdpvDKQn00f4m0WIgqj5tyfUqcvVe+AL0x3CeJwBvCVlJfQV6 te43A9UxfBFZZq3VjhojXYLEEKIk/lSpN8XCx3swtLmPNro75/pNQhNhEn3RaltZwJVP LZCxeJttZ/5TV9+rwiEjNst4HreYo20q6e8IDBkl8aWX8UcdlYxZUF8UrOHJAoXljpDq Rdnp4+4mNuRa/pxumj8s2ntY0PKYNUBVx7lme4bp95vzqen2GiMG6XpN4ObKoTA21SLo ho7w== 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=982Oj3qGp6Tym15pxaUXvMYy00rUqC7Uj+32S6Kz9fI=; b=jLrfK24s64IKL5khJKVi3mkJ/GtfZOip90hy5iCO4Jx3/ACOfWlAifWPt3I1jCcjUX oqVwoEVDdFmDCjRpymplLCXbjuSEfqL6j4p7NNeosbzKNSa6nrsXcNXpCbb+W1rN17tC Kmihi+CRby9O4q01k9piym+nnMGq2UdLXmCWW9tPvImSyqk8JWngLQYvw1EIlS5GT6Bx Ig3elzRbrhqNqlzdwHzMhhaTiYthTmE404AyYQGzrvsm1h3dwcU8shkFPNa2ZQz2p4Ja pJjeivjamhmhYnQN2OS5cR7lHbmHlw46U9O/oAQd2E1J18a1orMJadugzy4QWKVcBjmP i5JA== X-Gm-Message-State: APjAAAX541XyXi3JmVtfxmNKD2rKAG7qQ1oAZzTCJBEAI4wBnUyZAlUu LV7bxR9TztcTf5ZesF5e9v3CXS2Kmqra0w== X-Google-Smtp-Source: APXvYqzMp7OybnsMKa+H1ojTUBn7PE6iplr/ooyZRnFXdA1hPWx1Sc17l+r3eVnac5PbBY6DacDorA== X-Received: by 2002:a17:902:d915:: with SMTP id c21mr1040056plz.295.1579293896262; Fri, 17 Jan 2020 12:44:56 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id u20sm28844190pgf.29.2020.01.17.12.44.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 12:44:55 -0800 (PST) From: Shourya Shukla To: gitster@pobox.com Cc: git@vger.kernel.org, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 2/3] t6025: replace pipe with redirection operator Date: Sat, 18 Jan 2020 02:14:25 +0530 Message-Id: <20200117204426.9347-3-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200117204426.9347-1-shouryashukla.oo@gmail.com> References: <20200117204426.9347-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org The exit code of pipes(|) are always ignored, which will create errors in subsequent statements. Let's handle it by redirecting its output to a file and capturing return values. Replace pipe with redirect(>) operator. Signed-off-by: Shourya Shukla --- t/t6025-merge-symlinks.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index 7a19ba8520..5136bf1e13 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -17,14 +17,13 @@ test_expect_success 'setup' ' git commit -m initial && git branch b-symlink && git branch b-file && - l=$(printf file | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | - git update-index --index-info && + printf file >file && + l=$(git hash-object -t blob -w --stdin) && + echo "120000 $l symlink" | git update-index --index-info && git commit -m master && git checkout b-symlink && l=$(printf file-different | git hash-object -t blob -w --stdin) && - echo "120000 $l symlink" | - git update-index --index-info && + echo "120000 $l symlink" | git update-index --index-info && git commit -m b-symlink && git checkout b-file && echo plain-file >symlink && From patchwork Fri Jan 17 20:44:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11339739 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 3BD5992A for ; Fri, 17 Jan 2020 20:45:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 17B3A2083E for ; Fri, 17 Jan 2020 20:45:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="j4wZUMJG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729809AbgAQUpA (ORCPT ); Fri, 17 Jan 2020 15:45:00 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43754 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729684AbgAQUo7 (ORCPT ); Fri, 17 Jan 2020 15:44:59 -0500 Received: by mail-pf1-f194.google.com with SMTP id x6so12463012pfo.10 for ; Fri, 17 Jan 2020 12:44:59 -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=S5J0IT/oNxIpEki3dZbwMLp73aungk/KQQhEG4ofblw=; b=j4wZUMJG8IBUYypboXye5/D0OpTSuhSjFFIpyVJgTIDmXUmLex/VPWEyFw6lNeni9G 5w84vbd0CHokrxoCIj1oG0hsXnvLAMBQ2jHd9sBBE8eqbvkxeOJ6j6jWlnyX7WJhz5cB f/PjLppcn9yTBOr5KtYblCSHLPxRhp5bAxCp3q83kKztcMqYfT3nKIf5W005rMMbQ3q8 7ZS8F+5pQ62ZcSAowEfAqbQy2GPW5wpa9ZhzQi1HrPbXxgSgSBe7KnajbHjSbjgD5VDn 3/POYISPVTxNmKgZWflGqDzkIHkN0vwKy2J2VNXjoXvaNm4RpxRWnkw/QjftlHRsTp9J RhjA== 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=S5J0IT/oNxIpEki3dZbwMLp73aungk/KQQhEG4ofblw=; b=P6KYqKlDiE8Ksxp97/eep4rkT122YN5rve6tqliCa6Qnr29Uv4Llq6B4zu6Pu2Lb++ 58ixidKkINXClRVyH5OZNb64Tes1tfKVzKDJxPA1yPurbxR27cgwkSwO7fktKrRdokah wC5rPqtXsweKMxcuDPtMKMQ5JgxeT6SDT0w9t8xhELnwWTYQeROn6b4Nr3qhaKwMLKpZ VsM+kP5mkFBRiiAvy02XVw1mNv2lD+yqLtNDLzibwt2cJfvjodNrB2+OdZmdh6Wv670I fWpcZI4AQRn9wc/pD8WIsdYLHYd8MBl10MB+rVkIZLT+yrh/0jjEW9zRvbqMI5TFOSzy CiKw== X-Gm-Message-State: APjAAAUAB7OI+uhLtdQ2MLcZsX76lazfFmzcdPrpxu25cnu/pEMVglg0 wedjGdFrBaVWQIsMQRE/rHU= X-Google-Smtp-Source: APXvYqzcPnpX5DnsXmTX9gLyEKR5d+sTGK4neHP2rhRkijsmv9HOYV2gdNFhDhtQ1XeFjYvZ1zntSA== X-Received: by 2002:a63:3196:: with SMTP id x144mr46950877pgx.319.1579293899150; Fri, 17 Jan 2020 12:44:59 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id u20sm28844190pgf.29.2020.01.17.12.44.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jan 2020 12:44:58 -0800 (PST) From: Shourya Shukla To: gitster@pobox.com Cc: git@vger.kernel.org, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 3/3] t6025: use helpers to replace test -f Date: Sat, 18 Jan 2020 02:14:26 +0530 Message-Id: <20200117204426.9347-4-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200117204426.9347-1-shouryashukla.oo@gmail.com> References: <20200117204426.9347-1-shouryashukla.oo@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Take advantage of helper function 'test_path_is_file()' to replace 'test -f' since the function makes the code more readable and gives better error messages. Signed-off-by: Shourya Shukla --- t/t6025-merge-symlinks.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index 5136bf1e13..18a204bb65 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -37,7 +37,7 @@ test_expect_success 'merge master into b-symlink, which has a different symbolic ' test_expect_success 'the merge result must be a file' ' - test -f symlink + test_path_is_file symlink ' test_expect_success 'merge master into b-file, which has a file instead of a symbolic link' ' @@ -47,7 +47,7 @@ test_expect_success 'merge master into b-file, which has a file instead of a sym ' test_expect_success 'the merge result must be a file' ' - test -f symlink + test_path_is_file symlink ' test_expect_success 'merge b-file, which has a file instead of a symbolic link, into master' ' @@ -57,7 +57,7 @@ test_expect_success 'merge b-file, which has a file instead of a symbolic link, ' test_expect_success 'the merge result must be a file' ' - test -f symlink + test_path_is_file symlink ' test_done