Re: [PATCH/WIP v2 03/19] am: implement skeletal builtin am
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 14, 2015, 22:08 UTC
- Message-ID
- <xmqqzj42kkol.fsf@gitster.dls.corp.google.com>
- In-Reply-To
- <1434018125-31804-4-git-send-email-pyokagan@gmail.com>
Paul Tan <pyokagan@gmail.com> writes:
Show 6 quoted lines
> +int cmd_am(int argc, const char **argv, const char *prefix)
> +{
> + if (!getenv("_GIT_USE_BUILTIN_AM")) {
> + const char *path = mkpath("%s/git-am", git_exec_path());
> +
> + if (sane_execvp(path, (char**) argv) < 0)Style:
if (sane_execvp(path, (char**)argv) < 0)
Show 14 quoted lines
> + die_errno("could not exec %s", path);
> + }
> +
> + return 0;
> +}
> diff --git a/git.c b/git.c
> index 44374b1..42328ed 100644
> --- a/git.c
> +++ b/git.c
> @@ -370,6 +370,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
>
> static struct cmd_struct commands[] = {
> { "add", cmd_add, RUN_SETUP | NEED_WORK_TREE },
> + { "am", cmd_am, RUN_SETUP | NEED_WORK_TREE },Would this, especially having RUN_SETUP, keep the same behaviour when the command is run from a subdirectory of a working tree? e.g.
save messages to ./inbox
$ cd sub/dir
$ git am ../../inbox> { "annotate", cmd_annotate, RUN_SETUP },
> { "apply", cmd_apply, RUN_SETUP_GENTLY },
> { "archive", cmd_archive },