Subject: Re: [PATCH/WIP v2 03/19] am: implement skeletal builtin am

From: Junio C Hamano <[email-masked]>
Date: Sun, 14 Jun 2015 15:08:10 -0700

Paul Tan <[email-masked]> writes:

> +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)

> +			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 },