update-index: allow overwriting existing submodule index entries
authorHeiko Voigt <hvoigt@hvoigt.net>
Sat, 9 Jun 2012 14:27:00 +0000 (16:27 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jun 2012 15:00:11 +0000 (08:00 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/update-index.c
index a6a23fa1f3c7782566d7fcfe470dd424b876e4a5..9ffa62a1a0b8abbfbf39aa267a7ab479adc84351 100644 (file)
@@ -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);
 }