delete_refs(): add a flags argument
This will be useful for passing REF_NODEREF through. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty committed
Jun 18, 2016 at 06:15 UTC
c5f04dddb6cf5f76adfe145de3565411711255b8
4 files changed
+8
-7
builtin/fetch.c
+1
-1
@@ -806,7 +806,7 @@ static int prune_refs(struct refspec *refs, int ref_count, struct ref *ref_map,
806
for (ref = stale_refs; ref; ref = ref->next)
807
string_list_append(&refnames, ref->name);
808
809
- result = delete_refs(&refnames);
809
+ result = delete_refs(&refnames, 0);
810
string_list_clear(&refnames, 0);
811
}
812
builtin/remote.c
+2
-2
@@ -788,7 +788,7 @@ static int rm(int argc, const char **argv)
788
strbuf_release(&buf);
789
790
if (!result)
791
- result = delete_refs(&branches);
791
+ result = delete_refs(&branches, 0);
792
string_list_clear(&branches, 0);
793
794
if (skipped.nr) {
@@ -1303,7 +1303,7 @@ static int prune_remote(const char *remote, int dry_run)
1303
string_list_sort(&refs_to_prune);
1304
1305
if (!dry_run)
1306
- result |= delete_refs(&refs_to_prune);
1306
+ result |= delete_refs(&refs_to_prune, 0);
1307
1308
for_each_string_list_item(item, &states.stale) {
1309
const char *refname = item->util;
refs.h
+3
-2
@@ -274,9 +274,10 @@ int delete_ref(const char *refname, const unsigned char *old_sha1,
274
/*
275
* Delete the specified references. If there are any problems, emit
276
* errors but attempt to keep going (i.e., the deletes are not done in
277
- * an all-or-nothing transaction).
277
+ * an all-or-nothing transaction). flags is passed through to
278
+ * ref_transaction_delete().
279
*/
279
-int delete_refs(struct string_list *refnames);
280
+int delete_refs(struct string_list *refnames, unsigned int flags);
281
282
/** Delete a reflog */
283
int delete_reflog(const char *refname);
refs/files-backend.c
+2
-2
@@ -2403,7 +2403,7 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
2403
return 0;
2404
}
2405
2406
-int delete_refs(struct string_list *refnames)
2406
+int delete_refs(struct string_list *refnames, unsigned int flags)
2407
{
2408
struct strbuf err = STRBUF_INIT;
2409
int i, result = 0;
@@ -2432,7 +2432,7 @@ int delete_refs(struct string_list *refnames)
2432
for (i = 0; i < refnames->nr; i++) {
2433
const char *refname = refnames->items[i].string;
2434
2435
- if (delete_ref(refname, NULL, 0))
2435
+ if (delete_ref(refname, NULL, flags))
2436
result |= error(_("could not remove reference %s"), refname);
2437
}
2438