@@ -3362,6 +3362,8 @@ static int subject2item_cmp(const void *fndata,
3362
3362
return key ? strcmp (a -> subject , key ) : strcmp (a -> subject , b -> subject );
3363
3363
}
3364
3364
3365
+ define_commit_slab (commit_todo_item , struct todo_item * );
3366
+
3365
3367
/*
3366
3368
* Rearrange the todo list that has both "pick commit-id msg" and "pick
3367
3369
* commit-id fixup!/squash! msg" in it so that the latter is put immediately
@@ -3378,6 +3380,7 @@ int rearrange_squash(void)
3378
3380
struct hashmap subject2item ;
3379
3381
int res = 0 , rearranged = 0 , * next , * tail , i ;
3380
3382
char * * subjects ;
3383
+ struct commit_todo_item commit_todo ;
3381
3384
3382
3385
if (strbuf_read_file_or_whine (& todo_list .buf , todo_file ) < 0 )
3383
3386
return -1 ;
@@ -3386,6 +3389,7 @@ int rearrange_squash(void)
3386
3389
return -1 ;
3387
3390
}
3388
3391
3392
+ init_commit_todo_item (& commit_todo );
3389
3393
/*
3390
3394
* The hashmap maps onelines to the respective todo list index.
3391
3395
*
@@ -3416,10 +3420,11 @@ int rearrange_squash(void)
3416
3420
3417
3421
if (is_fixup (item -> command )) {
3418
3422
todo_list_release (& todo_list );
3423
+ clear_commit_todo_item (& commit_todo );
3419
3424
return error (_ ("the script was already rearranged." ));
3420
3425
}
3421
3426
3422
- item -> commit -> util = item ;
3427
+ * commit_todo_item_at ( & commit_todo , item -> commit ) = item ;
3423
3428
3424
3429
parse_commit (item -> commit );
3425
3430
commit_buffer = get_commit_buffer (item -> commit , NULL );
@@ -3446,9 +3451,9 @@ int rearrange_squash(void)
3446
3451
else if (!strchr (p , ' ' ) &&
3447
3452
(commit2 =
3448
3453
lookup_commit_reference_by_name (p )) &&
3449
- commit2 -> util )
3454
+ * commit_todo_item_at ( & commit_todo , commit2 ) )
3450
3455
/* found by commit name */
3451
- i2 = ( struct todo_item * ) commit2 -> util
3456
+ i2 = * commit_todo_item_at ( & commit_todo , commit2 )
3452
3457
- todo_list .items ;
3453
3458
else {
3454
3459
/* copy can be a prefix of the commit subject */
@@ -3527,5 +3532,6 @@ int rearrange_squash(void)
3527
3532
hashmap_free (& subject2item , 1 );
3528
3533
todo_list_release (& todo_list );
3529
3534
3535
+ clear_commit_todo_item (& commit_todo );
3530
3536
return res ;
3531
3537
}
0 commit comments