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

recommendations for log enhancement

From
牛牛旭 <niuxu16@nudt.edu.cn>
Date
Jan 28, 2018, 15:46 UTC
Message-ID
<63a7d2b3.8dd7.1613d72ec2f.Coremail.niuxu16@nudt.edu.cn>
In-Reply-To
<950adae.6741.160c458ce64.Coremail.niuxu16@nudt.edu.cn>
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:
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. 
Previous: Jeff KingNext: Stefan Beller
Message 3 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.