diff options
| author | Junio C Hamano <gitster@pobox.com> | 2020-03-17 15:02:21 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2020-03-17 15:02:21 -0700 |
| commit | 93d08928910200969c486328e576057aada6f9dc (patch) | |
| tree | eaac061bd7e2883b175c8ce878599b761966d3e6 | |
| parent | dae477777e5d38780dabb0ebabbfd32fc89c10f6 (diff) | |
| parent | 7edee32985b1363e35e91c7358a9e60f2359fbba (diff) | |
| download | git-93d08928910200969c486328e576057aada6f9dc.tar.xz | |
Merge branch 'dt/submodule-rm-with-stale-cache' into maint
Running "git rm" on a submodule failed unnecessarily when
.gitmodules is only cache-dirty, which has been corrected.
* dt/submodule-rm-with-stale-cache:
git rm submodule: succeed if .gitmodules index stat info is zero
| -rw-r--r-- | submodule.c | 2 | ||||
| -rwxr-xr-x | t/t3600-rm.sh | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/submodule.c b/submodule.c index 1385b594fd..9f4c4c08d1 100644 --- a/submodule.c +++ b/submodule.c @@ -82,7 +82,7 @@ int is_staging_gitmodules_ok(struct index_state *istate) if ((pos >= 0) && (pos < istate->cache_nr)) { struct stat st; if (lstat(GITMODULES_FILE, &st) == 0 && - ie_match_stat(istate, istate->cache[pos], &st, 0) & DATA_CHANGED) + ie_modified(istate, istate->cache[pos], &st, 0) & DATA_CHANGED) return 0; } diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh index 0ea858d652..f2c0168941 100755 --- a/t/t3600-rm.sh +++ b/t/t3600-rm.sh @@ -425,6 +425,13 @@ test_expect_success 'rm will error out on a modified .gitmodules file unless sta git status -s -uno >actual && test_cmp expect actual ' +test_expect_success 'rm will not error out on .gitmodules file with zero stat data' ' + git reset --hard && + git submodule update && + git read-tree HEAD && + git rm submod && + test_path_is_missing submod +' test_expect_success 'rm issues a warning when section is not found in .gitmodules' ' git reset --hard && |
