From patchwork Sat Jan 18 08:33:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11340037 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 C98E817EA for ; Sat, 18 Jan 2020 08:33:38 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A99422468D for ; Sat, 18 Jan 2020 08:33:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BkfQO1r+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgARIdi (ORCPT ); Sat, 18 Jan 2020 03:33:38 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:37938 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgARIdh (ORCPT ); Sat, 18 Jan 2020 03:33:37 -0500 Received: by mail-pg1-f193.google.com with SMTP id a33so12842245pgm.5 for ; Sat, 18 Jan 2020 00:33:37 -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=E1QmLD9GBO2uEs5uXCads3PwO8fhEo5QcewGiJ12mIc=; b=BkfQO1r+omLcep4q/qmqOdSn6cgz6wT+12Z3GbD7T+FjMTsFkjVeafrqnc7DL8YuAM DX6weyjlQWsGA9IbygqtXst8kjr6eRmYFxvOQ8ZaeoQOlD/CRyUt6GRdbYkDWow+ghm/ XIWyxhlpyEgDg30pJfXX0fO3moyRO+HwS3K+Su4Oa6ptUNnUlzI6tRClQ2LmlAQUC9lL Tayf4AHxQga4vYzaTNICfYXKVV2yLbZI1IG0Q0rSiR265uOQo9OgpESdO5lWqrl2JgWa Ubx0B4aZQ7kGkwteZGcP7N339RF6GWhT+xr7LnDtoky9cZ09FK6HYh1EFOvSMp7OLRgz t/Hg== 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=E1QmLD9GBO2uEs5uXCads3PwO8fhEo5QcewGiJ12mIc=; b=m0lRHHmWYg23nZryXHCLNsiBXHriOLculoxX3a3ATAY568VRib112KFQT7dyC7C4Ki h6gjIkmyA15L3llrLLJz2c4/uEFiVPD/kM9RT8Yvd6rzzIR+nnRSPjZ/l65a691h2XhP NPypHhenfBm0JFs7wRE2KTY2L1RKoVCun1KBG4mAQujtLNANlsurdSEgBuxakFxr0+Nd uzwaepRvM/r0cqcJFwEUIcvnxlglj5o2LkhFwJrx+kg5F49cmQlP1N6YhtUz3z7HbdX5 OXztrbIQpJAz+nkt7xsHl9zwHJ9VdejRw5OQkhvpwWqAXM7bntW+FzMLeOwZPi+fvHUl m+5w== X-Gm-Message-State: APjAAAUhQa0Y0x7b2leaovNO6zqVgf5l8wZzwiL4UltaQTt58Ef1laMP AH28aKJlGcX7WVoN7mpFQL0= X-Google-Smtp-Source: APXvYqzZc5CM0KGu3puKBcXkIZkRKy0apGAKM2XkTAErz3Ssy+5eL6VOeKiWOBouG/T8+INQNSEQcQ== X-Received: by 2002:a65:64c6:: with SMTP id t6mr48296702pgv.392.1579336417017; Sat, 18 Jan 2020 00:33:37 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id c10sm605038pgj.49.2020.01.18.00.33.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 00:33:36 -0800 (PST) From: Shourya Shukla To: sunshine@sunshineco.com Cc: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 1/3] t6025: modernize style Date: Sat, 18 Jan 2020 14:03:21 +0530 Message-Id: <20200118083326.9643-2-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200118083326.9643-1-shouryashukla.oo@gmail.com> References: <20200118083326.9643-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..b9219af659 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 && + touch 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 Sat Jan 18 08:33:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11340039 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 EEFC214B7 for ; Sat, 18 Jan 2020 08:33:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CDABC2468C for ; Sat, 18 Jan 2020 08:33:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="vRys9C8w" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726744AbgARIdl (ORCPT ); Sat, 18 Jan 2020 03:33:41 -0500 Received: from mail-pf1-f195.google.com ([209.85.210.195]:37831 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgARIdk (ORCPT ); Sat, 18 Jan 2020 03:33:40 -0500 Received: by mail-pf1-f195.google.com with SMTP id p14so13108838pfn.4 for ; Sat, 18 Jan 2020 00:33:40 -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=x/U6JJEl1swVZS467ydw4m6y6JYmCn+77u9HhScUGQc=; b=vRys9C8wsQ/CcSwBCIoE3RTQdLieadD9AuYCrkqIMwZxT8zcED9sHecv/HaVPr1P9n tewYwQhl9jdSkYZeoxQuqzRWjQ6biVN4/nuj2Bge4D78dPYVKVStfzNVt4QMXM61lCax CEEJJRxHeBx7gCSvEWO4reyfoFRJlXHv+JkrmOItke0C17ry2Q6q2ANLBJvku2iPvXmM 2/0R9IZE1pN4yZdUGIvTX3qUWlhN3DcRaXmrLqwO8EtXJYJ1fAzfAER44rq2DuGqW0Jq e6AAtkbTx0D3gI5N1b4pYHLfhSZoLnRhycJg4PQVnm8/KY3xipOJsU+eGc/28fmhJEV1 MSEQ== 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=x/U6JJEl1swVZS467ydw4m6y6JYmCn+77u9HhScUGQc=; b=to8QTgEDqBF93QUfGKLO3frqsu0zBPT0LqKP3xPRwx2kNeBamFqZqhohrljBJtPl5M cNM5yz+49uc62HRM4/qZxnqeWYfQyYnavDcpzlDfQnUdYjON6KXnX+KrHWaJwYadz7kV xDw8KWxDb0Ndz9jHHhzhJ2tslFScWDqiF8BnVzjyNOpcrpc3Ge90LsChp9xx6IA/mydm CCiPtLDdHvA0xOUUds37N7DEY2KAihaeHFCiW+23tJurHaf6mnpqmjKmVynqTp5MKQal V3EFvBVGVg6NTPM1fsIi7WD0befTaWgcTor5eQjG757K9BikJfdF73XZA/r6OBtOKZ65 HO1Q== X-Gm-Message-State: APjAAAV3pKfUkFLhRxCwtDJjSlyNMSTlS8WdywM3dEc1sPKFBrBocg9M IQKMsO47vlaCKbRGQVWfuZc= X-Google-Smtp-Source: APXvYqzE1zQRUyLNZl4b5dbIbgJpPfq1zmZoXk4RfvhFa48wUZKexC/xRGWPdaSnu1AeMvL1RtsWUA== X-Received: by 2002:a62:fc93:: with SMTP id e141mr6982609pfh.262.1579336420136; Sat, 18 Jan 2020 00:33:40 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id c10sm605038pgj.49.2020.01.18.00.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 00:33:39 -0800 (PST) From: Shourya Shukla To: sunshine@sunshineco.com Cc: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 2/3] t6025: replace pipe with redirection operator Date: Sat, 18 Jan 2020 14:03:22 +0530 Message-Id: <20200118083326.9643-3-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200118083326.9643-1-shouryashukla.oo@gmail.com> References: <20200118083326.9643-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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t6025-merge-symlinks.sh b/t/t6025-merge-symlinks.sh index b9219af659..41bae56ea9 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -18,13 +18,13 @@ test_expect_success 'setup' ' 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 && + echo "120000 $l symlink" >foo && + git update-index --index-info foo && + git update-index --index-info symlink && From patchwork Sat Jan 18 08:33:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11340041 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 090C914B7 for ; Sat, 18 Jan 2020 08:33:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC3D22468D for ; Sat, 18 Jan 2020 08:33:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dZHB85Nk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbgARIdo (ORCPT ); Sat, 18 Jan 2020 03:33:44 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:37833 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726509AbgARIdo (ORCPT ); Sat, 18 Jan 2020 03:33:44 -0500 Received: by mail-pf1-f194.google.com with SMTP id p14so13108883pfn.4 for ; Sat, 18 Jan 2020 00:33:43 -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=xbAEoprmoggkR26eAAqeoFeiqErsIATEpefJg0F+rhY=; b=dZHB85NkByA0LS+Alqo4tIJQyIKxQsvJ82uqcx64hk4AUckezssXRe6EYkFkUCs/UY FXaKHvN6kPbU7zZOFgacFvje7jrMx69hsMNl/iIEl2PfRgb6prWA7xS5qJDtCLt1BZyM IERx7STjwUDjdsdoiY0CHKQ4Okq8rJ1p2XRG6EWU8yCNcPQXr97Ouuy4VFtW04Sicg7F AQhkIK2DqCh8hN4+iQM2j9bDWumCfvO3vttgV1bccdA10HU2WW/6Ek53gLkFJM87zbsG W8pVuJZBINbU+Kl3Oj3ZEdUZDs95P1FIDj+ZpcgleOgD3uUlXV4aFbqKSl8PETZp5WER LYFg== 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=xbAEoprmoggkR26eAAqeoFeiqErsIATEpefJg0F+rhY=; b=CNbWHS1CbR7SmpX0NZmffW2SgWH3mr6VJuQiqR15c3Jj4F4x2Lj/hQGJyB93umINM0 TX4EEDpt9g35NwROLh6+Mxs9DtY8MKRkkPBV0jUeaisLu965CbCQrYFZHSqXTo11ckLL xIKrbVNGPKUA+kz++e1UwZMmRwxxRiMsq2BX1PL2q4rHv+LC3PP+UJ546Gr4KlFLO8Me hLNkJ0FQrTTmUmvYicQc8h1+wj1uxTfZraM7tSnpA4fB6IkPCiwAwK8qvlzQV8kHM1aE 7D2I3ZJXl+nzMdHXAwrCAJmW90J2xULeDqEYLkx6+MkLPcAiCJkHTSrNoe31zMX2utd+ 4WEg== X-Gm-Message-State: APjAAAUZEwHfR9RxZF/kSAfr9tS0tHx4TxCK8QOsfOXWQW3SqgpZg73S xTZGUBY7HFJYaLdlmRl75CM= X-Google-Smtp-Source: APXvYqxBBJW2jleXDp9M9MG0g0cLaKbL33kEBST6JcqVDNvMTpVAzqRMp+ByIPPwaFr4q4Io6soclA== X-Received: by 2002:a65:5608:: with SMTP id l8mr50677399pgs.210.1579336423219; Sat, 18 Jan 2020 00:33:43 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.169]) by smtp.gmail.com with ESMTPSA id c10sm605038pgj.49.2020.01.18.00.33.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 00:33:42 -0800 (PST) From: Shourya Shukla To: sunshine@sunshineco.com Cc: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de, shouryashukla.oo@gmail.com Subject: [PATCH 3/3] t6025: use helpers to replace test -f Date: Sat, 18 Jan 2020 14:03:23 +0530 Message-Id: <20200118083326.9643-4-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200118083326.9643-1-shouryashukla.oo@gmail.com> References: <20200118083326.9643-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 41bae56ea9..ebbbc03f1d 100755 --- a/t/t6025-merge-symlinks.sh +++ b/t/t6025-merge-symlinks.sh @@ -38,7 +38,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' ' @@ -48,7 +48,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' ' @@ -58,7 +58,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