summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/helper/test-submodule-config.c10
-rw-r--r--t/lib-proto-disable.sh8
-rwxr-xr-xt/t0060-path-utils.sh2
-rwxr-xr-xt/t1300-repo-config.sh7
-rwxr-xr-xt/t3203-branch-output.sh31
-rwxr-xr-xt/t4207-log-decoration-colors.sh22
-rwxr-xr-xt/t5520-pull.sh4
-rwxr-xr-xt/t5532-fetch-proxy.sh5
-rwxr-xr-xt/t5810-proto-disable-local.sh23
-rwxr-xr-xt/t5813-proto-disable-ssh.sh23
-rwxr-xr-xt/t6006-rev-list-format.sh129
-rwxr-xr-xt/t6300-for-each-ref.sh39
-rwxr-xr-xt/t6500-gc.sh21
-rwxr-xr-xt/t7004-tag.sh25
-rwxr-xr-xt/t9831-git-p4-triggers.sh103
-rw-r--r--t/test-lib-functions.sh2
16 files changed, 373 insertions, 81 deletions
diff --git a/t/helper/test-submodule-config.c b/t/helper/test-submodule-config.c
index c6c57bba0d..e13fbcc1b5 100644
--- a/t/helper/test-submodule-config.c
+++ b/t/helper/test-submodule-config.c
@@ -41,7 +41,7 @@ int cmd_main(int argc, const char **argv)
git_config(git_test_config, NULL);
while (*arg) {
- unsigned char commit_sha1[20];
+ struct object_id commit_oid;
const struct submodule *submodule;
const char *commit;
const char *path_or_name;
@@ -50,14 +50,14 @@ int cmd_main(int argc, const char **argv)
path_or_name = arg[1];
if (commit[0] == '\0')
- hashclr(commit_sha1);
- else if (get_sha1(commit, commit_sha1) < 0)
+ oidclr(&commit_oid);
+ else if (get_oid(commit, &commit_oid) < 0)
die_usage(argc, argv, "Commit not found.");
if (lookup_name) {
- submodule = submodule_from_name(commit_sha1, path_or_name);
+ submodule = submodule_from_name(&commit_oid, path_or_name);
} else
- submodule = submodule_from_path(commit_sha1, path_or_name);
+ submodule = submodule_from_path(&commit_oid, path_or_name);
if (!submodule)
die_usage(argc, argv, "Submodule not found.");
diff --git a/t/lib-proto-disable.sh b/t/lib-proto-disable.sh
index 02f49cb409..83babe57d9 100644
--- a/t/lib-proto-disable.sh
+++ b/t/lib-proto-disable.sh
@@ -147,29 +147,33 @@ test_config () {
# Test clone/fetch/push with protocol.allow user defined default
test_expect_success "clone $desc (enabled)" '
rm -rf tmp.git &&
- git config --global protocol.allow always &&
+ test_config_global protocol.allow always &&
git clone --bare "$url" tmp.git
'
test_expect_success "fetch $desc (enabled)" '
+ test_config_global protocol.allow always &&
git -C tmp.git fetch
'
test_expect_success "push $desc (enabled)" '
+ test_config_global protocol.allow always &&
git -C tmp.git push origin HEAD:pushed
'
test_expect_success "push $desc (disabled)" '
- git config --global protocol.allow never &&
+ test_config_global protocol.allow never &&
test_must_fail git -C tmp.git push origin HEAD:pushed
'
test_expect_success "fetch $desc (disabled)" '
+ test_config_global protocol.allow never &&
test_must_fail git -C tmp.git fetch
'
test_expect_success "clone $desc (disabled)" '
rm -rf tmp.git &&
+ test_config_global protocol.allow never &&
test_must_fail git clone --bare "$url" tmp.git
'
}
diff --git a/t/t0060-path-utils.sh b/t/t0060-path-utils.sh
index 444b5a4df8..7ea2bb515b 100755
--- a/t/t0060-path-utils.sh
+++ b/t/t0060-path-utils.sh
@@ -70,6 +70,8 @@ ancestor() {
case $(uname -s) in
*MINGW*)
;;
+*CYGWIN*)
+ ;;
*)
test_set_prereq POSIX
;;
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index a37ef04222..364a537000 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -1075,6 +1075,13 @@ test_expect_success 'git -c works with aliases of builtins' '
test_cmp expect actual
'
+test_expect_success 'aliases can be CamelCased' '
+ test_config alias.CamelCased "rev-parse HEAD" &&
+ git CamelCased >out &&
+ git rev-parse HEAD >expect &&
+ test_cmp expect out
+'
+
test_expect_success 'git -c does not split values on equals' '
echo "value with = in it" >expect &&
git -c core.foo="value with = in it" config core.foo >actual &&
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index a428ae6703..d2aec0f38b 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -2,6 +2,7 @@
test_description='git branch display tests'
. ./test-lib.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
test_expect_success 'make commits' '
echo content >file &&
@@ -239,4 +240,34 @@ test_expect_success 'git branch --format option' '
test_i18ncmp expect actual
'
+test_expect_success "set up color tests" '
+ echo "<RED>master<RESET>" >expect.color &&
+ echo "master" >expect.bare &&
+ color_args="--format=%(color:red)%(refname:short) --list master"
+'
+
+test_expect_success '%(color) omitted without tty' '
+ TERM=vt100 git branch $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.bare actual
+'
+
+test_expect_success TTY '%(color) present with tty' '
+ test_terminal env TERM=vt100 git branch $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.color actual
+'
+
+test_expect_success 'color.branch=always overrides auto-color' '
+ git -c color.branch=always branch $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.color actual
+'
+
+test_expect_success '--color overrides auto-color' '
+ git branch --color $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.color actual
+'
+
test_done
diff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh
index b972296f06..60f040cab8 100755
--- a/t/t4207-log-decoration-colors.sh
+++ b/t/t4207-log-decoration-colors.sh
@@ -7,11 +7,6 @@ test_description='Test for "git log --decorate" colors'
. ./test-lib.sh
-get_color ()
-{
- git config --get-color no.such.slot "$1"
-}
-
test_expect_success setup '
git config diff.color.commit yellow &&
git config color.decorate.branch green &&
@@ -20,14 +15,14 @@ test_expect_success setup '
git config color.decorate.stash magenta &&
git config color.decorate.HEAD cyan &&
- c_reset=$(get_color reset) &&
+ c_reset="<RESET>" &&
- c_commit=$(get_color yellow) &&
- c_branch=$(get_color green) &&
- c_remoteBranch=$(get_color red) &&
- c_tag=$(get_color "reverse bold yellow") &&
- c_stash=$(get_color magenta) &&
- c_HEAD=$(get_color cyan) &&
+ c_commit="<YELLOW>" &&
+ c_branch="<GREEN>" &&
+ c_remoteBranch="<RED>" &&
+ c_tag="<BOLD;REVERSE;YELLOW>" &&
+ c_stash="<MAGENTA>" &&
+ c_HEAD="<CYAN>" &&
test_commit A &&
git clone . other &&
@@ -59,7 +54,8 @@ EOF
# to this test since it does not contain any decoration, hence --first-parent
test_expect_success 'Commit Decorations Colored Correctly' '
git log --first-parent --abbrev=10 --all --decorate --oneline --color=always |
- sed "s/[0-9a-f]\{10,10\}/COMMIT_ID/" >out &&
+ sed "s/[0-9a-f]\{10,10\}/COMMIT_ID/" |
+ test_decode_color >out &&
test_cmp expected out
'
diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh
index f15f7a3329..59c4b778d3 100755
--- a/t/t5520-pull.sh
+++ b/t/t5520-pull.sh
@@ -305,7 +305,7 @@ test_expect_success '--rebase with conflicts shows advice' '
test_tick &&
git commit -m "Create conflict" seq.txt &&
test_must_fail git pull --rebase . seq 2>err >out &&
- test_i18ngrep "When you have resolved this problem" out
+ test_i18ngrep "Resolve all conflicts manually" out
'
test_expect_success 'failed --rebase shows advice' '
@@ -319,7 +319,7 @@ test_expect_success 'failed --rebase shows advice' '
git checkout -f -b fails-to-rebase HEAD^ &&
test_commit v2-without-cr file "2" file2-lf &&
test_must_fail git pull --rebase . diverging 2>err >out &&
- test_i18ngrep "When you have resolved this problem" out
+ test_i18ngrep "Resolve all conflicts manually" out
'
test_expect_success '--rebase fails with multiple branches' '
diff --git a/t/t5532-fetch-proxy.sh b/t/t5532-fetch-proxy.sh
index 51c9669398..9c2798603b 100755
--- a/t/t5532-fetch-proxy.sh
+++ b/t/t5532-fetch-proxy.sh
@@ -43,4 +43,9 @@ test_expect_success 'fetch through proxy works' '
test_cmp expect actual
'
+test_expect_success 'funny hostnames are rejected before running proxy' '
+ test_must_fail git fetch git://-remote/repo.git 2>stderr &&
+ ! grep "proxying for" stderr
+'
+
test_done
diff --git a/t/t5810-proto-disable-local.sh b/t/t5810-proto-disable-local.sh
index 563592d8a8..c1ef99b85c 100755
--- a/t/t5810-proto-disable-local.sh
+++ b/t/t5810-proto-disable-local.sh
@@ -11,4 +11,27 @@ test_expect_success 'setup repository to clone' '
test_proto "file://" file "file://$PWD"
test_proto "path" file .
+test_expect_success 'setup repo with dash' '
+ git init --bare repo.git &&
+ git push repo.git HEAD &&
+ mv repo.git "$PWD/-repo.git"
+'
+
+# This will fail even without our rejection because upload-pack will
+# complain about the bogus option. So let's make sure that GIT_TRACE
+# doesn't show us even running upload-pack.
+#
+# We must also be sure to use "fetch" and not "clone" here, as the latter
+# actually canonicalizes our input into an absolute path (which is fine
+# to allow).
+test_expect_success 'repo names starting with dash are rejected' '
+ rm -f trace.out &&
+ test_must_fail env GIT_TRACE="$PWD/trace.out" git fetch -- -repo.git &&
+ ! grep upload-pack trace.out
+'
+
+test_expect_success 'full paths still work' '
+ git fetch "$PWD/-repo.git"
+'
+
test_done
diff --git a/t/t5813-proto-disable-ssh.sh b/t/t5813-proto-disable-ssh.sh
index a954ead8af..3f084ee306 100755
--- a/t/t5813-proto-disable-ssh.sh
+++ b/t/t5813-proto-disable-ssh.sh
@@ -17,4 +17,27 @@ test_proto "host:path" ssh "remote:repo.git"
test_proto "ssh://" ssh "ssh://remote$PWD/remote/repo.git"
test_proto "git+ssh://" ssh "git+ssh://remote$PWD/remote/repo.git"
+# Don't even bother setting up a "-remote" directory, as ssh would generally
+# complain about the bogus option rather than completing our request. Our
+# fake wrapper actually _can_ handle this case, but it's more robust to
+# simply confirm from its output that it did not run at all.
+test_expect_success 'hostnames starting with dash are rejected' '
+ test_must_fail git clone ssh://-remote/repo.git dash-host 2>stderr &&
+ ! grep ^ssh: stderr
+'
+
+test_expect_success 'setup repo with dash' '
+ git init --bare remote/-repo.git &&
+ git push remote/-repo.git HEAD
+'
+
+test_expect_success 'repo names starting with dash are rejected' '
+ test_must_fail git clone remote:-repo.git dash-path 2>stderr &&
+ ! grep ^ssh: stderr
+'
+
+test_expect_success 'full paths still work' '
+ git clone "remote:$PWD/remote/-repo.git" dash-path
+'
+
test_done
diff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh
index a1dcdb81d7..b326d550f3 100755
--- a/t/t6006-rev-list-format.sh
+++ b/t/t6006-rev-list-format.sh
@@ -59,10 +59,14 @@ test_format () {
}
# Feed to --format to provide predictable colored sequences.
+BASIC_COLOR='%Credfoo%Creset'
+COLOR='%C(red)foo%C(reset)'
AUTO_COLOR='%C(auto,red)foo%C(auto,reset)'
+ALWAYS_COLOR='%C(always,red)foo%C(always,reset)'
has_color () {
- printf '\033[31mfoo\033[m\n' >expect &&
- test_cmp expect "$1"
+ test_decode_color <"$1" >decoded &&
+ echo "<RED>foo<RESET>" >expect &&
+ test_cmp expect decoded
}
has_no_color () {
@@ -170,62 +174,84 @@ $added
EOF
-test_format colors %Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy <<EOF
-commit $head2
-foobarbazxyzzy
-commit $head1
-foobarbazxyzzy
-EOF
-
-test_format advanced-colors '%C(red yellow bold)foo%C(reset)' <<EOF
-commit $head2
-foo
-commit $head1
-foo
-EOF
-
-test_expect_success '%C(auto,...) does not enable color by default' '
- git log --format=$AUTO_COLOR -1 >actual &&
- has_no_color actual
+test_expect_success 'basic colors' '
+ cat >expect <<-EOF &&
+ commit $head2
+ <RED>foo<GREEN>bar<BLUE>baz<RESET>xyzzy
+ EOF
+ format="%Credfoo%Cgreenbar%Cbluebaz%Cresetxyzzy" &&
+ git rev-list --color --format="$format" -1 master >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect actual
'
-test_expect_success '%C(auto,...) enables colors for color.diff' '
- git -c color.diff=always log --format=$AUTO_COLOR -1 >actual &&
- has_color actual
+test_expect_success 'advanced colors' '
+ cat >expect <<-EOF &&
+ commit $head2
+ <BOLD;RED;BYELLOW>foo<RESET>
+ EOF
+ format="%C(red yellow bold)foo%C(reset)" &&
+ git rev-list --color --format="$format" -1 master >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect actual
'
-test_expect_success '%C(auto,...) enables colors for color.ui' '
- git -c color.ui=always log --format=$AUTO_COLOR -1 >actual &&
- has_color actual
-'
+for spec in \
+ "%Cred:$BASIC_COLOR" \
+ "%C(...):$COLOR" \
+ "%C(auto,...):$AUTO_COLOR"
+do
+ desc=${spec%%:*}
+ color=${spec#*:}
+ test_expect_success "$desc does not enable color by default" '
+ git log --format=$color -1 >actual &&
+ has_no_color actual
+ '
-test_expect_success '%C(auto,...) respects --color' '
- git log --format=$AUTO_COLOR -1 --color >actual &&
- has_color actual
-'
+ test_expect_success "$desc enables colors for color.diff" '
+ git -c color.diff=always log --format=$color -1 >actual &&
+ has_color actual
+ '
-test_expect_success '%C(auto,...) respects --no-color' '
- git -c color.ui=always log --format=$AUTO_COLOR -1 --no-color >actual &&
- has_no_color actual
-'
+ test_expect_success "$desc enables colors for color.ui" '
+ git -c color.ui=always log --format=$color -1 >actual &&
+ has_color actual
+ '
-test_expect_success TTY '%C(auto,...) respects --color=auto (stdout is tty)' '
- test_terminal env TERM=vt100 \
- git log --format=$AUTO_COLOR -1 --color=auto >actual &&
- has_color actual
-'
+ test_expect_success "$desc respects --color" '
+ git log --format=$color -1 --color >actual &&
+ has_color actual
+ '
-test_expect_success '%C(auto,...) respects --color=auto (stdout not tty)' '
- (
- TERM=vt100 && export TERM &&
- git log --format=$AUTO_COLOR -1 --color=auto >actual &&
+ test_expect_success "$desc respects --no-color" '
+ git -c color.ui=always log --format=$color -1 --no-color >actual &&
has_no_color actual
- )
+ '
+
+ test_expect_success TTY "$desc respects --color=auto (stdout is tty)" '
+ test_terminal env TERM=vt100 \
+ git log --format=$color -1 --color=auto >actual &&
+ has_color actual
+ '
+
+ test_expect_success "$desc respects --color=auto (stdout not tty)" '
+ (
+ TERM=vt100 && export TERM &&
+ git log --format=$color -1 --color=auto >actual &&
+ has_no_color actual
+ )
+ '
+done
+
+test_expect_success '%C(always,...) enables color even without tty' '
+ git log --format=$ALWAYS_COLOR -1 >actual &&
+ has_color actual
'
test_expect_success '%C(auto) respects --color' '
- git log --color --format="%C(auto)%H" -1 >actual &&
- printf "\\033[33m%s\\033[m\\n" $(git rev-parse HEAD) >expect &&
+ git log --color --format="%C(auto)%H" -1 >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ echo "<YELLOW>$(git rev-parse HEAD)<RESET>" >expect &&
test_cmp expect actual
'
@@ -235,6 +261,17 @@ test_expect_success '%C(auto) respects --no-color' '
test_cmp expect actual
'
+test_expect_success 'rev-list %C(auto,...) respects --color' '
+ git rev-list --color --format="%C(auto,green)foo%C(auto,reset)" \
+ -1 HEAD >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ cat >expect <<-EOF &&
+ commit $(git rev-parse HEAD)
+ <GREEN>foo<RESET>
+ EOF
+ test_cmp expect actual
+'
+
iconv -f utf-8 -t $test_encoding > commit-msg <<EOF
Test printing of complex bodies
diff --git a/t/t6300-for-each-ref.sh b/t/t6300-for-each-ref.sh
index 834a9ed168..2274a4b733 100755
--- a/t/t6300-for-each-ref.sh
+++ b/t/t6300-for-each-ref.sh
@@ -7,6 +7,7 @@ test_description='for-each-ref test'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
# Mon Jul 3 23:18:43 2006 +0000
datestamp=1151968723
@@ -412,21 +413,33 @@ test_expect_success 'Check for invalid refname format' '
test_must_fail git for-each-ref --format="%(refname:INVALID)"
'
-get_color ()
-{
- git config --get-color no.such.slot "$1"
-}
+test_expect_success 'set up color tests' '
+ cat >expected.color <<-EOF &&
+ $(git rev-parse --short refs/heads/master) <GREEN>master<RESET>
+ $(git rev-parse --short refs/remotes/origin/master) <GREEN>origin/master<RESET>
+ $(git rev-parse --short refs/tags/testtag) <GREEN>testtag<RESET>
+ $(git rev-parse --short refs/tags/two) <GREEN>two<RESET>
+ EOF
+ sed "s/<[^>]*>//g" <expected.color >expected.bare &&
+ color_format="%(objectname:short) %(color:green)%(refname:short)"
+'
-cat >expected <<EOF
-$(git rev-parse --short refs/heads/master) $(get_color green)master$(get_color reset)
-$(git rev-parse --short refs/remotes/origin/master) $(get_color green)origin/master$(get_color reset)
-$(git rev-parse --short refs/tags/testtag) $(get_color green)testtag$(get_color reset)
-$(git rev-parse --short refs/tags/two) $(get_color green)two$(get_color reset)
-EOF
+test_expect_success TTY '%(color) shows color with a tty' '
+ test_terminal env TERM=vt100 \
+ git for-each-ref --format="$color_format" >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expected.color actual
+'
-test_expect_success 'Check %(color:...) ' '
- git for-each-ref --format="%(objectname:short) %(color:green)%(refname:short)" >actual &&
- test_cmp expected actual
+test_expect_success '%(color) does not show color without tty' '
+ TERM=vt100 git for-each-ref --format="$color_format" >actual &&
+ test_cmp expected.bare actual
+'
+
+test_expect_success 'color.ui=always can override tty check' '
+ git -c color.ui=always for-each-ref --format="$color_format" >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expected.color actual
'
cat >expected <<\EOF
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index cc7acd101d..41b0be575d 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -95,6 +95,27 @@ test_expect_success 'background auto gc does not run if gc.log is present and re
test_line_count = 1 packs
'
+test_expect_success 'background auto gc respects lock for all operations' '
+ # make sure we run a background auto-gc
+ test_commit make-pack &&
+ git repack &&
+ test_config gc.autopacklimit 1 &&
+ test_config gc.autodetach true &&
+
+ # create a ref whose loose presence we can use to detect a pack-refs run
+ git update-ref refs/heads/should-be-loose HEAD &&
+ test_path_is_file .git/refs/heads/should-be-loose &&
+
+ # now fake a concurrent gc that holds the lock; we can use our
+ # shell pid so that it looks valid.
+ hostname=$(hostname || echo unknown) &&
+ printf "$$ %s" "$hostname" >.git/gc.pid &&
+
+ # our gc should exit zero without doing anything
+ run_and_wait_for_auto_gc &&
+ test_path_is_file .git/refs/heads/should-be-loose
+'
+
# DO NOT leave a detached auto gc process running near the end of the
# test script: it can run long enough in the background to racily
# interfere with the cleanup in 'test_done'.
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 0ef7b94394..dd5ba450ee 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -9,6 +9,7 @@ Tests for operations with tags.'
. ./test-lib.sh
. "$TEST_DIRECTORY"/lib-gpg.sh
+. "$TEST_DIRECTORY"/lib-terminal.sh
# creating and listing lightweight tags:
@@ -1900,6 +1901,30 @@ test_expect_success '--format should list tags as per format given' '
test_cmp expect actual
'
+test_expect_success "set up color tests" '
+ echo "<RED>v1.0<RESET>" >expect.color &&
+ echo "v1.0" >expect.bare &&
+ color_args="--format=%(color:red)%(refname:short) --list v1.0"
+'
+
+test_expect_success '%(color) omitted without tty' '
+ TERM=vt100 git tag $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.bare actual
+'
+
+test_expect_success TTY '%(color) present with tty' '
+ test_terminal env TERM=vt100 git tag $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.color actual
+'
+
+test_expect_success 'color.ui=always overrides auto-color' '
+ git -c color.ui=always tag $color_args >actual.raw &&
+ test_decode_color <actual.raw >actual &&
+ test_cmp expect.color actual
+'
+
test_expect_success 'setup --merged test tags' '
git tag mergetest-1 HEAD~2 &&
git tag mergetest-2 HEAD~1 &&
diff --git a/t/t9831-git-p4-triggers.sh b/t/t9831-git-p4-triggers.sh
new file mode 100755
index 0000000000..bbcf14c664
--- /dev/null
+++ b/t/t9831-git-p4-triggers.sh
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+test_description='git p4 with server triggers'
+
+. ./lib-git-p4.sh
+
+test_expect_success 'start p4d' '
+ start_p4d
+'
+
+test_expect_success 'init depot' '
+ (
+ cd "$cli" &&
+ echo file1 >file1 &&
+ p4 add file1 &&
+ p4 submit -d "change 1"
+ echo file2 >file2 &&
+ p4 add file2 &&
+ p4 submit -d "change 2"
+ )
+'
+
+test_expect_success 'clone with extra info lines from verbose p4 trigger' '
+ test_when_finished cleanup_git &&
+ (
+ p4 triggers -i <<-EOF
+ Triggers: p4triggertest-command command pre-user-change "echo verbose trigger"
+ EOF
+ ) &&
+ (
+ p4 change -o | grep -s "verbose trigger"
+ ) &&
+ git p4 clone --dest="$git" //depot/@all &&
+ (
+ p4 triggers -i <<-EOF
+ Triggers:
+ EOF
+ )
+'
+
+test_expect_success 'import with extra info lines from verbose p4 trigger' '
+ test_when_finished cleanup_git &&
+ (
+ cd "$cli" &&
+ echo file3 >file3 &&
+ p4 add file3 &&
+ p4 submit -d "change 3"
+ ) &&
+ (
+ p4 triggers -i <<-EOF
+ Triggers: p4triggertest-command command pre-user-describe "echo verbose trigger"
+ EOF
+ ) &&
+ (
+ p4 describe 1 | grep -s "verbose trigger"
+ ) &&
+ git p4 clone --dest="$git" //depot/@all &&
+ (
+ cd "$git" &&
+ git p4 sync
+ )&&
+ (
+ p4 triggers -i <<-EOF
+ Triggers:
+ EOF
+ )
+'
+
+test_expect_success 'submit description with extra info lines from verbose p4 change trigger' '
+ test_when_finished cleanup_git &&
+ (
+ p4 triggers -i <<-EOF
+ Triggers: p4triggertest-command command pre-user-change "echo verbose trigger"
+ EOF
+ ) &&
+ (
+ p4 change -o | grep -s "verbose trigger"
+ ) &&
+ git p4 clone --dest="$git" //depot &&
+ (
+ cd "$git" &&
+ git config git-p4.skipSubmitEdit true &&
+ echo file4 >file4 &&
+ git add file4 &&
+ git commit -m file4 &&
+ git p4 submit
+ ) &&
+ (
+ p4 triggers -i <<-EOF
+ Triggers:
+ EOF
+ ) &&
+ (
+ cd "$cli" &&
+ test_path_is_file file4
+ )
+'
+
+test_expect_success 'kill p4d' '
+ kill_p4d
+'
+
+test_done
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index db622c3555..1701fe2a06 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -42,6 +42,7 @@ test_decode_color () {
function name(n) {
if (n == 0) return "RESET";
if (n == 1) return "BOLD";
+ if (n == 7) return "REVERSE";
if (n == 30) return "BLACK";
if (n == 31) return "RED";
if (n == 32) return "GREEN";
@@ -999,6 +1000,7 @@ test_copy_bytes () {
my $s;
my $nread = sysread(STDIN, $s, $len);
die "cannot read: $!" unless defined($nread);
+ last unless $nread;
print $s;
$len -= $nread;
}