Merge branch 'jk/clone-post-checkout'
authorJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:48:31 +0000 (13:48 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 11 Mar 2009 20:48:31 +0000 (13:48 -0700)
* jk/clone-post-checkout:
clone: run post-checkout hook when checking out

1  2 
builtin-clone.c
diff --combined builtin-clone.c
index 92826cd14c5df6b216b4f50bd80facd061b58ef9,a6d89bc625bb4bcab85b5a143e9f670c3012b98e..39523cee309f16268130427f8209f9a5be0cdc70
@@@ -20,6 -20,7 +20,7 @@@
  #include "dir.h"
  #include "pack-refs.h"
  #include "sigchain.h"
+ #include "run-command.h"
  
  /*
   * Overall FIXMEs:
@@@ -365,6 -366,8 +366,6 @@@ static void install_branch_config(cons
  
  int cmd_clone(int argc, const char **argv, const char *prefix)
  {
 -      int use_local_hardlinks = 1;
 -      int use_separate_remote = 1;
        int is_bundle = 0;
        struct stat buf;
        const char *repo_name, *repo, *work_tree, *git_dir;
        struct strbuf branch_top = STRBUF_INIT, reflog_msg = STRBUF_INIT;
        struct transport *transport = NULL;
        char *src_ref_prefix = "refs/heads/";
+       int err = 0;
  
        struct refspec refspec;
  
        if (argc == 0)
                die("You must specify a repository to clone.");
  
 -      if (option_no_hardlinks)
 -              use_local_hardlinks = 0;
 -
        if (option_mirror)
                option_bare = 1;
  
                        die("--bare and --origin %s options are incompatible.",
                            option_origin);
                option_no_checkout = 1;
 -              use_separate_remote = 0;
        }
  
        if (!option_origin)
                if (write_cache(fd, active_cache, active_nr) ||
                    commit_locked_index(lock_file))
                        die("unable to write new index file");
+               err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1),
+                               sha1_to_hex(remote_head->old_sha1), "1", NULL);
        }
  
        strbuf_release(&reflog_msg);
        strbuf_release(&key);
        strbuf_release(&value);
        junk_pid = 0;
-       return 0;
+       return err;
  }