From e726715a52e25d8035c89d4ea09398599610737e Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 12 Dec 2005 12:28:34 -0800 Subject: Add deltifier test. This test kicks in only if you built test-delta executable, and makes sure that the basic delta routine is working properly even on empty files. This commit is to make sure we have a test to catch the breakage. The delitifier code is still broken, which will be fixed with the next commit. Signed-off-by: Junio C Hamano --- t/t0001-delta.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 t/t0001-delta.sh (limited to 't') diff --git a/t/t0001-delta.sh b/t/t0001-delta.sh new file mode 100755 index 0000000000..2dd88e503d --- /dev/null +++ b/t/t0001-delta.sh @@ -0,0 +1,43 @@ +#!/bin/sh + +test_description='Deltification regression test' + +../test-delta 2>/dev/null +test $? == 127 && { + echo "* Skipping test-delta regression test." + exit 0 +} + +. ./test-lib.sh + +>empty +echo small >small +echo smallish >smallish +cat ../../COPYING >large +sed -e 's/GNU/G.N.U/g' large >largish + +test_expect_success 'No regression in deltify code' \ +' +fail=0 +for src in empty small smallish large largish +do + for dst in empty small smallish large largish + do + if test-delta -d $src $dst delta-$src-$dst && + test-delta -p $src delta-$src-$dst out-$src-$dst && + cmp $dst out-$src-$dst + then + echo "* OK ($src->$dst deitify and apply)" + else + echo "* FAIL ($src->$dst deitify and apply)" + fail=1 + fi + done +done +case "$fail" in +0) (exit 0) ;; +*) (exit $fail) ;; +esac +' + +test_done -- cgit v1.3-6-g1900 From 86c9523305f75818d4dce485a18f6b4ccae78233 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 12 Dec 2005 16:43:15 -0800 Subject: Revert "Add deltifier test." This reverts e726715a52e25d8035c89d4ea09398599610737e commit, because reverting diff-delta emptiness change would break this test. --- t/t0001-delta.sh | 43 ------------------------------------------- test-delta.c | 11 ++--------- 2 files changed, 2 insertions(+), 52 deletions(-) delete mode 100755 t/t0001-delta.sh (limited to 't') diff --git a/t/t0001-delta.sh b/t/t0001-delta.sh deleted file mode 100755 index 2dd88e503d..0000000000 --- a/t/t0001-delta.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -test_description='Deltification regression test' - -../test-delta 2>/dev/null -test $? == 127 && { - echo "* Skipping test-delta regression test." - exit 0 -} - -. ./test-lib.sh - ->empty -echo small >small -echo smallish >smallish -cat ../../COPYING >large -sed -e 's/GNU/G.N.U/g' large >largish - -test_expect_success 'No regression in deltify code' \ -' -fail=0 -for src in empty small smallish large largish -do - for dst in empty small smallish large largish - do - if test-delta -d $src $dst delta-$src-$dst && - test-delta -p $src delta-$src-$dst out-$src-$dst && - cmp $dst out-$src-$dst - then - echo "* OK ($src->$dst deitify and apply)" - else - echo "* FAIL ($src->$dst deitify and apply)" - fail=1 - fi - done -done -case "$fail" in -0) (exit 0) ;; -*) (exit $fail) ;; -esac -' - -test_done diff --git a/test-delta.c b/test-delta.c index cc05794ec0..1be8ee0c72 100644 --- a/test-delta.c +++ b/test-delta.c @@ -38,10 +38,7 @@ int main(int argc, char *argv[]) return 1; } from_size = st.st_size; - if (from_size) - from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0); - else - from_buf = ""; + from_buf = mmap(NULL, from_size, PROT_READ, MAP_PRIVATE, fd, 0); if (from_buf == MAP_FAILED) { perror(argv[2]); close(fd); @@ -55,11 +52,7 @@ int main(int argc, char *argv[]) return 1; } data_size = st.st_size; - - if (data_size) - data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0); - else - data_buf = ""; + data_buf = mmap(NULL, data_size, PROT_READ, MAP_PRIVATE, fd, 0); if (data_buf == MAP_FAILED) { perror(argv[3]); close(fd); -- cgit v1.3-6-g1900 From ed24928e122bad83e62d161087f806fa21c46a59 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Wed, 14 Dec 2005 01:45:40 +0100 Subject: Make git-send-pack exit with error when some refs couldn't be pushed out In case some refs couldn't be pushed out due to an error (mostly the not-a-proper-subset error), make git-send-pack exit with non-zero status after the push is over (that is, it still tries to push out the rest of the refs). [jc: I adjusted a test for this change.] Signed-off-by: Petr Baudis Signed-off-by: Junio C Hamano --- send-pack.c | 6 +++++- t/t5400-send-pack.sh | 10 +++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 't') diff --git a/send-pack.c b/send-pack.c index f61c15c820..6ce0d9f788 100644 --- a/send-pack.c +++ b/send-pack.c @@ -179,6 +179,7 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec) { struct ref *ref; int new_refs; + int ret = 0; /* No funny business with the matcher */ remote_tail = get_remote_heads(in, &remote_refs, 0, NULL, 1); @@ -232,6 +233,7 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec) error("remote '%s' object %s does not " "exist on local", ref->name, sha1_to_hex(ref->old_sha1)); + ret = -2; continue; } @@ -245,12 +247,14 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec) error("remote ref '%s' is not a strict " "subset of local ref '%s'.", ref->name, ref->peer_ref->name); + ret = -2; continue; } } memcpy(ref->new_sha1, ref->peer_ref->new_sha1, 20); if (is_zero_sha1(ref->new_sha1)) { error("cannot happen anymore"); + ret = -3; continue; } new_refs++; @@ -267,7 +271,7 @@ static int send_pack(int in, int out, int nr_refspec, char **refspec) if (new_refs) pack_objects(out, remote_refs); close(out); - return 0; + return ret; } diff --git a/t/t5400-send-pack.sh b/t/t5400-send-pack.sh index 7fc3bd7d3e..f3694ac3c7 100755 --- a/t/t5400-send-pack.sh +++ b/t/t5400-send-pack.sh @@ -43,7 +43,15 @@ test_expect_success setup ' test_expect_success \ 'pushing rewound head should not barf but require --force' ' # should not fail but refuse to update. - git-send-pack ./victim/.git/ master && + if git-send-pack ./victim/.git/ master + then + # now it should fail with Pasky patch + echo >&2 Gaah, it should have failed. + false + else + echo >&2 Thanks, it correctly failed. + true + fi && if cmp victim/.git/refs/heads/master .git/refs/heads/master then # should have been left as it was! -- cgit v1.3-6-g1900 From aa9dc7afd2fc40466b430b35fc5c82d3c820cb26 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 12 Dec 2005 23:38:47 -0800 Subject: t3200: branch --help does not die anymore. Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 't') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 36f7749bed..c3de151942 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -16,8 +16,8 @@ test_expect_success \ git-update-index --add A && git-commit -m "Initial commit."' -test_expect_failure \ - 'git branch --help should return error code' \ +test_expect_success \ + 'git branch --help should return success now.' \ 'git-branch --help' test_expect_failure \ -- cgit v1.3-6-g1900 From 294c695d8cfbcf95a5c33fc6ba386f496964defb Mon Sep 17 00:00:00 2001 From: Amos Waterland Date: Wed, 14 Dec 2005 17:48:19 -0500 Subject: git rebase loses author name/email if given bad email address If GIT_AUTHOR_EMAIL is of a certain form, `git rebase master' will blow away the author name and email when fast-forward merging commits. I have not tracked it down, but here is a testcase that demonstrates the behavior. Signed-off-by: Amos Waterland Acked-by: Michal Ostrowski Signed-off-by: Junio C Hamano --- t/t3400-rebase.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 t/t3400-rebase.sh (limited to 't') diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh new file mode 100755 index 0000000000..b9d3131cc2 --- /dev/null +++ b/t/t3400-rebase.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (c) 2005 Amos Waterland +# + +test_description='git rebase should not destroy author information + +This test runs git rebase and checks that the author information is not lost. +' +. ./test-lib.sh + +export GIT_AUTHOR_EMAIL=bogus_email_address + +test_expect_success \ + 'prepare repository with topic branch, then rebase against master' \ + 'echo First > A && + git-update-index --add A && + git-commit -m "Add A." && + git checkout -b my-topic-branch && + echo Second > B && + git-update-index --add B && + git-commit -m "Add B." && + git checkout -f master && + echo Third >> A && + git-update-index A && + git-commit -m "Modify A." && + git checkout -f my-topic-branch && + git rebase master' + +test_expect_failure \ + 'the rebase operation should not have destroyed author information' \ + 'git log | grep "Author:" | grep "<>"' + +test_done -- cgit v1.3-6-g1900