git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2 1/2] promisor-remote: remove a return value

From
JTJonathan Tan <jonathantanmy@google.com>
Date
Oct 4, 2022, 21:13 UTC
Message-ID
<207332c2dff047866a298ba7f72f043a009702f3.1664917853.git.jonathantanmy@google.com>
In-Reply-To
<cover.1664917853.git.jonathantanmy@google.com>

No caller of promisor_remote_get_direct() is checking its return value, so remove it.

Not checking the return value means that the user would not know whether the failure of reading an object is due to the promisor remote not supplying the object or because of local repository corruption, but this will be fixed in a subsequent patch.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 promisor-remote.c | 12 ++++--------
 promisor-remote.h | 11 +++++------
 2 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/promisor-remote.c b/promisor-remote.c
index 68f46f5ec7..8b4d650b4c 100644
--- a/promisor-remote.c
+++ b/promisor-remote.c
@@ -230,18 +230,17 @@ static int remove_fetched_oids(struct repository *repo,
 	return remaining_nr;
 }
 
-int promisor_remote_get_direct(struct repository *repo,
-			       const struct object_id *oids,
-			       int oid_nr)
+void promisor_remote_get_direct(struct repository *repo,
+				const struct object_id *oids,
+				int oid_nr)
 {
 	struct promisor_remote *r;
 	struct object_id *remaining_oids = (struct object_id *)oids;
 	int remaining_nr = oid_nr;
 	int to_free = 0;
-	int res = -1;
 
 	if (oid_nr == 0)
-		return 0;
+		return;
 
 	promisor_remote_init(repo);
 
@@ -256,12 +255,9 @@ int promisor_remote_get_direct(struct repository *repo,
 				continue;
 			}
 		}
-		res = 0;
 		break;
 	}
 
 	if (to_free)
 		free(remaining_oids);
-
-	return res;
 }
diff --git a/promisor-remote.h b/promisor-remote.h
index edc45ab0f5..df36eb08ef 100644
--- a/promisor-remote.h
+++ b/promisor-remote.h
@@ -39,13 +39,12 @@ static inline int has_promisor_remote(void)
 
 /*
  * Fetches all requested objects from all promisor remotes, trying them one at
- * a time until all objects are fetched. Returns 0 upon success, and non-zero
- * otherwise.
+ * a time until all objects are fetched.
  *
- * If oid_nr is 0, this function returns 0 (success) immediately.
+ * If oid_nr is 0, this function returns immediately.
  */
-int promisor_remote_get_direct(struct repository *repo,
-			       const struct object_id *oids,
-			       int oid_nr);
+void promisor_remote_get_direct(struct repository *repo,
+				const struct object_id *oids,
+				int oid_nr);
 
 #endif /* PROMISOR_REMOTE_H */
-- 
2.38.0.rc1.362.ged0d419d3c-goog
Previous: Jonathan TanNext: Jonathan Tan
Message 13 of 15 in “Fail early when partial clone prefetch fails”
  1. 0/2 Fail early when partial clone prefetch failsJonathan Tan, Sep 27, 2022
  2. 1/2 promisor-remote: remove a return valueJonathan Tan, Sep 27, 2022
  3. Junio C HamanoSep 29, 2022
  4. Jonathan TanSep 30, 2022
  5. 2/2 promisor-remote: die upon failing fetchJonathan Tan, Sep 27, 2022
  6. Glen ChooSep 28, 2022
  7. Jonathan TanSep 30, 2022
  8. Junio C HamanoSep 29, 2022
  9. Junio C HamanoSep 29, 2022
  10. Jonathan TanSep 30, 2022
  11. Junio C HamanoSep 30, 2022
  12. 0/2 Fail early when partial clone prefetch failsJonathan Tan, Oct 4, 2022
  13. 1/2 promisor-remote: remove a return valueJonathan Tan, Oct 4, 2022
  14. 2/2 promisor-remote: die upon failing fetchJonathan Tan, Oct 4, 2022
  15. Junio C HamanoOct 5, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.