{"thread":{"id":"54678","subject":"git add fails silently when adding files in subfolders which contain their own repositories","startedAt":"2020-11-19T16:35:43Z","lastAt":"2020-11-19T16:35:43Z","messageCount":1,"participants":["Tom Piercy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"410371","messageId":"CAAMZeNMAwKcpwLaCL-6rgN5EQh65GcqfOaw32qXB+PU6BwDEhQ@mail.gmail.com","threadId":"54678","inReplyTo":null,"subject":"git add fails silently when adding files in subfolders which contain their own repositories","fromName":"Tom Piercy","fromEmail":"personalnadir@gmail.com","sentAt":"2020-11-19T16:35:26Z","receivedAt":"2020-11-19T16:35:43Z","isPatch":false,"sender":{"key":"personalnadir@gmail.com","avatar":null},"body":"Thank you for filling out a Git bug report\nPlease answer the following questions to help us understand your issue.\n\nWhat did you do before the bug happened? (Steps to reproduce your issue)\n\n1. Create a new repository in a new folder:\n    a. mkdir gittest\n    b. cd gittest\n    c. git init\n2. Create a subfolder and a new repository inside the subfolder (all\ninside the gittest directory)\n    a. mkdir dir\n    b. cd dir\n    c. git init\n3. Create a file in the subdirectory and try to add it to the first\nrepository (starting inside gittest/dir)\n    a. touch file\n    b. cd ..\n    c. git add dir/file\n4. Observe status of file\n    git status\n\nWhat did you expect to happen? (Expected behavior)\n    The files to be added to the main repository or an error message\n\nWhat happened instead? (Actual behavior)\n    git add dir/file runs and completes. However the file is not\nstaged. There is no output.\n\n    Running the command git add dir/ (where dir is a folder containing\nthe second git repository) produces the warning:\n\n        error: 'dir/' does not have a commit checked out\n        fatal: adding files failed\n\n    If the repository in the subfolder has at least 1 commit the\nfollowing warning will be printed:\n        warning: adding embedded git repository: dir\n        hint: You've added another git repository inside your current\nrepository.\n        hint: Clones of the outer repository will not contain the contents of\n        hint: the embedded repository and will not know how to obtain it.\n        hint: If you meant to add a submodule, use:\n        hint:\n        hint: git submodule add <url> dir\n        hint:\n        hint: If you added this path by mistake, you can remove it from the\n        hint: index with:\n        hint:\n        hint: git rm --cached dir\n        hint:\n        hint: See \"git help submodule\" for more information.\n\n    After the warning git status displays:\n    gittest % git status\n        On branch master\n\n        No commits yet\n\n        Changes to be committed:\n          (use \"git rm --cached <file>...\" to unstage)\n        new file: dir\n\n        Changes not staged for commit:\n          (use \"git add <file>...\" to update what will be committed)\n          (use \"git restore <file>...\" to discard changes in working directory)\n          (commit or discard the untracked or modified content in submodules)\n        modified: dir (untracked content)\n\n    Deleting the .git folder in the subdirectory allows the git add\ncommand to complete correctly\n\nWhat's different between what you expected and what actually happened?\n    The files are not added and there is no explanation why they are not.\n\nAnything else you want to add:\n    Deleting the .git folder in the subdirectory allows the git add\ncommand to complete correctly\n\nPlease review the rest of the bug report below.\nYou can delete any lines you don't wish to share.\n\n[System Info]\ngit version:\ngit version 2.29.2\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45\nPDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64\ncompiler info: clang: 12.0.0 (clang-1200.0.32.27)\nlibc info: no libc information available\n$SHELL (typically, interactive shell): /bin/zsh\n\n[Enabled Hooks]\npost-commit\npost-checkout\npost-merge\npre-push\n"}]}