From: Tom Piercy <personalnadir@gmail.com> To: git@vger.kernel.org Subject: git add fails silently when adding files in subfolders which contain their own repositories Date: Thu, 19 Nov 2020 16:35:26 +0000 Message-ID: <CAAMZeNMAwKcpwLaCL-6rgN5EQh65GcqfOaw32qXB+PU6BwDEhQ@mail.gmail.com> (raw) Thank you for filling out a Git bug report Please answer the following questions to help us understand your issue. What did you do before the bug happened? (Steps to reproduce your issue) 1. Create a new repository in a new folder: a. mkdir gittest b. cd gittest c. git init 2. Create a subfolder and a new repository inside the subfolder (all inside the gittest directory) a. mkdir dir b. cd dir c. git init 3. Create a file in the subdirectory and try to add it to the first repository (starting inside gittest/dir) a. touch file b. cd .. c. git add dir/file 4. Observe status of file git status What did you expect to happen? (Expected behavior) The files to be added to the main repository or an error message What happened instead? (Actual behavior) git add dir/file runs and completes. However the file is not staged. There is no output. Running the command git add dir/ (where dir is a folder containing the second git repository) produces the warning: error: 'dir/' does not have a commit checked out fatal: adding files failed If the repository in the subfolder has at least 1 commit the following warning will be printed: warning: adding embedded git repository: dir hint: You've added another git repository inside your current repository. hint: Clones of the outer repository will not contain the contents of hint: the embedded repository and will not know how to obtain it. hint: If you meant to add a submodule, use: hint: hint: git submodule add <url> dir hint: hint: If you added this path by mistake, you can remove it from the hint: index with: hint: hint: git rm --cached dir hint: hint: See "git help submodule" for more information. After the warning git status displays: gittest % git status On branch master No commits yet Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: dir Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) (commit or discard the untracked or modified content in submodules) modified: dir (untracked content) Deleting the .git folder in the subdirectory allows the git add command to complete correctly What's different between what you expected and what actually happened? The files are not added and there is no explanation why they are not. Anything else you want to add: Deleting the .git folder in the subdirectory allows the git add command to complete correctly Please review the rest of the bug report below. You can delete any lines you don't wish to share. [System Info] git version: git version 2.29.2 cpu: x86_64 no commit associated with this build sizeof-long: 8 sizeof-size_t: 8 shell-path: /bin/sh uname: Darwin 19.6.0 Darwin Kernel Version 19.6.0: Thu Oct 29 22:56:45 PDT 2020; root:xnu-6153.141.2.2~1/RELEASE_X86_64 x86_64 compiler info: clang: 12.0.0 (clang-1200.0.32.27) libc info: no libc information available $SHELL (typically, interactive shell): /bin/zsh [Enabled Hooks] post-commit post-checkout post-merge pre-push
reply other threads:[~2020-11-19 16:39 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: http://vger.kernel.org/majordomo-info.html * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAAMZeNMAwKcpwLaCL-6rgN5EQh65GcqfOaw32qXB+PU6BwDEhQ@mail.gmail.com \ --to=personalnadir@gmail.com \ --cc=git@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
git@vger.kernel.org list mirror (unofficial, one of many) This inbox may be cloned and mirrored by anyone: git clone --mirror https://public-inbox.org/git git clone --mirror http://ou63pmih66umazou.onion/git git clone --mirror http://czquwvybam4bgbro.onion/git git clone --mirror http://hjrcffqmbrq6wope.onion/git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V1 git git/ https://public-inbox.org/git \ git@vger.kernel.org public-inbox-index git Example config snippet for mirrors. Newsgroups are available over NNTP: nntp://news.public-inbox.org/inbox.comp.version-control.git nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git nntp://news.gmane.io/gmane.comp.version-control.git note: .onion URLs require Tor: https://www.torproject.org/ code repositories for the project(s) associated with this inbox: https://80x24.org/mirrors/git.git AGPL code for this site: git clone https://public-inbox.org/public-inbox.git