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

Re: recommendations for log enhancement

From
Stefan Beller <sbeller@google.com>
Date
Jan 30, 2018, 22:11 UTC
Message-ID
<CAGZ79kbYgTVw0LH6w14Ho_g0yy7XBLhoZO_vP71GHYf4JdmfYA@mail.gmail.com>
In-Reply-To
<63a7d2b3.8dd7.1613d72ec2f.Coremail.niuxu16@nudt.edu.cn>
On Sun, Jan 28, 2018 at 7:46 AM, 牛旭 <niuxu16@nudt.edu.cn> wrote:
> Our team studies the consistent edits of git during evolution. And we find several missed edits in the latest release of git. For example, there are two consist edits we have figured out from historical commits:

Thanks for studying the code of Git. It will help the project in bettering the code. Welcome to the Git community! Which version do you mean by "latest release" ?

Show 40 quoted lines
> 1) . Version: git 2.3.9 – git-2.3.10
>        File: builtin/merge-tree.c
>
>         dst.size = size;
> -       xdi_diff(&src, &dst, &xpp, &xecfg, &ecb);
> +       if (xdi_diff(&src, &dst, &xpp, &xecfg, &ecb))
> +               die("unable to generate diff");
>         free(src.ptr);
>         free(dst.ptr);
>  }
>
> 2) .Version: git 2.3.9 – git-2.3.10
>       File: combine-diff.c
>
> -       xdi_diff_outf(&parent_file, result_file, consume_line, &state,
> -                     &xpp, &xecfg);
> +       if (xdi_diff_outf(&parent_file, result_file, consume_line, &state,
> +                         &xpp, &xecfg))
> +               die("unable to generate combined diff for %s",
> +                   sha1_to_hex(parent));
>         free(parent_file.ptr);
>
> Those two commits both add if structure and log messages for handling the return value of xdi_diff_outf().
> And in the latest release, we find one candidate that may also need log statements inserted:
> 1)  File: git-2.14.2/builtin/rerere.c
>
>      1  static int diff_two(const char *file1, const char *label1,
>      2                  const char *file2, const char *label2)
>      3  {
> ….
>     20          ret = xdi_diff(&minus, &plus, &xpp, &xecfg, &ecb);
>     21
>     22          free(minus.ptr);
>     23          free(plus.ptr);
>     24          return ret;
>     25  }
> ...
> }
>
> There are more examples of consistent update and corresponding suggestions in attachment. It is so nice of you to read them and share me with your opinion on the correctness of our suggestion. Thanks a lot.
Thanks a lot for this suggestion and the suggestions in the attachment.

However these are less than optimal to consume for the project. Care to make these changes as actual commits in your local repository and then send patches?

See Documentation/SubmittingPatches https://github.com/git/git/blob/master/Documentation/SubmittingPatches

Thanks, Stefan

Previous: 牛旭
Message 4 of 4 in “Patch recommendation for replace invoke of error() to that of error_errno()”
  1. 牛旭Jan 5, 2018
  2. Jeff KingJan 5, 2018
  3. recommendations for log enhancement牛旭, Jan 28, 2018
  4. Stefan BellerJan 30, 2018

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.