]> git.ipfire.org Git - thirdparty/git.git/commitdiff
delete_refs(): add a flags argument
authorMichael Haggerty <mhagger@alum.mit.edu>
Sat, 18 Jun 2016 04:15:10 +0000 (06:15 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Jun 2016 18:38:18 +0000 (11:38 -0700)
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>
builtin/fetch.c
builtin/remote.c
refs.h
refs/files-backend.c

index f8455bde7a84e110da182d56f62ac3f89026f55c..b55c83c46891651abc569999e5e6463d158b907c 100644 (file)
@@ -806,7 +806,7 @@ static int prune_refs(struct refspec *refs, int ref_count, struct ref *ref_map,
                for (ref = stale_refs; ref; ref = ref->next)
                        string_list_append(&refnames, ref->name);
 
-               result = delete_refs(&refnames);
+               result = delete_refs(&refnames, 0);
                string_list_clear(&refnames, 0);
        }
 
index fda5c2e53d28ae84f4876ca77ac9fefebee9ada2..1bbf9b44df2cc644539c6e52d33254223035822f 100644 (file)
@@ -788,7 +788,7 @@ static int rm(int argc, const char **argv)
        strbuf_release(&buf);
 
        if (!result)
-               result = delete_refs(&branches);
+               result = delete_refs(&branches, 0);
        string_list_clear(&branches, 0);
 
        if (skipped.nr) {
@@ -1303,7 +1303,7 @@ static int prune_remote(const char *remote, int dry_run)
        string_list_sort(&refs_to_prune);
 
        if (!dry_run)
-               result |= delete_refs(&refs_to_prune);
+               result |= delete_refs(&refs_to_prune, 0);
 
        for_each_string_list_item(item, &states.stale) {
                const char *refname = item->util;
diff --git a/refs.h b/refs.h
index 21874f023b158fcc39cf9f4eb53e178fa05d9aef..6d515a4671e85ad24842dd84d648cef492de9e81 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -274,9 +274,10 @@ int delete_ref(const char *refname, const unsigned char *old_sha1,
 /*
  * Delete the specified references. If there are any problems, emit
  * errors but attempt to keep going (i.e., the deletes are not done in
- * an all-or-nothing transaction).
+ * an all-or-nothing transaction). flags is passed through to
+ * ref_transaction_delete().
  */
-int delete_refs(struct string_list *refnames);
+int delete_refs(struct string_list *refnames, unsigned int flags);
 
 /** Delete a reflog */
 int delete_reflog(const char *refname);
index d5c47896195815f7b64688bf8e61a8d8a274e6ca..e15f7ae68bc005dd08eedbc628e1d79bab6e7944 100644 (file)
@@ -2403,7 +2403,7 @@ static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
        return 0;
 }
 
-int delete_refs(struct string_list *refnames)
+int delete_refs(struct string_list *refnames, unsigned int flags)
 {
        struct strbuf err = STRBUF_INIT;
        int i, result = 0;
@@ -2432,7 +2432,7 @@ int delete_refs(struct string_list *refnames)
        for (i = 0; i < refnames->nr; i++) {
                const char *refname = refnames->items[i].string;
 
-               if (delete_ref(refname, NULL, 0))
+               if (delete_ref(refname, NULL, flags))
                        result |= error(_("could not remove reference %s"), refname);
        }