summaryrefslogtreecommitdiff
path: root/builtin/add.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2019-05-09 00:37:23 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2019-05-09 00:37:23 +0900
commit4ab701b2eec46ab5cbfe8c9732897e5d100184d8 (patch)
tree9e2001084537775407d1e4376ec9a0f5791d32d6 /builtin/add.c
parentMerge branch 'dl/warn-tagging-a-tag' (diff)
parentadd: error appropriately on repository with no commits (diff)
downloadtgif-4ab701b2eec46ab5cbfe8c9732897e5d100184d8.tar.xz
Merge branch 'km/empty-repo-is-still-a-repo'
Running "git add" on a repository created inside the current repository is an explicit indication that the user wants to add it as a submodule, but when the HEAD of the inner repository is on an unborn branch, it cannot be added as a submodule. Worse, the files in its working tree can be added as if they are a part of the outer repository, which is not what the user wants. These problems are being addressed. * km/empty-repo-is-still-a-repo: add: error appropriately on repository with no commits dir: do not traverse repositories with no commits submodule: refuse to add repository with no commits
Diffstat (limited to 'builtin/add.c')
-rw-r--r--builtin/add.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/add.c b/builtin/add.c
index db2dfa4350..dd18e5c9b6 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -374,11 +374,12 @@ static int add_files(struct dir_struct *dir, int flags)
}
for (i = 0; i < dir->nr; i++) {
- check_embedded_repo(dir->entries[i]->name);
if (add_file_to_index(&the_index, dir->entries[i]->name, flags)) {
if (!ignore_add_errors)
die(_("adding files failed"));
exit_status = 1;
+ } else {
+ check_embedded_repo(dir->entries[i]->name);
}
}
return exit_status;