list mirror (unofficial, one of many)
 help / color / mirror / Atom feed
* git add fails silently when adding files in subfolders which contain their own repositories
@ 2020-11-19 16:35 Tom Piercy
  0 siblings, 0 replies; only message in thread
From: Tom Piercy @ 2020-11-19 16:35 UTC (permalink / raw)
  To: git

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
        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: git submodule add <url> dir
        hint: If you added this path by mistake, you can remove it from the
        hint: index with:
        hint: git rm --cached dir
        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]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-19 16:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19 16:35 git add fails silently when adding files in subfolders which contain their own repositories Tom Piercy list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror
	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/ \
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
 note: .onion URLs require Tor:

code repositories for the project(s) associated with this inbox:

AGPL code for this site: git clone