Subject: Re: [PATCH v7 19/28] files-backend: replace submodule_allowed check in files_downcast()

From: Duy Nguyen <[email-masked]>
Date: Fri, 14 Apr 2017 20:02:51 +0700

On Fri, Apr 14, 2017 at 03:44:46AM -0700, Junio C Hamano wrote:
> Duy Nguyen <[email-masked]> writes:
> 
> > I'll mark this mail and do a follow-up patch once this topic graduates
> > to master. It's less review burden and mail traffic.
> 
> I actually do not mind a single replacement patch.

Thanks. Here's the fixup patch

-- 8< --
>From c572f11f9c653f6f18d51a56b31cc5d966f9b242 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?=
 <[email-masked]>
Date: Fri, 14 Apr 2017 19:54:31 +0700
Subject: [PATCH] fixup! files-backend: replace submodule_allowed check in
 files_downcast()

---
 refs.c               |  2 +-
 refs/files-backend.c | 10 ++++------
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/refs.c b/refs.c
index 241b4227b2..c7bffac06d 100644
--- a/refs.c
+++ b/refs.c
@@ -1486,7 +1486,7 @@ struct ref_store *get_ref_store(const char *submodule)
 		return NULL;
 	}
 
-	/* pretend that add_submodule_odb() has been called */
+	/* assume that add_submodule_odb() has been called */
 	refs = ref_store_init(submodule_sb.buf,
 			      REF_STORE_READ | REF_STORE_ODB);
 	register_submodule_ref_store(refs, submodule);
diff --git a/refs/files-backend.c b/refs/files-backend.c
index d97a924860..3faf5a0635 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1006,15 +1006,13 @@ static void files_assert_main_repository(struct files_ref_store *refs,
 	if (refs->store_flags & REF_STORE_MAIN)
 		return;
 
-	die("BUG: unallowed operation (%s), only works "
-	    "on main ref store\n", caller);
+	die("BUG: operation %s is only allowed for main ref store", caller);
 }
 
 /*
  * Downcast ref_store to files_ref_store. Die if ref_store is not a
- * files_ref_store. If submodule_allowed is not true, then also die if
- * files_ref_store is for a submodule (i.e., not for the main
- * repository). caller is used in any necessary error messages.
+ * files_ref_store. Die if the operation is not allowed on this particular
+ * store. "caller" is used in any necessary error messages.
  */
 static struct files_ref_store *files_downcast(struct ref_store *ref_store,
 					      unsigned int required_flags,
@@ -1029,7 +1027,7 @@ static struct files_ref_store *files_downcast(struct ref_store *ref_store,
 	refs = (struct files_ref_store *)ref_store;
 
 	if ((refs->store_flags & required_flags) != required_flags)
-		die("BUG: unallowed operation (%s), requires %x, has %x\n",
+		die("BUG: operation %s requires abilities 0x%x but have 0x%x",
 		    caller, required_flags, refs->store_flags);
 
 	return refs;
-- 
2.11.0.157.gd943d85

-- 8< --