git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Bug Report: git add

From
Ramkumar Ramachandra <artagnon@gmail.com>
Date
Apr 6, 2011, 05:52 UTC
Message-ID
<20110406055200.GA12547@kytes>
In-Reply-To
<4D9BA35E.6040204@dcook.org>
Hi Darren,
Darren Cook writes:
> (Apologies if there is a proper place to report bugs; but I could not
> find one.)

There is no bugtracker, so this is the right place to report it. Thanks for reporting.

Show 9 quoted lines
> PROBLEM: "git add" adds sub-directories without checking to see if there
> is already a git repository already there.
> 
> WHY BAD: This causes files to be in two repositories (leading to a mess
> if you don't notice for a while...)
> 
> ONE SOLUTION: When adding files from a directory (except root of the
> repository, of course) look for a .git subdirectory, and complain if
> found. Allow --force to override this.

This is a good suggestion. It already has a way to handle gitlinks (for submodules), so this seems like a very reasonable feature.

> MORE SOPHISTICATED:
>  1. Offer to merge in all that history, followed by removing that old
> .git subdirectory.

Hm, I don't like this one -- there are too many ways to "merge" the history, and I can't see a sane default (or even a sane subset of defaults).

>  2. Look inside the .git subdirectory to see if the file being added is
> actually under control there. If not, no need to complain.

I don't like this one either. Tangling up two Git repositories like this is not a good idea -- the user should use submodules or similar.

Next steps: Me (or someone else who has the time) will post a patch fixing this shortly.

-- Ram
Previous: Darren CookNext: Jakub Narebski
Message 2 of 13 in “Bug Report: git add”
  1. Darren CookApr 5, 2011
  2. Ramkumar RamachandraApr 6, 2011
  3. Jakub NarebskiApr 10, 2011
  4. Ramkumar RamachandraApr 10, 2011
  5. Junio C HamanoApr 11, 2011
  6. Jeff KingApr 11, 2011
  7. Jeff KingApr 7, 2011
  8. Junio C HamanoApr 7, 2011
  9. Jeff KingApr 7, 2011
  10. Jeff KingApr 7, 2011
  11. Junio C HamanoApr 7, 2011
  12. Jeff KingApr 8, 2011
  13. Jeff KingApr 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.