Skip to content

Commit c7ac8c0

Browse files
committed
Merge branch 'jk/index-pack-hotfixes'
Hotfix and clean-up for the jt/threaded-index-pack topic that has graduated to v2.29-rc0. * jk/index-pack-hotfixes: index-pack: make get_base_data() comment clearer index-pack: drop type_cas mutex index-pack: restore "resolving deltas" progress meter
2 parents abac91e + ec6a8f9 commit c7ac8c0

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

builtin/index-pack.c

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ static pthread_mutex_t deepest_delta_mutex;
159159
#define deepest_delta_lock() lock_mutex(&deepest_delta_mutex)
160160
#define deepest_delta_unlock() unlock_mutex(&deepest_delta_mutex)
161161

162-
static pthread_mutex_t type_cas_mutex;
163-
#define type_cas_lock() lock_mutex(&type_cas_mutex)
164-
#define type_cas_unlock() unlock_mutex(&type_cas_mutex)
165-
166162
static pthread_key_t key;
167163

168164
static inline void lock_mutex(pthread_mutex_t *mutex)
@@ -186,7 +182,6 @@ static void init_thread(void)
186182
init_recursive_mutex(&read_mutex);
187183
pthread_mutex_init(&counter_mutex, NULL);
188184
pthread_mutex_init(&work_mutex, NULL);
189-
pthread_mutex_init(&type_cas_mutex, NULL);
190185
if (show_stat)
191186
pthread_mutex_init(&deepest_delta_mutex, NULL);
192187
pthread_key_create(&key, NULL);
@@ -209,7 +204,6 @@ static void cleanup_thread(void)
209204
pthread_mutex_destroy(&read_mutex);
210205
pthread_mutex_destroy(&counter_mutex);
211206
pthread_mutex_destroy(&work_mutex);
212-
pthread_mutex_destroy(&type_cas_mutex);
213207
if (show_stat)
214208
pthread_mutex_destroy(&deepest_delta_mutex);
215209
for (i = 0; i < nr_threads; i++)
@@ -894,18 +888,15 @@ static void sha1_object(const void *data, struct object_entry *obj_entry,
894888
}
895889

896890
/*
897-
* Walk from current node up
898-
* to top parent if necessary to deflate the node. In normal
899-
* situation, its parent node would be already deflated, so it just
900-
* needs to apply delta.
901-
*
902-
* In the worst case scenario, parent node is no longer deflated because
903-
* we're running out of delta_base_cache_limit; we need to re-deflate
904-
* parents, possibly up to the top base.
891+
* Ensure that this node has been reconstructed and return its contents.
905892
*
906-
* All deflated objects here are subject to be freed if we exceed
907-
* delta_base_cache_limit, just like in find_unresolved_deltas(), we
908-
* just need to make sure the last node is not freed.
893+
* In the typical and best case, this node would already be reconstructed
894+
* (through the invocation to resolve_delta() in threaded_second_pass()) and it
895+
* would not be pruned. However, if pruning of this node was necessary due to
896+
* reaching delta_base_cache_limit, this function will find the closest
897+
* ancestor with reconstructed data that has not been pruned (or if there is
898+
* none, the ultimate base object), and reconstruct each node in the delta
899+
* chain in order to generate the reconstructed data for this node.
909900
*/
910901
static void *get_base_data(struct base_data *c)
911902
{
@@ -1028,6 +1019,10 @@ static void *threaded_second_pass(void *data)
10281019
struct object_entry *child_obj;
10291020
struct base_data *child;
10301021

1022+
counter_lock();
1023+
display_progress(progress, nr_resolved_deltas);
1024+
counter_unlock();
1025+
10311026
work_lock();
10321027
if (list_empty(&work_head)) {
10331028
/*

t/t5302-pack-index.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,4 +277,11 @@ test_expect_success 'index-pack --fsck-objects also warns upon missing tagger in
277277
grep "^warning:.* expected .tagger. line" err
278278
'
279279

280+
test_expect_success 'index-pack -v --stdin produces progress for both phases' '
281+
pack=$(git pack-objects --all pack </dev/null) &&
282+
GIT_PROGRESS_DELAY=0 git index-pack -v --stdin <pack-$pack.pack 2>err &&
283+
test_i18ngrep "Receiving objects" err &&
284+
test_i18ngrep "Resolving deltas" err
285+
'
286+
280287
test_done

0 commit comments

Comments
 (0)