builtin / am.con commit builtin-am: implement skeletal builtin am (73c2779)
   1/*
   2 * Builtin "git am"
   3 *
   4 * Based on git-am.sh by Junio C Hamano.
   5 */
   6#include "cache.h"
   7#include "builtin.h"
   8#include "exec_cmd.h"
   9
  10int cmd_am(int argc, const char **argv, const char *prefix)
  11{
  12
  13        /*
  14         * NEEDSWORK: Once all the features of git-am.sh have been
  15         * re-implemented in builtin/am.c, this preamble can be removed.
  16         */
  17        if (!getenv("_GIT_USE_BUILTIN_AM")) {
  18                const char *path = mkpath("%s/git-am", git_exec_path());
  19
  20                if (sane_execvp(path, (char **)argv) < 0)
  21                        die_errno("could not exec %s", path);
  22        } else {
  23                prefix = setup_git_directory();
  24                trace_repo_setup(prefix);
  25                setup_work_tree();
  26        }
  27
  28        return 0;
  29}