-                       const char *src_w_slash = add_slash(src);
-                       int len_w_slash = length + 1;
-                       int first, last;
-
-                       modes[i] = WORKING_DIRECTORY;
-
-                       first = cache_name_pos(src_w_slash, len_w_slash);
-                       if (first >= 0)
-                               die (_("Huh? %.*s is in index?"),
-                                               len_w_slash, src_w_slash);
-
-                       first = -1 - first;
-                       for (last = first; last < active_nr; last++) {
-                               const char *path = active_cache[last]->name;
-                               if (strncmp(path, src_w_slash, len_w_slash))
-                                       break;
-                       }
-                       free((char *)src_w_slash);
-
-                       if (last - first < 1)
-                               bad = _("source directory is empty");
-                       else {
-                               int j, dst_len;
-
-                               if (last - first > 0) {
-                                       source = xrealloc(source,
-                                                       (argc + last - first)
-                                                       * sizeof(char *));
-                                       destination = xrealloc(destination,
-                                                       (argc + last - first)
-                                                       * sizeof(char *));
-                                       modes = xrealloc(modes,
-                                                       (argc + last - first)
-                                                       * sizeof(enum update_mode));
+                       int first = cache_name_pos(src, length);
+                       if (first >= 0) {
+                               if (!S_ISGITLINK(active_cache[first]->ce_mode))
+                                       die (_("Huh? Directory %s is in index and no submodule?"), src);
+                       } else {
+                               const char *src_w_slash = add_slash(src);
+                               int last, len_w_slash = length + 1;
+
+                               modes[i] = WORKING_DIRECTORY;
+
+                               first = cache_name_pos(src_w_slash, len_w_slash);
+                               if (first >= 0)
+                                       die (_("Huh? %.*s is in index?"),
+                                                       len_w_slash, src_w_slash);
+
+                               first = -1 - first;
+                               for (last = first; last < active_nr; last++) {
+                                       const char *path = active_cache[last]->name;
+                                       if (strncmp(path, src_w_slash, len_w_slash))
+                                               break;