Merge branch 'jl/interrupt-clone-remove-separate-git-dir' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2013 15:33:48 +0000 (07:33 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 14 Jan 2013 15:33:49 +0000 (07:33 -0800)
When "git clone --separate-git-dir=$over_there" is interrupted, it
failed to remove the real location of the $GIT_DIR it created. This
was most visible when interrupting a submodule update.

* jl/interrupt-clone-remove-separate-git-dir:
clone: support atomic operation with --separate-git-dir

1  2 
builtin/clone.c
diff --cc builtin/clone.c
index ec2f75b4f3b9d9acfb8aa6b423f3b0fc7fbbafdf,b054313ab659605b5902e68bdb6ff364c3333e5e..8d23a62e8a1b875f1415f78a4c283f4cdefac011
@@@ -768,20 -468,18 +768,22 @@@ int cmd_clone(int argc, const char **ar
        setenv(CONFIG_ENVIRONMENT, mkpath("%s/config", git_dir), 1);
  
        if (safe_create_leading_directories_const(git_dir) < 0)
 -              die("could not create leading directories of '%s'", git_dir);
 +              die(_("could not create leading directories of '%s'"), git_dir);
  
        set_git_dir_init(git_dir, real_git_dir, 0);
-       if (real_git_dir)
+       if (real_git_dir) {
                git_dir = real_git_dir;
+               junk_git_dir = real_git_dir;
+       }
  
 -      if (0 <= option_verbosity)
 -              printf("Cloning into %s%s...\n",
 -                     option_bare ? "bare repository " : "", dir);
 +      if (0 <= option_verbosity) {
 +              if (option_bare)
 +                      printf(_("Cloning into bare repository '%s'...\n"), dir);
 +              else
 +                      printf(_("Cloning into '%s'...\n"), dir);
 +      }
        init_db(option_template, INIT_DB_QUIET);
 +      write_config(&option_config);
  
        /*
         * At this point, the config exists, so we do not need the