1 # Create commits in <repo> and assign each commit's oid to shell variables
2 # given in the arguments (A, B, and C). E.g.:
4 # create_commits_in <repo> A B C
6 # NOTE: Never calling this function from a subshell since variable
7 # assignments will disappear when subshell exits.
10 if ! parent=$(git -C "$repo" rev-parse HEAD^{} --)
14 T=$(git -C "$repo" write-tree) &&
22 oid=$(echo $name | git -C "$repo" commit-tree $T)
24 oid=$(echo $name | git -C "$repo" commit-tree -p $parent $T)
31 git -C "$repo" update-ref refs/heads/master $oid
34 # Format the output of git-push, git-show-ref and other commands to make a
35 # user-friendly and stable text. We can easily prepare the expect text
36 # without having to worry about future changes of the commit ID and spaces
37 # of the output. Single quotes are replaced with double quotes, because
38 # it is boring to prepare unquoted single quotes in expect text. We also
39 # remove some locale error messages, which break test if we turn on
40 # `GIT_TEST_GETTEXT_POISON=true` in order to test unintentional translations
41 # on plumbing commands.
42 make_user_friendly_and_stable_output () {
48 -e "s/$A/<COMMIT-A>/g" \
49 -e "s/$B/<COMMIT-B>/g" \
50 -e "s/$TAG/<TAG-v123>/g" \
51 -e "s/$ZERO_OID/<ZERO-OID>/g" \
52 -e "s/$(echo $A | cut -c1-7)[0-9a-f]*/<OID-A>/g" \
53 -e "s/$(echo $B | cut -c1-7)[0-9a-f]*/<OID-B>/g" \
54 -e "s#To $URL_PREFIX/upstream.git#To <URL/of/upstream.git>#" \