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

[PATCH] allow git-update-index work on subprojects

From
Alex Riesen <raa.lkml@gmail.com>
Date
Apr 10, 2007, 13:39 UTC
Message-ID
<81b0412b0704100639y331864f9ne0306aa4bf8de663@mail.gmail.com>
On 4/10/07, Linus Torvalds <torvalds@linux-foundation.org> wrote:
Show 26 quoted lines
>
>
> On Mon, 9 Apr 2007, Linus Torvalds wrote:
> >
> > NOTE! This series of six patches does not actually contain everything you
> > need to do that - in particular, this series will not actually connect up
> > the magic to make "git add" (and thus "git commit") actually create the
> > gitlink entries for subprojects. That's another (quite small) patch, but I
> > haven't cleaned it up enough to be submittable yet.
>
> Here is, for your enjoyment, the last patch I used to actually test this
> all. I do *not* submit it as a patch for actual inclusion - the other
> patches in the series are, I think, ready to actually be merged. This one
> is not.
>
> It's broken for a few reasons:
>
>  - it allows you to do "git add subproject" to add the subproject to the
>    index (and then use "git commit" to commit it), but even something as
>    simple as "git commit -a" doesn't work right, because the sequence that
>    "git commit -a" uses to update the index doesn't work with the current
>    state of the plumbing (ie the
>
>         git-diff-files --name-only -z |
>                 git-update-index --remove -z --stdin
>
At least git-update-index should work.
---
 builtin-update-index.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/builtin-update-index.c b/builtin-update-index.c
index 47d42ed..55c9f93 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -94,12 +94,10 @@ static int process_file(const char *path)
 				             path);
 			}
 		}
-		if (0 == status)
-			return error("%s: is a directory - add files inside instead",
-			             path);
-		else
+		if (status)
 			return error("lstat(\"%s\"): %s", path,
 				     strerror(errno));
+		/* could be a subproject */
 	}

 	namelen = strlen(path);
@@ -211,7 +209,7 @@ static void update_one(const char *path, const
char *prefix, int prefix_length)
 		goto free_return;
 	}
 	if (process_file(p))
-		die("Unable to process file %s", path);
+		die("Unable to process \"%s\"", path);
 	report("add '%s'", path);
  free_return:
 	if (p < path || p > path + strlen(path))
-- 
1.5.1.147.gbaa5


From 252adc55f9a8a7ee36be1abf76d8511d6f12d4f3 Mon Sep 17 00:00:00 2001
From: Alex Riesen <ariesen@harmanbecker.com>
Date: Tue, 10 Apr 2007 15:19:30 +0200
Subject: [PATCH] allow git-update-index work on subprojects

---
 builtin-update-index.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/builtin-update-index.c b/builtin-update-index.c
index 47d42ed..55c9f93 100644
--- a/builtin-update-index.c
+++ b/builtin-update-index.c
@@ -94,12 +94,10 @@ static int process_file(const char *path)
 				             path);
 			}
 		}
-		if (0 == status)
-			return error("%s: is a directory - add files inside instead",
-			             path);
-		else
+		if (status)
 			return error("lstat(\"%s\"): %s", path,
 				     strerror(errno));
+		/* could be a subproject */
 	}
 
 	namelen = strlen(path);
@@ -211,7 +209,7 @@ static void update_one(const char *path, const char *prefix, int prefix_length)
 		goto free_return;
 	}
 	if (process_file(p))
-		die("Unable to process file %s", path);
+		die("Unable to process \"%s\"", path);
 	report("add '%s'", path);
  free_return:
 	if (p < path || p > path + strlen(path))
-- 
1.5.1.147.gbaa5
Next: Alex Riesen
Message 1 of 3 in “allow git-update-index work on subprojects”
  1. allow git-update-index work on subprojectsAlex Riesen, Apr 10, 2007
  2. Allow git-update-index work on subprojectsAlex Riesen, Apr 10, 2007
  3. Junio C HamanoApr 11, 2007

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.