]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'sb/submodule-helper-clone-regression-fix'
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Apr 2016 22:45:03 +0000 (15:45 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 22 Apr 2016 22:45:04 +0000 (15:45 -0700)
A partial rewrite of "git submodule" in the 2.7 timeframe changed
the way the gitdir: pointer in the submodules point at the real
repository location to use absolute paths by accident.  This has
been corrected.

* sb/submodule-helper-clone-regression-fix:
  submodule--helper, module_clone: catch fprintf failure
  submodule--helper: do not borrow absolute_path() result for too long
  submodule--helper, module_clone: always operate on absolute paths
  submodule--helper clone: create the submodule path just once
  submodule--helper: fix potential NULL-dereference
  recursive submodules: test for relative paths

1  2 
builtin/submodule--helper.c
t/t7400-submodule-basic.sh

index d36e8a0ec43af81a9c55d772dc99b54de7f7a58d,b3a60f56c345fce8dabc31826769ff879fbde931..3bd6883eff842ee139a3d24475401d75f65fe53e
@@@ -237,12 -194,18 +237,19 @@@ static int module_clone(int argc, cons
        argc = parse_options(argc, argv, prefix, module_clone_options,
                             git_submodule_helper_usage, 0);
  
-       if (argc || !url || !path)
 -      if (!path || !*path)
 -              die(_("submodule--helper: unspecified or empty --path"));
++      if (argc || !url || !path || !*path)
 +              usage_with_options(git_submodule_helper_usage,
 +                                 module_clone_options);
  
        strbuf_addf(&sb, "%s/modules/%s", get_git_dir(), name);
-       sm_gitdir = strbuf_detach(&sb, NULL);
+       sm_gitdir = xstrdup(absolute_path(sb.buf));
+       strbuf_reset(&sb);
+       if (!is_absolute_path(path)) {
+               strbuf_addf(&sb, "%s/%s", get_git_work_tree(), path);
+               path = strbuf_detach(&sb, NULL);
+       } else
+               path = xstrdup(path);
  
        if (!file_exists(sm_gitdir)) {
                if (safe_create_leading_directories_const(sm_gitdir) < 0)
Simple merge