From 08337a97a2756cd89ab611444f37d67250d3c05b Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Tue, 27 Dec 2005 09:19:05 +0100 Subject: [PATCH 1/4] copy_fd: close ifd on error In copy_fd when write fails we ought to close input file descriptor. Signed-off-by: Sam Ravnborg Signed-off-by: Junio C Hamano --- copy.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/copy.c b/copy.c index 7100eedbc3..08a3d388a4 100644 --- a/copy.c +++ b/copy.c @@ -22,11 +22,14 @@ int copy_fd(int ifd, int ofd) buf += written; len -= written; } - else if (!written) + else if (!written) { + close(ifd); return error("copy-fd: write returned 0"); - else + } else { + close(ifd); return error("copy-fd: write returned %s", strerror(errno)); + } } } close(ifd); From 8eafa3da62297eb91741321281fd3fb2a4236e97 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 27 Dec 2005 10:51:23 -0800 Subject: [PATCH 2/4] Guard a test against wc that pads its output with whitespace Spotted by Johannes. Signed-off-by: Junio C Hamano --- t/t5300-pack-object.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 1510ea9fcc..de45ac4e0f 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -168,7 +168,7 @@ test_expect_success \ : sum of the index file itself && l=`wc -c Date: Tue, 27 Dec 2005 11:06:43 -0800 Subject: [PATCH 3/4] Fix bogus tests on rev-list output. These tests seem to mean checking the output with expected result, but was not doing its handrolled test helper function. Also fix the guard to workaround wc output that have whitespace padding, which was broken but not exposed because the test was not testing it ;-). Signed-off-by: Junio C Hamano --- t/t6001-rev-list-merge-order.sh | 2 +- t/t6003-rev-list-topo-order.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t6001-rev-list-merge-order.sh b/t/t6001-rev-list-merge-order.sh index 8ec9ebb98a..368b8d9e02 100755 --- a/t/t6001-rev-list-merge-order.sh +++ b/t/t6001-rev-list-merge-order.sh @@ -110,7 +110,7 @@ save_tag g4 unique_commit g6 tree -p g3 -p h2 git-update-ref HEAD $(tag l5) -test_expect_success 'rev-list has correct number of entries' 'git-rev-list HEAD | wc -l | tr -s " "' < Date: Tue, 27 Dec 2005 11:52:51 -0800 Subject: [PATCH 4/4] Do not mark tags fetched via --tags flag as mergeable Otherwise "git pull --tags" would mistakenly try to merge all of them, which is never what the user wants. Signed-off-by: Junio C Hamano --- git-fetch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-fetch.sh b/git-fetch.sh index 767ca61ca6..125bcea1b6 100755 --- a/git-fetch.sh +++ b/git-fetch.sh @@ -192,7 +192,7 @@ then sed -e ' /\^/d s/^[^ ]* // - s/.*/&:&/') + s/.*/.&:&/') if test "$#" -gt 1 then # remote URL plus explicit refspecs; we need to merge them.