[PATCH 2/2] pack-objects: Default to zero threads, meaning auto-assign to #cpus

Previous thread: Unable to clone an ssh repository (with ugly installation-specific workaround) by Elijah Newren on Monday, February 11, 2008 - 10:22 pm. (11 messages)

Next thread: [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description by Bruno Ribas on Monday, February 11, 2008 - 11:25 pm. (5 messages)
To: <ae@...>
Cc: Nicolas Pitre <nico@...>, Git Mailing List <git@...>
Date: Monday, February 11, 2008 - 10:59 pm

Additionally, update some tests for which the multi-threaded result
differs from the single-threaded result and the single-threaded
result is expected.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
---

Two of the tests in t5300-pack-object.sh failed when multiple
threads were used. My fix was to set --threads=1 for all pack-objects
calls. I didn't look into it any further than that. All other tests
passed.

-brandon

builtin-pack-objects.c | 2 +-
t/t5300-pack-object.sh | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 5c55c11..743de52 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -70,7 +70,7 @@ static int progress = 1;
static int window = 10;
static uint32_t pack_size_limit, pack_size_limit_cfg;
static int depth = 50;
-static int delta_search_threads = 1;
+static int delta_search_threads = 0;
static int pack_to_stdout;
static int num_preferred_base;
static struct progress *progress_state;
diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh
index cd3c149..16ee940 100755
--- a/t/t5300-pack-object.sh
+++ b/t/t5300-pack-object.sh
@@ -35,7 +35,7 @@ test_expect_success \

test_expect_success \
'pack without delta' \
- 'packname_1=$(git pack-objects --window=0 test-1 <obj-list)'
+ 'packname_1=$(git pack-objects --threads=1 --window=0 test-1 <obj-list)'

rm -fr .git2
mkdir .git2
@@ -66,7 +66,7 @@ cd "$TRASH"
test_expect_success \
'pack with REF_DELTA' \
'pwd &&
- packname_2=$(git pack-objects test-2 <obj-list)'
+ packname_2=$(git pack-objects --threads=1 test-2 <obj-list)'

rm -fr .git2
mkdir .git2
@@ -96,7 +96,7 @@ cd "$TRASH"
test_expect_success \
'pack with OFS_DELTA' \
'pwd &&
- packname_3=$(git pack-objects --delta-base-offset test-3 <obj-list)'
+ packname_3=$(git pack-objects --threads=1 --delta-base-offset test-3 <obj-list)'
...

To: Brandon Casey <casey@...>
Cc: <ae@...>, Git Mailing List <git@...>
Date: Tuesday, February 12, 2008 - 12:57 am

I think the first patch is OK, but having the _default_ be
multi-threaded is going a bit too far. IMHO you should document the
meaning of the value 0, and compile with thread support whenever Posix
threads are available, but activating threads should be done explicitly.

Nicolas
-

Previous thread: Unable to clone an ssh repository (with ugly installation-specific workaround) by Elijah Newren on Monday, February 11, 2008 - 10:22 pm. (11 messages)

Next thread: [PATCH] contrib/hooks/post-receive-email: checks for gitweb.description by Bruno Ribas on Monday, February 11, 2008 - 11:25 pm. (5 messages)