Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiang Xin <worldhello.net@gmail.com>2021-06-17 06:17:26 +0300
committerJunio C Hamano <gitster@pobox.com>2021-06-17 08:12:22 +0300
commit3c06a583398f6630c7162b463ff1acbdf0110f83 (patch)
tree05cac34348beb463e83654d70e6934f9ffe4bcc5 /t/t5548-push-porcelain.sh
parent2bafb3d702d4cd77de0d3e68f13188980e0de734 (diff)
test: refactor to use "test_commit" to create commits
Refactor function "create_commits_in" to use "test_commit" to create commit. Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t5548-push-porcelain.sh')
-rwxr-xr-xt/t5548-push-porcelain.sh25
1 files changed, 6 insertions, 19 deletions
diff --git a/t/t5548-push-porcelain.sh b/t/t5548-push-porcelain.sh
index 2ab7c3cf5a..c8f18a7a12 100755
--- a/t/t5548-push-porcelain.sh
+++ b/t/t5548-push-porcelain.sh
@@ -14,29 +14,16 @@ test_description='Test git push porcelain output'
# NOTE: Never calling this function from a subshell since variable
# assignments will disappear when subshell exits.
create_commits_in () {
- repo="$1" &&
- if ! parent=$(git -C "$repo" rev-parse HEAD^{} --)
- then
- parent=
- fi &&
- T=$(git -C "$repo" write-tree) &&
+ repo="$1" && test -d "$repo" ||
+ error "Repository $repo does not exist."
shift &&
while test $# -gt 0
do
name=$1 &&
- test_tick &&
- if test -z "$parent"
- then
- oid=$(echo $name | git -C "$repo" commit-tree $T)
- else
- oid=$(echo $name | git -C "$repo" commit-tree -p $parent $T)
- fi &&
- eval $name=$oid &&
- parent=$oid &&
- shift ||
- return 1
- done &&
- git -C "$repo" update-ref refs/heads/main $oid
+ shift &&
+ test_commit -C "$repo" --no-tag "$name" &&
+ eval $name=$(git -C "$repo" rev-parse HEAD)
+ done
}
# Format the output of git-push, git-show-ref and other commands to make a