From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 4DF651F9F3 for ; Fri, 23 Apr 2021 19:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243738AbhDWTnW (ORCPT ); Fri, 23 Apr 2021 15:43:22 -0400 Received: from mav.lukeshu.com ([104.207.138.63]:35144 "EHLO mav.lukeshu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhDWTnW (ORCPT ); Fri, 23 Apr 2021 15:43:22 -0400 Received: from lukeshu-dw-thinkpad (unknown [IPv6:2601:281:8200:26:4e34:88ff:fe48:5521]) by mav.lukeshu.com (Postfix) with ESMTPSA id CF59580594; Fri, 23 Apr 2021 15:42:44 -0400 (EDT) From: Luke Shumaker To: git@vger.kernel.org Cc: Avery Pennarun , Charles Bailey , Danny Lin , "David A . Greene" , David Aguilar , Jakub Suder , James Denholm , Jeff King , Jonathan Nieder , Junio C Hamano , =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= , Roger L Strain , Techlive Zheng , Luke Shumaker Subject: [PATCH 04/30] subtree: t7900: use consistent formatting Date: Fri, 23 Apr 2021 13:42:04 -0600 Message-Id: <20210423194230.1388945-5-lukeshu@lukeshu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210423194230.1388945-1-lukeshu@lukeshu.com> References: <20210423194230.1388945-1-lukeshu@lukeshu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Luke Shumaker The formatting in t7900-subtree.sh isn't even consistent throughout the file. Fix that; make it consistent throughout the file. Signed-off-by: Luke Shumaker --- contrib/subtree/t/t7900-subtree.sh | 47 +++++++++++++----------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/contrib/subtree/t/t7900-subtree.sh b/contrib/subtree/t/t7900-subtree.sh index a6351d9195..74516513cd 100755 --- a/contrib/subtree/t/t7900-subtree.sh +++ b/contrib/subtree/t/t7900-subtree.sh @@ -11,11 +11,9 @@ and split subcommands of git subtree. TEST_DIRECTORY=$(pwd)/../../../t export TEST_DIRECTORY +. "$TEST_DIRECTORY"/test-lib.sh -. ../../../t/test-lib.sh - -subtree_test_create_repo() -{ +subtree_test_create_repo () { test_create_repo "$1" && ( cd "$1" && @@ -23,26 +21,24 @@ subtree_test_create_repo() ) } -create() -{ +create () { echo "$1" >"$1" && git add "$1" } -check_equal() -{ +check_equal () { test_debug 'echo' test_debug "echo \"check a:\" \"{$1}\"" test_debug "echo \" b:\" \"{$2}\"" - if [ "$1" = "$2" ]; then + if [ "$1" = "$2" ] + then return 0 else return 1 fi } -undo() -{ +undo () { git reset --hard HEAD~ } @@ -50,8 +46,7 @@ undo() # The original set of commits changed only one file each. # A multi-file change would imply that we pruned commits # too aggressively. -join_commits() -{ +join_commits () { commit= all= while read x y; do @@ -70,7 +65,7 @@ join_commits() echo "$commit $all" } -test_create_commit() ( +test_create_commit () ( repo=$1 && commit=$2 && cd "$repo" && @@ -81,8 +76,7 @@ test_create_commit() ( git commit -m "$commit" || error "Could not commit" ) -last_commit_message() -{ +last_commit_message () { git log --pretty=format:%s -1 } @@ -111,7 +105,8 @@ test_expect_success 'no pull from non-existent subtree' ' cd "$test_count" && git fetch ./"sub proj" HEAD && test_must_fail git subtree pull --prefix="sub dir" ./"sub proj" HEAD - )' + ) +' test_expect_success 'add subproj as subtree into sub dir/ with --prefix' ' subtree_test_create_repo "$test_count" && @@ -325,7 +320,7 @@ test_expect_success 'split sub dir/ with --rejoin' ' git subtree split --prefix="sub dir" --annotate="*" --rejoin && check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$split_hash'\''" ) - ' +' test_expect_success 'split sub dir/ with --rejoin from scratch' ' subtree_test_create_repo "$test_count" && @@ -340,7 +335,7 @@ test_expect_success 'split sub dir/ with --rejoin from scratch' ' git subtree split --prefix="sub dir" --rejoin && check_equal "$(last_commit_message)" "Split '\''sub dir/'\'' into commit '\''$split_hash'\''" ) - ' +' test_expect_success 'split sub dir/ with --rejoin and --message' ' subtree_test_create_repo "$test_count" && @@ -921,18 +916,18 @@ test_expect_success 'push split to subproj' ' test_create_commit "$test_count" "sub dir"/main-sub2 && ( cd $test_count/"sub proj" && - git branch sub-branch-1 && - cd .. && + git branch sub-branch-1 && + cd .. && git fetch ./"sub proj" HEAD && git subtree merge --prefix="sub dir" FETCH_HEAD ) && test_create_commit "$test_count" "sub dir"/main-sub3 && - ( + ( cd "$test_count" && - git subtree push ./"sub proj" --prefix "sub dir" sub-branch-1 && - cd ./"sub proj" && - git checkout sub-branch-1 && - check_equal "$(last_commit_message)" "sub dir/main-sub3" + git subtree push ./"sub proj" --prefix "sub dir" sub-branch-1 && + cd ./"sub proj" && + git checkout sub-branch-1 && + check_equal "$(last_commit_message)" "sub dir/main-sub3" ) ' -- 2.31.1