Re: [PATCH 8/9] Use the early config machinery to expand aliases
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 10, 2017, 01:33 UTC
- Message-ID
- <xmqqa85g62yx.fsf@gitster.mtv.corp.google.com>
- In-Reply-To
- <3b916e1f5055486795c784d55704b4720598f1a9.1496851544.git.johannes.schindelin@gmx.de>
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
Show 37 quoted lines
> -static char *orig_env[4];
> -static int save_restore_env_balance;
> -
> -static void save_env_before_alias(void)
> -{
> -...
> -}
> -
> -static void restore_env(int external_alias)
> -{
> -...
> -}
>
> static void commit_pager_choice(void) {
> switch (use_pager) {
> @@ -245,36 +201,37 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
>
> static int handle_alias(int *argcp, const char ***argv)
> {
> + struct strbuf worktree_dir = STRBUF_INIT;
> int envchanged = 0, ret = 0, saved_errno = errno;
> int count, option_count;
> const char **new_argv;
> const char *alias_command;
> char *alias_string;
> - int unused_nongit;
> -
> - save_env_before_alias();
> - setup_git_directory_gently(&unused_nongit);
> ...
> @@ -308,8 +265,6 @@ static int handle_alias(int *argcp, const char ***argv)
> ret = 1;
> }
>
> - restore_env(0);
> -
> errno = saved_errno;The save/restore sequence was an unnecessary hassle, and being able to do this without chdir'ing around is really nice.
Thanks for working on this.