зеркало из https://github.com/microsoft/git.git
Teach update-index about --ignore-submodules
Like with the diff machinery, update-index should sometimes just ignore submodules (e.g. to determine a clean state before a rebase). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
50fd9bd843
Коммит
5fdeacb0ca
|
@ -15,6 +15,7 @@ SYNOPSIS
|
||||||
[--cacheinfo <mode> <object> <file>]\*
|
[--cacheinfo <mode> <object> <file>]\*
|
||||||
[--chmod=(+|-)x]
|
[--chmod=(+|-)x]
|
||||||
[--assume-unchanged | --no-assume-unchanged]
|
[--assume-unchanged | --no-assume-unchanged]
|
||||||
|
[--ignore-submodules]
|
||||||
[--really-refresh] [--unresolve] [--again | -g]
|
[--really-refresh] [--unresolve] [--again | -g]
|
||||||
[--info-only] [--index-info]
|
[--info-only] [--index-info]
|
||||||
[-z] [--stdin]
|
[-z] [--stdin]
|
||||||
|
@ -54,6 +55,10 @@ OPTIONS
|
||||||
default behavior is to error out. This option makes
|
default behavior is to error out. This option makes
|
||||||
git-update-index continue anyway.
|
git-update-index continue anyway.
|
||||||
|
|
||||||
|
--ignore-submodules:
|
||||||
|
Do not try to update submodules. This option is only respected
|
||||||
|
when passed before --refresh.
|
||||||
|
|
||||||
--unmerged::
|
--unmerged::
|
||||||
If --refresh finds unmerged changes in the index, the default
|
If --refresh finds unmerged changes in the index, the default
|
||||||
behavior is to error out. This option makes git-update-index
|
behavior is to error out. This option makes git-update-index
|
||||||
|
|
|
@ -593,6 +593,10 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
|
||||||
refresh_flags |= REFRESH_QUIET;
|
refresh_flags |= REFRESH_QUIET;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (!strcmp(path, "--ignore-submodules")) {
|
||||||
|
refresh_flags |= REFRESH_IGNORE_SUBMODULES;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (!strcmp(path, "--add")) {
|
if (!strcmp(path, "--add")) {
|
||||||
allow_add = 1;
|
allow_add = 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
1
cache.h
1
cache.h
|
@ -388,6 +388,7 @@ extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st);
|
||||||
#define REFRESH_UNMERGED 0x0002 /* allow unmerged */
|
#define REFRESH_UNMERGED 0x0002 /* allow unmerged */
|
||||||
#define REFRESH_QUIET 0x0004 /* be quiet about it */
|
#define REFRESH_QUIET 0x0004 /* be quiet about it */
|
||||||
#define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */
|
#define REFRESH_IGNORE_MISSING 0x0008 /* ignore non-existent */
|
||||||
|
#define REFRESH_IGNORE_SUBMODULES 0x0008 /* ignore submodules */
|
||||||
extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
|
extern int refresh_index(struct index_state *, unsigned int flags, const char **pathspec, char *seen);
|
||||||
|
|
||||||
struct lock_file {
|
struct lock_file {
|
||||||
|
|
|
@ -942,6 +942,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
|
||||||
int allow_unmerged = (flags & REFRESH_UNMERGED) != 0;
|
int allow_unmerged = (flags & REFRESH_UNMERGED) != 0;
|
||||||
int quiet = (flags & REFRESH_QUIET) != 0;
|
int quiet = (flags & REFRESH_QUIET) != 0;
|
||||||
int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
|
int not_new = (flags & REFRESH_IGNORE_MISSING) != 0;
|
||||||
|
int ignore_submodules = (flags & REFRESH_IGNORE_SUBMODULES) != 0;
|
||||||
unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
|
unsigned int options = really ? CE_MATCH_IGNORE_VALID : 0;
|
||||||
|
|
||||||
for (i = 0; i < istate->cache_nr; i++) {
|
for (i = 0; i < istate->cache_nr; i++) {
|
||||||
|
@ -949,6 +950,9 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char **p
|
||||||
int cache_errno = 0;
|
int cache_errno = 0;
|
||||||
|
|
||||||
ce = istate->cache[i];
|
ce = istate->cache[i];
|
||||||
|
if (ignore_submodules && S_ISGITLINK(ce->ce_mode))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (ce_stage(ce)) {
|
if (ce_stage(ce)) {
|
||||||
while ((i < istate->cache_nr) &&
|
while ((i < istate->cache_nr) &&
|
||||||
! strcmp(istate->cache[i]->name, ce->name))
|
! strcmp(istate->cache[i]->name, ce->name))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче