git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug Report: git add
@ 2011-04-05 23:18 Darren Cook
  2011-04-06  5:52 ` Ramkumar Ramachandra
  2011-04-07  0:57 ` Jeff King
  0 siblings, 2 replies; 13+ messages in thread
From: Darren Cook @ 2011-04-05 23:18 UTC (permalink / raw)
  To: git

(Apologies if there is a proper place to report bugs; but I could not
find one.)

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.

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

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


EXAMPLE OF PROBLEM

The problem can arise when people are just dipping their toe into git,
and decide to try it on just one directory, then later expand its use to
the whole project.

  mkdir test
  cd test

  mkdir settings
  cd settings
  git init
  touch x
  git add x
  git commit -m "xx"

  (time passes)

  cd ..
  git init
  git add settings/
   (should complain)



Thanks for taking the time to read this,

Darren




-- 
Darren Cook, Software Researcher/Developer

http://dcook.org/work/ (About me and my work)
http://dcook.org/blogs.html (My blogs and articles)

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2011-04-11 18:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-05 23:18 Bug Report: git add Darren Cook
2011-04-06  5:52 ` Ramkumar Ramachandra
2011-04-10  7:48   ` Jakub Narebski
2011-04-10  8:29     ` Ramkumar Ramachandra
2011-04-11 17:55     ` Junio C Hamano
2011-04-11 18:20       ` Jeff King
2011-04-07  0:57 ` Jeff King
2011-04-07  1:09   ` Junio C Hamano
2011-04-07  1:12     ` Jeff King
2011-04-07  1:48     ` Jeff King
2011-04-07  7:28       ` Junio C Hamano
2011-04-08 19:15         ` Jeff King
2011-04-08 19:46           ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).