All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Haggerty <mhagger@alum.mit.edu>
To: Junio C Hamano <gitster@pobox.com>,
	David Turner <dturner@twopensource.com>
Cc: "Jeff King" <peff@peff.net>,
	"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
	git@vger.kernel.org, "Michael Haggerty" <mhagger@alum.mit.edu>
Subject: [PATCH 04/13] delete_refs(): add a flags argument
Date: Mon, 30 May 2016 09:55:25 +0200	[thread overview]
Message-ID: <03e08d91d289ef24ea53344ce005eda0bb4a7a14.1464537050.git.mhagger@alum.mit.edu> (raw)
In-Reply-To: <cover.1464537050.git.mhagger@alum.mit.edu>

This will be useful for passing REF_NODEREF through.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 builtin/fetch.c      | 2 +-
 builtin/remote.c     | 4 ++--
 refs.h               | 5 +++--
 refs/files-backend.c | 4 ++--
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/builtin/fetch.c b/builtin/fetch.c
index f8455bd..b55c83c 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -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);
 	}
 
diff --git a/builtin/remote.c b/builtin/remote.c
index fda5c2e..1bbf9b4 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -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 21874f0..6d515a4 100644
--- 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);
diff --git a/refs/files-backend.c b/refs/files-backend.c
index 5af7441..a0d09f4 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -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);
 	}
 
-- 
2.8.1

  parent reply	other threads:[~2016-05-30  7:56 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  7:55 [PATCH 00/13] Reference iterators Michael Haggerty
2016-05-30  7:55 ` [PATCH 01/13] refs: remove unnecessary "extern" keywords Michael Haggerty
2016-05-30  7:55 ` [PATCH 02/13] do_for_each_ref(): move docstring to the header file Michael Haggerty
2016-05-30  7:55 ` [PATCH 03/13] refs: use name "prefix" consistently Michael Haggerty
2016-05-30  7:55 ` Michael Haggerty [this message]
2016-05-30  7:55 ` [PATCH 05/13] remote rm: handle symbolic refs correctly Michael Haggerty
2016-05-30  7:55 ` [PATCH 06/13] get_ref_cache(): only create an instance if there is a submodule Michael Haggerty
2016-05-30  7:55 ` [PATCH 07/13] entry_resolves_to_object(): rename function from ref_resolves_to_object() Michael Haggerty
2016-05-30  7:55 ` [PATCH 08/13] ref_resolves_to_object(): new function Michael Haggerty
2016-05-30  7:55 ` [PATCH 09/13] refs: introduce an iterator interface Michael Haggerty
2016-05-30 15:22   ` Ramsay Jones
2016-05-30 16:57     ` Ramsay Jones
2016-05-31  1:16       ` Michael Haggerty
2016-05-31  5:29   ` Eric Sunshine
2016-05-31  7:59     ` Michael Haggerty
2016-05-31 23:12       ` Eric Sunshine
2016-06-03 11:48         ` Michael Haggerty
2016-05-31  6:10   ` Junio C Hamano
2016-05-31  8:45     ` Michael Haggerty
2016-06-02 10:08   ` Duy Nguyen
2016-06-02 16:23     ` Michael Haggerty
2016-05-30  7:55 ` [PATCH 10/13] do_for_each_ref(): reimplement using reference iteration Michael Haggerty
2016-05-30  7:55 ` [PATCH 11/13] for_each_reflog(): don't abort for bad references Michael Haggerty
2016-05-30  7:55 ` [PATCH 12/13] dir_iterator: new API for iterating over a directory tree Michael Haggerty
2016-06-01  0:12   ` David Turner
2016-06-03 11:57     ` Michael Haggerty
2016-05-30  7:55 ` [PATCH 13/13] for_each_reflog(): reimplement using iterators Michael Haggerty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03e08d91d289ef24ea53344ce005eda0bb4a7a14.1464537050.git.mhagger@alum.mit.edu \
    --to=mhagger@alum.mit.edu \
    --cc=dturner@twopensource.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.