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

[PATCH] update-index: allow overwriting existing submodule index entries

From
Heiko Voigt <hvoigt@hvoigt.net>
Date
Jun 9, 2012, 14:27 UTC
Message-ID
<20120609142658.GB16268@book.hvoigt.net>
In-Reply-To
<CAOkDyE9q1n=oLoEXXxurDjNM0B2+cZ9eoeGE57F9hEQUjK0hZg@mail.gmail.com>

In commit e01105 Linus introduced gitlinks to update-index. He explains that he thinks it is not the right thing to replace a gitlink with something else.

That commit is from the very first beginnings of submodule support. Since then we have gotten a lot closer to being able to remove a submodule without losing its history. This check prevents such a use case, so I think this assumption has changed.

Additionally in the git add codepath we do not have such a check, so for consistency reasons I think removing this check is the correct thing to do.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
---
Hi,
On Fri, Jun 01, 2012 at 11:31:26AM +0100, Adam Spiers wrote:
Show 14 quoted lines
> Now if I press Control-T to try to stage 'two' into the index, I get a new
> dialog which says:
> 
>     Updating the Git index failed. A rescan will be automatically
>     started to resynchronize git-gui.
> 
>     error: two is already a gitlink, not replacing
>     fatal: Unable to process path two
> 
> 
>                               [Unlock Index] [Continue]
> 
> I can work around via 'git add two', but it would be nice if citool
> handled this correctly.

This is because git gui uses plumbing (update-index) for updating the index.

This patch fixes that popup. Testsuite passes here.
Is it ok this way?
Cheers Heiko
 builtin/update-index.c | 6 ------
 1 file changed, 6 deletions(-)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 5f038d6..5a4e9ea 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -211,12 +211,6 @@ static int process_path(const char *path)
 	if (S_ISDIR(st.st_mode))
 		return process_directory(path, len, &st);
 
-	/*
-	 * Process a regular file
-	 */
-	if (ce && S_ISGITLINK(ce->ce_mode))
-		return error("%s is already a gitlink, not replacing", path);
-
 	return add_one_path(ce, path, len, &st);
 }
 
-- 
1.7.10.2.522.g93b45fe
Previous: Heiko VoigtNext: Junio C Hamano
Message 3 of 7 in “Bug in git citool when staging symlink as replacement for submodule”
  1. Adam SpiersJun 1, 2012
  2. git-gui: recognize submodule diff when replaced by fileHeiko Voigt, Jun 9, 2012
  3. update-index: allow overwriting existing submodule index entriesHeiko Voigt, Jun 9, 2012
  4. Junio C HamanoJun 11, 2012
  5. Jens LehmannJun 11, 2012
  6. Heiko VoigtJun 12, 2012
  7. Jens LehmannJun 12, 2012

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.