cabeed4530d68625e086c79597465b27fd0d7a98
   1/*
   2 * Builtin "git pull"
   3 *
   4 * Based on git-pull.sh by Junio C Hamano
   5 *
   6 * Fetch one or more remote refs and merge it/them into the current HEAD.
   7 */
   8#include "cache.h"
   9#include "builtin.h"
  10#include "parse-options.h"
  11#include "exec_cmd.h"
  12
  13static const char * const pull_usage[] = {
  14        NULL
  15};
  16
  17static struct option pull_options[] = {
  18        OPT_END()
  19};
  20
  21int cmd_pull(int argc, const char **argv, const char *prefix)
  22{
  23        if (!getenv("_GIT_USE_BUILTIN_PULL")) {
  24                const char *path = mkpath("%s/git-pull", git_exec_path());
  25
  26                if (sane_execvp(path, (char **)argv) < 0)
  27                        die_errno("could not exec %s", path);
  28        }
  29
  30        argc = parse_options(argc, argv, prefix, pull_options, pull_usage, 0);
  31
  32        return 0;
  33}