@@ -90,7 +90,7 @@ static struct blame_origin *get_origin(struct commit *commit, const char *path)
90
90
91
91
92
92
93
- static void verify_working_tree_path (struct repository * repo ,
93
+ static void verify_working_tree_path (struct repository * r ,
94
94
struct commit * work_tree , const char * path )
95
95
{
96
96
struct commit_list * parents ;
@@ -102,15 +102,15 @@ static void verify_working_tree_path(struct repository *repo,
102
102
unsigned mode ;
103
103
104
104
if (!get_tree_entry (commit_oid , path , & blob_oid , & mode ) &&
105
- oid_object_info (repo , & blob_oid , NULL ) == OBJ_BLOB )
105
+ oid_object_info (r , & blob_oid , NULL ) == OBJ_BLOB )
106
106
return ;
107
107
}
108
108
109
- pos = index_name_pos (repo -> index , path , strlen (path ));
109
+ pos = index_name_pos (r -> index , path , strlen (path ));
110
110
if (pos >= 0 )
111
111
; /* path is in the index */
112
- else if (-1 - pos < repo -> index -> cache_nr &&
113
- !strcmp (repo -> index -> cache [-1 - pos ]-> name , path ))
112
+ else if (-1 - pos < r -> index -> cache_nr &&
113
+ !strcmp (r -> index -> cache [-1 - pos ]-> name , path ))
114
114
; /* path is in the index, unmerged */
115
115
else
116
116
die ("no such path '%s' in HEAD" , path );
@@ -166,7 +166,7 @@ static void set_commit_buffer_from_strbuf(struct commit *c, struct strbuf *sb)
166
166
* Prepare a dummy commit that represents the work tree (or staged) item.
167
167
* Note that annotating work tree item never works in the reverse.
168
168
*/
169
- static struct commit * fake_working_tree_commit (struct repository * repo ,
169
+ static struct commit * fake_working_tree_commit (struct repository * r ,
170
170
struct diff_options * opt ,
171
171
const char * path ,
172
172
const char * contents_from )
@@ -183,7 +183,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
183
183
unsigned mode ;
184
184
struct strbuf msg = STRBUF_INIT ;
185
185
186
- read_index (repo -> index );
186
+ read_index (r -> index );
187
187
time (& now );
188
188
commit = alloc_commit_node (the_repository );
189
189
commit -> object .parsed = 1 ;
@@ -195,7 +195,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
195
195
196
196
parent_tail = append_parent (parent_tail , & head_oid );
197
197
append_merge_parents (parent_tail );
198
- verify_working_tree_path (repo , commit , path );
198
+ verify_working_tree_path (r , commit , path );
199
199
200
200
origin = make_origin (commit , path );
201
201
@@ -234,7 +234,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
234
234
switch (st .st_mode & S_IFMT ) {
235
235
case S_IFREG :
236
236
if (opt -> flags .allow_textconv &&
237
- textconv_object (read_from , mode , & null_oid , 0 , & buf_ptr , & buf_len ))
237
+ textconv_object (r , read_from , mode , & null_oid , 0 , & buf_ptr , & buf_len ))
238
238
strbuf_attach (& buf , buf_ptr , buf_len , buf_len + 1 );
239
239
else if (strbuf_read_file (& buf , read_from , st .st_size ) != st .st_size )
240
240
die_errno ("cannot open or read '%s'" , read_from );
@@ -253,7 +253,7 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
253
253
if (strbuf_read (& buf , 0 , 0 ) < 0 )
254
254
die_errno ("failed to read from stdin" );
255
255
}
256
- convert_to_git (repo -> index , path , buf .buf , buf .len , & buf , 0 );
256
+ convert_to_git (r -> index , path , buf .buf , buf .len , & buf , 0 );
257
257
origin -> file .ptr = buf .buf ;
258
258
origin -> file .size = buf .len ;
259
259
pretend_object_file (buf .buf , buf .len , OBJ_BLOB , & origin -> blob_oid );
@@ -264,28 +264,28 @@ static struct commit *fake_working_tree_commit(struct repository *repo,
264
264
* bits; we are not going to write this index out -- we just
265
265
* want to run "diff-index --cached".
266
266
*/
267
- discard_index (repo -> index );
268
- read_index (repo -> index );
267
+ discard_index (r -> index );
268
+ read_index (r -> index );
269
269
270
270
len = strlen (path );
271
271
if (!mode ) {
272
- int pos = index_name_pos (repo -> index , path , len );
272
+ int pos = index_name_pos (r -> index , path , len );
273
273
if (0 <= pos )
274
- mode = repo -> index -> cache [pos ]-> ce_mode ;
274
+ mode = r -> index -> cache [pos ]-> ce_mode ;
275
275
else
276
276
/* Let's not bother reading from HEAD tree */
277
277
mode = S_IFREG | 0644 ;
278
278
}
279
- ce = make_empty_cache_entry (repo -> index , len );
279
+ ce = make_empty_cache_entry (r -> index , len );
280
280
oidcpy (& ce -> oid , & origin -> blob_oid );
281
281
memcpy (ce -> name , path , len );
282
282
ce -> ce_flags = create_ce_flags (0 );
283
283
ce -> ce_namelen = len ;
284
284
ce -> ce_mode = create_ce_mode (mode );
285
- add_index_entry (repo -> index , ce ,
285
+ add_index_entry (r -> index , ce ,
286
286
ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE );
287
287
288
- cache_tree_invalidate_path (repo -> index , path );
288
+ cache_tree_invalidate_path (r -> index , path );
289
289
290
290
return commit ;
291
291
}
@@ -318,7 +318,8 @@ static void fill_origin_blob(struct diff_options *opt,
318
318
319
319
(* num_read_blob )++ ;
320
320
if (opt -> flags .allow_textconv &&
321
- textconv_object (o -> path , o -> mode , & o -> blob_oid , 1 , & file -> ptr , & file_size ))
321
+ textconv_object (opt -> repo , o -> path , o -> mode ,
322
+ & o -> blob_oid , 1 , & file -> ptr , & file_size ))
322
323
;
323
324
else
324
325
file -> ptr = read_object_file (& o -> blob_oid , & type ,
@@ -520,14 +521,14 @@ static void queue_blames(struct blame_scoreboard *sb, struct blame_origin *porig
520
521
*
521
522
* This also fills origin->mode for corresponding tree path.
522
523
*/
523
- static int fill_blob_sha1_and_mode (struct repository * repo ,
524
+ static int fill_blob_sha1_and_mode (struct repository * r ,
524
525
struct blame_origin * origin )
525
526
{
526
527
if (!is_null_oid (& origin -> blob_oid ))
527
528
return 0 ;
528
529
if (get_tree_entry (& origin -> commit -> object .oid , origin -> path , & origin -> blob_oid , & origin -> mode ))
529
530
goto error_out ;
530
- if (oid_object_info (repo , & origin -> blob_oid , NULL ) != OBJ_BLOB )
531
+ if (oid_object_info (r , & origin -> blob_oid , NULL ) != OBJ_BLOB )
531
532
goto error_out ;
532
533
return 0 ;
533
534
error_out :
@@ -540,8 +541,9 @@ static int fill_blob_sha1_and_mode(struct repository *repo,
540
541
* We have an origin -- check if the same path exists in the
541
542
* parent and return an origin structure to represent it.
542
543
*/
543
- static struct blame_origin * find_origin (struct commit * parent ,
544
- struct blame_origin * origin )
544
+ static struct blame_origin * find_origin (struct repository * r ,
545
+ struct commit * parent ,
546
+ struct blame_origin * origin )
545
547
{
546
548
struct blame_origin * porigin ;
547
549
struct diff_options diff_opts ;
@@ -561,7 +563,7 @@ static struct blame_origin *find_origin(struct commit *parent,
561
563
* and origin first. Most of the time they are the
562
564
* same and diff-tree is fairly efficient about this.
563
565
*/
564
- diff_setup ( & diff_opts );
566
+ repo_diff_setup ( r , & diff_opts );
565
567
diff_opts .flags .recursive = 1 ;
566
568
diff_opts .detect_rename = 0 ;
567
569
diff_opts .output_format = DIFF_FORMAT_NO_OUTPUT ;
@@ -628,14 +630,15 @@ static struct blame_origin *find_origin(struct commit *parent,
628
630
* We have an origin -- find the path that corresponds to it in its
629
631
* parent and return an origin structure to represent it.
630
632
*/
631
- static struct blame_origin * find_rename (struct commit * parent ,
632
- struct blame_origin * origin )
633
+ static struct blame_origin * find_rename (struct repository * r ,
634
+ struct commit * parent ,
635
+ struct blame_origin * origin )
633
636
{
634
637
struct blame_origin * porigin = NULL ;
635
638
struct diff_options diff_opts ;
636
639
int i ;
637
640
638
- diff_setup ( & diff_opts );
641
+ repo_diff_setup ( r , & diff_opts );
639
642
diff_opts .flags .recursive = 1 ;
640
643
diff_opts .detect_rename = DIFF_DETECT_RENAME ;
641
644
diff_opts .output_format = DIFF_FORMAT_NO_OUTPUT ;
@@ -1259,7 +1262,7 @@ static void find_copy_in_parent(struct blame_scoreboard *sb,
1259
1262
if (!unblamed )
1260
1263
return ; /* nothing remains for this target */
1261
1264
1262
- diff_setup ( & diff_opts );
1265
+ repo_diff_setup ( sb -> repo , & diff_opts );
1263
1266
diff_opts .flags .recursive = 1 ;
1264
1267
diff_opts .output_format = DIFF_FORMAT_NO_OUTPUT ;
1265
1268
@@ -1441,7 +1444,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
1441
1444
* common cases, then we look for renames in the second pass.
1442
1445
*/
1443
1446
for (pass = 0 ; pass < 2 - sb -> no_whole_file_rename ; pass ++ ) {
1444
- struct blame_origin * (* find )(struct commit * , struct blame_origin * );
1447
+ struct blame_origin * (* find )(struct repository * , struct commit * , struct blame_origin * );
1445
1448
find = pass ? find_rename : find_origin ;
1446
1449
1447
1450
for (i = 0 , sg = first_scapegoat (revs , commit , sb -> reverse );
@@ -1454,7 +1457,7 @@ static void pass_blame(struct blame_scoreboard *sb, struct blame_origin *origin,
1454
1457
continue ;
1455
1458
if (parse_commit (p ))
1456
1459
continue ;
1457
- porigin = find (p , origin );
1460
+ porigin = find (sb -> repo , p , origin );
1458
1461
if (!porigin )
1459
1462
continue ;
1460
1463
if (oideq (& porigin -> blob_oid , & origin -> blob_oid )) {
@@ -1857,7 +1860,7 @@ void setup_scoreboard(struct blame_scoreboard *sb,
1857
1860
die (_ ("no such path %s in %s" ), path , final_commit_name );
1858
1861
1859
1862
if (sb -> revs -> diffopt .flags .allow_textconv &&
1860
- textconv_object (path , o -> mode , & o -> blob_oid , 1 , (char * * ) & sb -> final_buf ,
1863
+ textconv_object (sb -> repo , path , o -> mode , & o -> blob_oid , 1 , (char * * ) & sb -> final_buf ,
1861
1864
& sb -> final_buf_size ))
1862
1865
;
1863
1866
else
0 commit comments