git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git submodule add requires remote
@ 2011-04-13  6:20 martin f krafft
  0 siblings, 0 replies; only message in thread
From: martin f krafft @ 2011-04-13  6:20 UTC (permalink / raw)
  To: git discussion list; +Cc: Lars Hjemli

[-- Attachment #1: Type: text/plain, Size: 2082 bytes --]

Dear gitsters, dear Lars,

while testing some workflows with submodules, we ran into the
problem that adding a submodule seems to require a remote "origin"
to be defined, even though that is not really necessary:

  ### subproj setup:

  % GIT_DIR=subproj.git git --bare init
  Initialized empty Git repository in /tmp/madduck/cdt.ciwkf2/subproj.git/
  % mkdir subproj && cd subproj
  % git init && git remote add origin ../subproj.git
  Initialized empty Git repository in /tmp/madduck/cdt.ciwkf2/subproj/.git/
  % touch a && git add a && git commit -minitial && git push origin master
  [master (root-commit) 7f6f6e9] initial
  0 files changed, 0 insertions(+), 0 deletions(-)
  create mode 100644 a
  Counting objects: 3, done.
  Writing objects: 100% (3/3), 201 bytes, done.
  Total 3 (delta 0), reused 0 (delta 0)
  Unpacking objects: 100% (3/3), done.
  To ../subproj.git
  * [new branch]      master -> master

  ### test project setup:

  % mkdir ../proj && cd ../proj
  % git init
  Initialized empty Git repository in /tmp/madduck/cdt.ciwkf2/proj/.git/
  % touch a && git add a && git commit -minitial
  [master (root-commit) aa15bae] initial
  0 files changed, 0 insertions(+), 0 deletions(-)
  create mode 100644 a

  ### adding submodule:

  % git submodule add ../subproj.git
  remote (origin) does not have a url defined in .git/config

The requirements stems from the resolve_relative_url() function in
git-submodule, which assumes that a relative submodule URL is
relative to the superproject's default remote URL. This might make
sense for './' URLs, but not really for '../'. Plus, it breaks the
normal assumption that Git accepts relative (filesystem) paths as
URLs (works for git-clone etc.).

Before I work out a patch for this, I would be curious to hear your
thoughts.

Thanks,

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
fighting for peace is like screwing for virginity.
                                     -- the irish times, washington dc
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current) --]
[-- Type: application/pgp-signature, Size: 1124 bytes --]

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

only message in thread, other threads:[~2011-04-13  6:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-13  6:20 git submodule add requires remote martin f krafft

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).