git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug in Submodule add
@ 2012-09-26  4:18 Jonathan Johnson
  2012-09-26 20:56 ` Jens Lehmann
  0 siblings, 1 reply; 9+ messages in thread
From: Jonathan Johnson @ 2012-09-26  4:18 UTC (permalink / raw)
  To: git

I believe I have found an issue with the way `submodule add` detects a submodule that already exists in the repository. 

To reproduce

1) add a git submodule in a specific location (we'll say it's at `./submodule/location`)
2) go through the normal steps of removing a submodule, as listed here - https://git.wiki.kernel.org/index.php/GitSubmoduleTutorial
3) Now the submodule is completely removed and there is no reference to it in .gitmodules or .git/config
4) Re-add a different repository at the same location (`./submodule/location`)

Expected - The new submodule repository will be set up at ./submodule/location and have the new repository as its origin

What Actually Happens - The new submodule uses the existing `$gitdir` (old repository) as the actual backing repository to the submodule, but the new repository is reflected in .gitmodules and .git/config.

So to recap, the result is that `git remote show origin`  in the submodule shows a different origin than is in .gitmodules and .git/config

One simple step to remedy this would be to add the deletion of the backing repository from the .git/modules directory, but again, I think an actual command to take care of all of these steps is in order anyways.  Not sure you want to encourage people poking around in the .git directory.

If this is already resolved in the newest versions, please disregard

Thanks!

Jonathan Johnson

http://jondavidjohn.com | me@jondavidjohn.com

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

end of thread, other threads:[~2012-10-01  0:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-26  4:18 Bug in Submodule add Jonathan Johnson
2012-09-26 20:56 ` Jens Lehmann
2012-09-29 23:04   ` [PATCH 0/2] Let "git submodule add" fail when .git/modules/<name> already exists Jens Lehmann
2012-09-29 23:05     ` [PATCH 1/2] Teach "git submodule add" the --name option Jens Lehmann
2012-09-29 23:07     ` [PATCH 2/2] submodule add: Fail when .git/modules/<name> already exists Jens Lehmann
2012-09-30  4:47     ` [PATCH 0/2] Let "git submodule add" fail " Junio C Hamano
2012-09-30 19:19       ` Jens Lehmann
2012-09-30 21:01         ` [PATCH v2 2/2] submodule add: Fail when .git/modules/<name> already exists unless forced Jens Lehmann
2012-10-01  0:06           ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).