git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] TIG: Fix to reinstate proper operation with no arguments

From
DNDrew Northup <n1xim.email@gmail.com>
Date
Jul 18, 2013, 13:30 UTC
Message-ID
<51E7EDE3.4080205@gmail.com>
In-Reply-To
<1374123113-3889-1-git-send-email-n1xim.email@gmail.com>

Somehow this patch breaks the main view to not open the correct commit in diff view when <enter> is pressed. Back to the debugger...

On 07/18/2013 12:51 AM, Drew Northup wrote:
Show 59 quoted lines
> Since c7d67ab running "tig" with no options has failed with the
> error "tig: No revisions match the given arguments." This was due
> to a change in how the arguments for the back-end git call was
> being constructed. This change caused the blank field left in
> place of "(encoding_arg)" when it is empty to not overwrite
> "buf" which then caused the value in "buf" to be copied into
> dst_argv twice. The resulting git command failed if there was no
> available revision named "log" as shown in the trace.
>
>  From the TIG_TRACE log:
> git log log --no-color --pretty=raw --parents --parents --
> fatal: bad revision 'log'
>
> This fix works by teaching tig that when it is supplied with a
> blank field in the source argument buffer that it should skip
> over that field and continue instead of copying the previous
> field value into the destination buffer a second time.
>
> github issue # 167
>
> Signed-off-by: Drew Northup<n1xim.email@gmail.com>
> ---
>
> This should apply cleanly to the tig public master whether the
> mkstemps() patch I wrote has been applied or not.
>
>   tig.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/tig.c b/tig.c
> index ba9ba98..1016cfe 100644
> --- a/tig.c
> +++ b/tig.c
> @@ -3105,10 +3105,11 @@ static bool
>   format_append_arg(struct format_context *format, const char ***dst_argv, const char *arg)
>   {
>   	format->bufpos = 0;
> +	int len = 0;
>
>   	while (arg) {
>   		char *next = strstr(arg, "%(");
> -		int len = next ? next - arg : strlen(arg);
> +		len = next ? next - arg : strlen(arg);
>
>   		if (len&&  !string_format_from(format->buf,&format->bufpos, "%.*s", len, arg))
>   			return FALSE;
> @@ -3119,7 +3120,11 @@ format_append_arg(struct format_context *format, const char ***dst_argv, const c
>   		arg = next ? strchr(next, ')') + 1 : NULL;
>   	}
>
> -	return argv_append(dst_argv, format->buf);
> +	if(len){
> +		return argv_append(dst_argv, format->buf);
> +	} else {
> +		return TRUE;
> +	}
>   }
>
>   static bool
-- 
--
-Drew Northup
--------------------------------------------------------------
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Previous: Drew NorthupNext: Jonas Fonseca
Message 2 of 7 in “TIG: Fix to reinstate proper operation with no arguments”
  1. TIG: Fix to reinstate proper operation with no argumentsDrew Northup, Jul 18, 2013
  2. Drew NorthupJul 18, 2013
  3. Jonas FonsecaJul 19, 2013
  4. Drew NorthupJul 19, 2013
  5. Drew NorthupJul 24, 2013
  6. TIG: Fix to reinstate proper operation with no argumentsDrew Northup, Jul 24, 2013
  7. Jonas FonsecaJul 29, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.