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

[PATCH 2/3, v2] http-push: do not get confused by submodules

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 14, 2008, 23:32 UTC
Message-ID
<alpine.LSU.1.00.0802142331100.30505@racer.site>
In-Reply-To
<alpine.LSU.1.00.0802142325400.30505@racer.site>

When encountering submodules in a tree, http-push should not try sending the respective object. Instead, it should ignore it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	I just remembered that Linus did something similar, but more 
	elegant, in 481f0ee60eef2c34b891e5d04b7e6e5a955eedf4.  This
	patch imitates that commit.
 http-push.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/http-push.c b/http-push.c
index 7a6c669..4d200bc 100644
--- a/http-push.c
+++ b/http-push.c
@@ -1634,12 +1634,19 @@ static struct object_list **process_tree(struct tree *tree,
 
 	init_tree_desc(&desc, tree->buffer, tree->size);
 
-	while (tree_entry(&desc, &entry)) {
-		if (S_ISDIR(entry.mode))
+	while (tree_entry(&desc, &entry))
+		switch (object_type(entry.mode)) {
+		case OBJ_TREE:
 			p = process_tree(lookup_tree(entry.sha1), p, &me, name);
-		else
+			break;
+		case OBJ_BLOB:
 			p = process_blob(lookup_blob(entry.sha1), p, &me, name);
-	}
+			break;
+		default:
+			/* Subproject commit - not in this repository */
+			break;
+		}
+
 	free(tree->buffer);
 	tree->buffer = NULL;
 	return p;
-- 
1.5.4.1.1353.g0d5dd
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 7 of 8 in “http-push fixes”
  1. 0/3 http-push fixesJohannes Schindelin, Feb 14, 2008
  2. 1/3 http-push: avoid invalid memory accessesJohannes Schindelin, Feb 14, 2008
  3. Junio C HamanoFeb 16, 2008
  4. Mike HommeyFeb 16, 2008
  5. Johannes SchindelinFeb 16, 2008
  6. 2/3 http-push: do not get confused by submodulesJohannes Schindelin, Feb 14, 2008
  7. 2/3 http-push: do not get confused by submodulesJohannes Schindelin, Feb 14, 2008
  8. 3/3 http-push: avoid a needless gotoJohannes Schindelin, Feb 14, 2008

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.