[PATCH 193/194] submodule: Reorder open_submodule function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In the next patch we'll need open_submodule in another function, so
move it up.

Signed-off-by: Stefan Beller <sbeller@xxxxxxxxxx>
---
 submodule.c | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/submodule.c b/submodule.c
index 022e366940..6b6c5a6710 100644
--- a/submodule.c
+++ b/submodule.c
@@ -481,6 +481,33 @@ void prepare_submodule_repo_env(struct argv_array *out)
 			 DEFAULT_GIT_DIR_ENVIRONMENT);
 }
 
+/*
+ * Initialize 'out' based on the provided submodule path.
+ *
+ * Unlike repo_submodule_init, this tolerates submodules not present
+ * in .gitmodules. NEEDSWORK: The repo_submodule_init behavior is
+ * preferrable. This function exists only to preserve historical behavior.
+ *
+ * Returns 0 on success, -1 when the submodule is not present.
+ */
+static int open_submodule(struct repository *out, const char *path)
+{
+	struct strbuf sb = STRBUF_INIT;
+
+	if (submodule_to_gitdir(&sb, path))
+		return -1;
+
+	if (repo_init(out, sb.buf, NULL)) {
+		strbuf_release(&sb);
+		return -1;
+	}
+
+	out->submodule_prefix = xstrdup(path);
+
+	strbuf_release(&sb);
+	return 0;
+}
+
 /* Helper function to display the submodule header line prior to the full
  * summary output. If it can locate the submodule objects directory it will
  * attempt to lookup both the left and right commits and put them into the
@@ -839,33 +866,6 @@ static int check_has_commit(const struct object_id *oid, void *data)
 	}
 }
 
-/*
- * Initialize 'out' based on the provided submodule path.
- *
- * Unlike repo_submodule_init, this tolerates submodules not present
- * in .gitmodules. NEEDSWORK: The repo_submodule_init behavior is
- * preferrable. This function exists only to preserve historical behavior.
- *
- * Returns 0 on success, -1 when the submodule is not present.
- */
-static int open_submodule(struct repository *out, const char *path)
-{
-	struct strbuf sb = STRBUF_INIT;
-
-	if (submodule_to_gitdir(&sb, path))
-		return -1;
-
-	if (repo_init(out, sb.buf, NULL)) {
-		strbuf_release(&sb);
-		return -1;
-	}
-
-	out->submodule_prefix = xstrdup(path);
-
-	strbuf_release(&sb);
-	return 0;
-}
-
 static int submodule_has_commits(const char *path, struct oid_array *commits)
 {
 	struct repository sub;
-- 
2.15.1.433.g936d1b9894.dirty




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux