1228
const char *refname, unsigned int flags,
1229
const struct object_id *new_oid,
1230
const struct object_id *old_oid,
1231
+ const char *new_target, const char *old_target,
1232
const char *msg)
1233
{
1234
struct ref_update *update;
1236
if (transaction->state != REF_TRANSACTION_OPEN)
1237
BUG("update called for transaction that is not open");
1238
1239
+ if (old_oid && old_target)
1240
+ BUG("only one of old_oid and old_target should be non NULL");
1241
+ if (new_oid && new_target)
1242
+ BUG("only one of new_oid and new_target should be non NULL");
1243
+
1244
FLEX_ALLOC_STR(update, refname, refname);
1245
ALLOC_GROW(transaction->updates, transaction->nr + 1, transaction->alloc);
1246
transaction->updates[transaction->nr++] = update;
1259
const char *refname,
1260
const struct object_id *new_oid,
1261
const struct object_id *old_oid,
1262
+ const char *new_target,
1263
+ const char *old_target,
1264
unsigned int flags, const char *msg,
1265
struct strbuf *err)
1266
{
1288
flags |= (new_oid ? REF_HAVE_NEW : 0) | (old_oid ? REF_HAVE_OLD : 0);
1289
1290
ref_transaction_add_update(transaction, refname, flags,
1283
- new_oid, old_oid, msg);
1291
+ new_oid, old_oid, new_target,
1292
+ old_target, msg);
1293
return 0;
1294
}
1295
1304
return 1;
1305
}
1306
return ref_transaction_update(transaction, refname, new_oid,
1298
- null_oid(), flags, msg, err);
1307
+ null_oid(), NULL, NULL, flags,
1308
+ msg, err);
1309
}
1310
1311
int ref_transaction_delete(struct ref_transaction *transaction,
1318
BUG("delete called with old_oid set to zeros");
1319
return ref_transaction_update(transaction, refname,
1320
null_oid(), old_oid,
1311
- flags, msg, err);
1321
+ NULL, NULL, flags,
1322
+ msg, err);
1323
}
1324
1325
int ref_transaction_verify(struct ref_transaction *transaction,
1332
BUG("verify called with old_oid set to NULL");
1333
return ref_transaction_update(transaction, refname,
1334
NULL, old_oid,
1335
+ NULL, NULL,
1336
flags, NULL, err);
1337
}
1338
1347
1348
t = ref_store_transaction_begin(refs, &err);
1349
if (!t ||
1338
- ref_transaction_update(t, refname, new_oid, old_oid, flags, msg,
1339
- &err) ||
1350
+ ref_transaction_update(t, refname, new_oid, old_oid, NULL, NULL,
1351
+ flags, msg, &err) ||
1352
ref_transaction_commit(t, &err)) {
1353
ret = 1;
1354
ref_transaction_free(t);