From patchwork Thu Jan 16 20:36:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shourya Shukla X-Patchwork-Id: 11337767 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 1475192A for ; Thu, 16 Jan 2020 20:36:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E70BE207E0 for ; Thu, 16 Jan 2020 20:36:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fFMzFJuv" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388047AbgAPUgj (ORCPT ); Thu, 16 Jan 2020 15:36:39 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:41706 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729637AbgAPUgi (ORCPT ); Thu, 16 Jan 2020 15:36:38 -0500 Received: by mail-pg1-f195.google.com with SMTP id x8so10481219pgk.8 for ; Thu, 16 Jan 2020 12:36:38 -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=fFMzFJuvwaSI+8st4tdJYBWRvTHrK3P7hVJpEDN37eA21yzeU5whWo1A8wVmxNYOQQ 4ShFbnKjvDhFgGfuLXFeOld5y247awVAdTZbVth7WTBO5eOWaImRPpb1wMYyoEl45nuR Wt7O0h/R7PbaTxTjRhpN53Ym53tOz4UORZIyVpWDQohJ9BzAP7IvKW9CYZj9O3cu0MSE 1HnuTTbAV6ThX3GOAroJzk9xXvN19d8I5rbZtWBXDXgit/LM252Nyfm36J1KmhZgmSlY H/c+BRuv0NTCsS+eq5nBoGZARxkyVkP+BDPYZiqcz/lGq1b7C+x0QyFsUHq2blrC3aFo yIIA== 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=djeYzdadNwf8ZIdaMoTLtZMEH8SoOOV7ZQhQry0BewhtDWstgKR7PQqeyArOPLLz7f 13lTS3It63IRsPDcQa8+Tyu0YsOOCeSd5agXXsR2cYFIjhEAWneNgeGDQLfhtpdkj+TJ YFTw5F1GRnVyayGdI87f4YaomV2Mf8rN3H88RQkBJHHNUy1YNAQ0ciF23oN/Axl+bbIQ C0BMEno8ClFDm0sVvPyouVeVLyalSyXKtsiLgpTKMZSHbJIg6owjjCI7GDSb9DqZCnoD QGGVgJKnbxpSYUZlW7DDHkHoUlHaZ8U1XGNeonHJUqtmuo/hqNyyg7DuptWfbeqbejA9 bZvg== X-Gm-Message-State: APjAAAXI5IdCZxkbTSjcqrc9betfknfRRC4tebzTtF4eeJEN0Ygii0N4 YHSG2qotxNSFxWGV5vZ7LzZSc0FLKpfP/w== X-Google-Smtp-Source: APXvYqyvaAvmENEhLH/UzN5CUa7pUtrD19vg/pIQ+ZKCMknlt0ezisIjS2TwxzuLQUVR7VeLGG0xmA== X-Received: by 2002:a63:9d85:: with SMTP id i127mr39498295pgd.186.1579206997453; Thu, 16 Jan 2020 12:36:37 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.173]) by smtp.gmail.com with ESMTPSA id d4sm3481167pjg.19.2020.01.16.12.36.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 12:36:36 -0800 (PST) From: Shourya Shukla To: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de Cc: Shourya Shukla Subject: [PATCH 1/3] t6025: modernize style Date: Fri, 17 Jan 2020 02:06:20 +0530 Message-Id: <20200116203622.4694-2-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116203622.4694-1-shouryashukla.oo@gmail.com> References: <20200116203622.4694-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 Thu Jan 16 20:36: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: 11337769 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 D8FF4139A for ; Thu, 16 Jan 2020 20:36:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B78C42075B for ; Thu, 16 Jan 2020 20:36:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tNWK77Ww" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388053AbgAPUgl (ORCPT ); Thu, 16 Jan 2020 15:36:41 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:36347 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729637AbgAPUgl (ORCPT ); Thu, 16 Jan 2020 15:36:41 -0500 Received: by mail-pg1-f195.google.com with SMTP id k3so10493898pgc.3 for ; Thu, 16 Jan 2020 12:36:41 -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=tNWK77WwZNM92RnksRDGuNUq7aLBMl24M6fIHwcobRyOfmnOnBpSWHzZRD0QdQ4yll XvixkVv2LNm9blRm+IoxzxY9nOvdPnwTpUxFlOX38LoX2IBFg2JuHNTjSn4ZTZ/2j/0w Mr/+i8X1VNJyjjvXtLynLWlYirMcLE+evnkOZups93vVnsEZXiP7quS5eRHVCVJt9dog OTL8oJfUemCAik83YjZdSkGZqjthYaTluRI6qn1ZlaZphzgelFOIDxElHFaTkyM7Aok7 B4pPmJe8MG77Q42SoK94wGhw85UwfAStlb6AtTd6l9oulGVH9/HpabRmj28B7KpKT9sE Ae1Q== 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=dKQn8wBVIifU+rVlvbdGQtogYkYELc+nNZLLz/C577S9cvNgbSkBG78bDhJVUikgBl fNhnGsGwRkHMIDuCh3BV/QoHGO3GVG823HG5VUAgSOR+I6s92VBwCvXUiccAyP9VgPvr Dcsm/8MmhRQTIoh3h1Q0OY4e9KhYQaSzuQBLjGBtVzIbX7OB2MuU81xi/j0c15dQSwLE xXcHcNAqhYcELtpxJHYkgX5VbSeYUqbPBANtkHctb6Ut5nMUQE5ebDvY2ytEyOlEmylB ZokBLbaqT3sc1M42qDgaXX33/iskHGFilLXmcXddMwZJjXUKuLFppIUN3JlF+14LfJib oZ4Q== X-Gm-Message-State: APjAAAW4N+lr4nei0TNU7NSivIVuZCEoFEqdRXu8ilCrx4PkvYSMiwlX nHFwNTzqNorTxTTJHCmcnFjskx3mH81aUg== X-Google-Smtp-Source: APXvYqwjGJF2Wp9xpOP0kNYZv0GYr0mnZ7w7iYeIKs31jSyKLYS0Yt1lfY+lZ/mRi3QPvYuXExLr0Q== X-Received: by 2002:a63:e84d:: with SMTP id a13mr43321431pgk.274.1579207000247; Thu, 16 Jan 2020 12:36:40 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.173]) by smtp.gmail.com with ESMTPSA id d4sm3481167pjg.19.2020.01.16.12.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 12:36:39 -0800 (PST) From: Shourya Shukla To: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de Cc: Shourya Shukla Subject: [PATCH 2/3] t6025: replace pipe with redirection operator Date: Fri, 17 Jan 2020 02:06:21 +0530 Message-Id: <20200116203622.4694-3-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116203622.4694-1-shouryashukla.oo@gmail.com> References: <20200116203622.4694-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 Thu Jan 16 20:36: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: 11337771 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 736A017EA for ; Thu, 16 Jan 2020 20:36:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 51DD82077B for ; Thu, 16 Jan 2020 20:36:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="qA1H/dzn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388060AbgAPUgo (ORCPT ); Thu, 16 Jan 2020 15:36:44 -0500 Received: from mail-pg1-f193.google.com ([209.85.215.193]:39555 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388054AbgAPUgo (ORCPT ); Thu, 16 Jan 2020 15:36:44 -0500 Received: by mail-pg1-f193.google.com with SMTP id b137so10482518pga.6 for ; Thu, 16 Jan 2020 12:36: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=qA1H/dznzxkCH57HA4IyA/gve5FmVnH3J+5m3jyxAZBi7RCg+yXxPeU3SvAHhSWFuY YWEL7qZ/MGaQRBBQqWGxPeHkcy5cbG9VyHHFAk5X8slafiZnfWK+nZto5jADz7pskYtr KoTOC7j6PjSk3AIYfTpL3Gczt/xQQfo6lviS2xAEM9cjUKfcpGaAXQYV7xyWtNa/9ZxU VToFW4O/Z60ltRKRwwXW4TN9YTwrNO/CnDcbgpie5t8QZXq7N7E2YKGp5V+lUApFkeS6 57FP6vPzlR/JkfazeMw7QIgeHrgTayXh1wTT29Kv8rFJpp5P37g/GLZ8NAslJeWzso0N ujWg== 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=icDJh1Zi/8BDvJFmi/xr4HYgrksUwRMCIkBKp5wcACHwlLz1C2krN3ChxSR9TetpLi WRTZuQo6dREatYQVDHUSUUqXyIdQdgjlv8R5Go9DMvVyp/ogrXhb/wv56VHwcbImeEd7 mr4w9gh70jV2SyGbhmlg21zwekrt1N6+jDJFx9ky4EWZ+eE4EwgsQv2TyEGO769VlauM 2JRyVphd2ymZuSuNhv58aQEcBwCERwB99juJdYiXhnLFV5rEVgoVqnNlMcgbQ5kO7UqW jFWmaRFp6nELhsrKf9BkRNSFl6Fw+PGzXMp8KocHj3uwOBPaD+9pMAYYVpFy35Q3vrUZ X4MQ== X-Gm-Message-State: APjAAAWB19wGfnJKTG99+sUvE78rKYr/6utPOiDPMR9jQJg+Yk4ZeC7P /YF+z+GfgdfCMZw5K5LafydBVVsFRgsWsQ== X-Google-Smtp-Source: APXvYqyfdG5ouSWuaQGdSRYsm2KSsdSUYOksr1/ZxaXIDIZXbyW8wNSqmVl/etBEo6CC3w1H0hsXHA== X-Received: by 2002:a63:6507:: with SMTP id z7mr42657574pgb.322.1579207003059; Thu, 16 Jan 2020 12:36:43 -0800 (PST) Received: from konoha.iitr.ac.in ([103.37.201.173]) by smtp.gmail.com with ESMTPSA id d4sm3481167pjg.19.2020.01.16.12.36.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jan 2020 12:36:42 -0800 (PST) From: Shourya Shukla To: git@vger.kernel.org, gitster@pobox.com, johannes.schindelin@gmx.de Cc: Shourya Shukla Subject: [PATCH 3/3] t6025: use helpers to replace test -f Date: Fri, 17 Jan 2020 02:06:22 +0530 Message-Id: <20200116203622.4694-4-shouryashukla.oo@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200116203622.4694-1-shouryashukla.oo@gmail.com> References: <20200116203622.4694-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