@@ -12,8 +12,6 @@ static const char * const git_update_ref_usage[] = {
12
12
NULL
13
13
};
14
14
15
- static struct ref_transaction * transaction ;
16
-
17
15
static char line_termination = '\n' ;
18
16
static int update_flags ;
19
17
@@ -176,7 +174,8 @@ static int parse_next_sha1(struct strbuf *input, const char **next,
176
174
* depending on how line_termination is set.
177
175
*/
178
176
179
- static const char * parse_cmd_update (struct strbuf * input , const char * next )
177
+ static const char * parse_cmd_update (struct ref_transaction * transaction ,
178
+ struct strbuf * input , const char * next )
180
179
{
181
180
struct strbuf err = STRBUF_INIT ;
182
181
char * refname ;
@@ -209,7 +208,8 @@ static const char *parse_cmd_update(struct strbuf *input, const char *next)
209
208
return next ;
210
209
}
211
210
212
- static const char * parse_cmd_create (struct strbuf * input , const char * next )
211
+ static const char * parse_cmd_create (struct ref_transaction * transaction ,
212
+ struct strbuf * input , const char * next )
213
213
{
214
214
struct strbuf err = STRBUF_INIT ;
215
215
char * refname ;
@@ -239,7 +239,8 @@ static const char *parse_cmd_create(struct strbuf *input, const char *next)
239
239
return next ;
240
240
}
241
241
242
- static const char * parse_cmd_delete (struct strbuf * input , const char * next )
242
+ static const char * parse_cmd_delete (struct ref_transaction * transaction ,
243
+ struct strbuf * input , const char * next )
243
244
{
244
245
struct strbuf err = STRBUF_INIT ;
245
246
char * refname ;
@@ -273,7 +274,8 @@ static const char *parse_cmd_delete(struct strbuf *input, const char *next)
273
274
return next ;
274
275
}
275
276
276
- static const char * parse_cmd_verify (struct strbuf * input , const char * next )
277
+ static const char * parse_cmd_verify (struct ref_transaction * transaction ,
278
+ struct strbuf * input , const char * next )
277
279
{
278
280
struct strbuf err = STRBUF_INIT ;
279
281
char * refname ;
@@ -317,7 +319,7 @@ static const char *parse_cmd_option(struct strbuf *input, const char *next)
317
319
return next + 8 ;
318
320
}
319
321
320
- static void update_refs_stdin (void )
322
+ static void update_refs_stdin (struct ref_transaction * transaction )
321
323
{
322
324
struct strbuf input = STRBUF_INIT ;
323
325
const char * next ;
@@ -332,13 +334,13 @@ static void update_refs_stdin(void)
332
334
else if (isspace (* next ))
333
335
die ("whitespace before command: %s" , next );
334
336
else if (starts_with (next , "update " ))
335
- next = parse_cmd_update (& input , next + 7 );
337
+ next = parse_cmd_update (transaction , & input , next + 7 );
336
338
else if (starts_with (next , "create " ))
337
- next = parse_cmd_create (& input , next + 7 );
339
+ next = parse_cmd_create (transaction , & input , next + 7 );
338
340
else if (starts_with (next , "delete " ))
339
- next = parse_cmd_delete (& input , next + 7 );
341
+ next = parse_cmd_delete (transaction , & input , next + 7 );
340
342
else if (starts_with (next , "verify " ))
341
- next = parse_cmd_verify (& input , next + 7 );
343
+ next = parse_cmd_verify (transaction , & input , next + 7 );
342
344
else if (starts_with (next , "option " ))
343
345
next = parse_cmd_option (& input , next + 7 );
344
346
else
@@ -373,6 +375,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
373
375
374
376
if (read_stdin ) {
375
377
struct strbuf err = STRBUF_INIT ;
378
+ struct ref_transaction * transaction ;
376
379
377
380
transaction = ref_transaction_begin (& err );
378
381
if (!transaction )
@@ -381,7 +384,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)
381
384
usage_with_options (git_update_ref_usage , options );
382
385
if (end_null )
383
386
line_termination = '\0' ;
384
- update_refs_stdin ();
387
+ update_refs_stdin (transaction );
385
388
if (ref_transaction_commit (transaction , msg , & err ))
386
389
die ("%s" , err .buf );
387
390
ref_transaction_free (transaction );
0 commit comments