From: Junio C Hamano Date: Wed, 11 Jul 2012 19:46:31 +0000 (-0700) Subject: Merge branch 'hv/submodule-update-nuke-submodules' into maint X-Git-Tag: v1.7.11.2~6 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/a101eb41fb3319e5f0e2e12206cf2d87aab72f0f?ds=inline;hp=-c Merge branch 'hv/submodule-update-nuke-submodules' into maint "git add" allows adding a regular file to the path where a submodule used to exist, but "git update-index" did not allow an equivalent operation to Porcelain writers. * hv/submodule-update-nuke-submodules: update-index: allow overwriting existing submodule index entries --- a101eb41fb3319e5f0e2e12206cf2d87aab72f0f diff --combined builtin/update-index.c index 5f038d64da,9ffa62a1a0..5a4e9ea55a --- a/builtin/update-index.c +++ b/builtin/update-index.c @@@ -211,12 -211,6 +211,6 @@@ static int process_path(const char *pat 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); } @@@ -708,7 -702,6 +702,7 @@@ int cmd_update_index(int argc, const ch int newfd, entries, has_errors = 0, line_termination = '\n'; int read_from_stdin = 0; int prefix_length = prefix ? strlen(prefix) : 0; + int preferred_index_format = 0; char set_executable_bit = 0; struct refresh_params refresh_args = {0, &has_errors}; int lock_error = 0; @@@ -792,8 -785,6 +786,8 @@@ "(for porcelains) forget saved unresolved conflicts", PARSE_OPT_NOARG | PARSE_OPT_NONEG, resolve_undo_clear_callback}, + OPT_INTEGER(0, "index-version", &preferred_index_format, + "write index in this format"), OPT_END() }; @@@ -854,17 -845,6 +848,17 @@@ } } argc = parse_options_end(&ctx); + if (preferred_index_format) { + if (preferred_index_format < INDEX_FORMAT_LB || + INDEX_FORMAT_UB < preferred_index_format) + die("index-version %d not in range: %d..%d", + preferred_index_format, + INDEX_FORMAT_LB, INDEX_FORMAT_UB); + + if (the_index.version != preferred_index_format) + active_cache_changed = 1; + the_index.version = preferred_index_format; + } if (read_from_stdin) { struct strbuf buf = STRBUF_INIT, nbuf = STRBUF_INIT;