@@ -116,35 +116,38 @@ static void verify_working_tree_path(struct repository *r,
116
116
die ("no such path '%s' in HEAD" , path );
117
117
}
118
118
119
- static struct commit_list * * append_parent (struct commit_list * * tail , const struct object_id * oid )
119
+ static struct commit_list * * append_parent (struct repository * r ,
120
+ struct commit_list * * tail ,
121
+ const struct object_id * oid )
120
122
{
121
123
struct commit * parent ;
122
124
123
- parent = lookup_commit_reference (the_repository , oid );
125
+ parent = lookup_commit_reference (r , oid );
124
126
if (!parent )
125
127
die ("no such commit %s" , oid_to_hex (oid ));
126
128
return & commit_list_insert (parent , tail )-> next ;
127
129
}
128
130
129
- static void append_merge_parents (struct commit_list * * tail )
131
+ static void append_merge_parents (struct repository * r ,
132
+ struct commit_list * * tail )
130
133
{
131
134
int merge_head ;
132
135
struct strbuf line = STRBUF_INIT ;
133
136
134
- merge_head = open (git_path_merge_head (the_repository ), O_RDONLY );
137
+ merge_head = open (git_path_merge_head (r ), O_RDONLY );
135
138
if (merge_head < 0 ) {
136
139
if (errno == ENOENT )
137
140
return ;
138
141
die ("cannot open '%s' for reading" ,
139
- git_path_merge_head (the_repository ));
142
+ git_path_merge_head (r ));
140
143
}
141
144
142
145
while (!strbuf_getwholeline_fd (& line , merge_head , '\n' )) {
143
146
struct object_id oid ;
144
147
if (line .len < GIT_SHA1_HEXSZ || get_oid_hex (line .buf , & oid ))
145
148
die ("unknown line in '%s': %s" ,
146
- git_path_merge_head (the_repository ), line .buf );
147
- tail = append_parent (tail , & oid );
149
+ git_path_merge_head (r ), line .buf );
150
+ tail = append_parent (r , tail , & oid );
148
151
}
149
152
close (merge_head );
150
153
strbuf_release (& line );
@@ -155,11 +158,13 @@ static void append_merge_parents(struct commit_list **tail)
155
158
* want to transfer ownership of the buffer to the commit (so we
156
159
* must use detach).
157
160
*/
158
- static void set_commit_buffer_from_strbuf (struct commit * c , struct strbuf * sb )
161
+ static void set_commit_buffer_from_strbuf (struct repository * r ,
162
+ struct commit * c ,
163
+ struct strbuf * sb )
159
164
{
160
165
size_t len ;
161
166
void * buf = strbuf_detach (sb , & len );
162
- set_commit_buffer (the_repository , c , buf , len );
167
+ set_commit_buffer (r , c , buf , len );
163
168
}
164
169
165
170
/*
@@ -185,16 +190,16 @@ static struct commit *fake_working_tree_commit(struct repository *r,
185
190
186
191
read_index (r -> index );
187
192
time (& now );
188
- commit = alloc_commit_node (the_repository );
193
+ commit = alloc_commit_node (r );
189
194
commit -> object .parsed = 1 ;
190
195
commit -> date = now ;
191
196
parent_tail = & commit -> parents ;
192
197
193
198
if (!resolve_ref_unsafe ("HEAD" , RESOLVE_REF_READING , & head_oid , NULL ))
194
199
die ("no such ref: HEAD" );
195
200
196
- parent_tail = append_parent (parent_tail , & head_oid );
197
- append_merge_parents (parent_tail );
201
+ parent_tail = append_parent (r , parent_tail , & head_oid );
202
+ append_merge_parents (r , parent_tail );
198
203
verify_working_tree_path (r , commit , path );
199
204
200
205
origin = make_origin (commit , path );
@@ -211,7 +216,7 @@ static struct commit *fake_working_tree_commit(struct repository *r,
211
216
ident , ident , path ,
212
217
(!contents_from ? path :
213
218
(!strcmp (contents_from , "-" ) ? "standard input" : contents_from )));
214
- set_commit_buffer_from_strbuf (commit , & msg );
219
+ set_commit_buffer_from_strbuf (r , commit , & msg );
215
220
216
221
if (!contents_from || strcmp ("-" , contents_from )) {
217
222
struct stat st ;
@@ -1678,7 +1683,7 @@ static struct commit *find_single_final(struct rev_info *revs,
1678
1683
struct object * obj = revs -> pending .objects [i ].item ;
1679
1684
if (obj -> flags & UNINTERESTING )
1680
1685
continue ;
1681
- obj = deref_tag (the_repository , obj , NULL , 0 );
1686
+ obj = deref_tag (revs -> repo , obj , NULL , 0 );
1682
1687
if (obj -> type != OBJ_COMMIT )
1683
1688
die ("Non commit %s?" , revs -> pending .objects [i ].name );
1684
1689
if (found )
@@ -1709,14 +1714,14 @@ static struct commit *dwim_reverse_initial(struct rev_info *revs,
1709
1714
1710
1715
/* Is that sole rev a committish? */
1711
1716
obj = revs -> pending .objects [0 ].item ;
1712
- obj = deref_tag (the_repository , obj , NULL , 0 );
1717
+ obj = deref_tag (revs -> repo , obj , NULL , 0 );
1713
1718
if (obj -> type != OBJ_COMMIT )
1714
1719
return NULL ;
1715
1720
1716
1721
/* Do we have HEAD? */
1717
1722
if (!resolve_ref_unsafe ("HEAD" , RESOLVE_REF_READING , & head_oid , NULL ))
1718
1723
return NULL ;
1719
- head_commit = lookup_commit_reference_gently (the_repository ,
1724
+ head_commit = lookup_commit_reference_gently (revs -> repo ,
1720
1725
& head_oid , 1 );
1721
1726
if (!head_commit )
1722
1727
return NULL ;
@@ -1745,7 +1750,7 @@ static struct commit *find_single_initial(struct rev_info *revs,
1745
1750
struct object * obj = revs -> pending .objects [i ].item ;
1746
1751
if (!(obj -> flags & UNINTERESTING ))
1747
1752
continue ;
1748
- obj = deref_tag (the_repository , obj , NULL , 0 );
1753
+ obj = deref_tag (revs -> repo , obj , NULL , 0 );
1749
1754
if (obj -> type != OBJ_COMMIT )
1750
1755
die ("Non commit %s?" , revs -> pending .objects [i ].name );
1751
1756
if (found )
0 commit comments