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

--function-context shows wrong function in chunk

From
Zach Riggle <zachriggle@gmail.com>
Date
Jul 10, 2020, 18:38 UTC
Message-ID
<CAMP9c5k5kLSqhCh9400iLdZ=+-nKonavOYpBSs_NHdaVVJ_ycQ@mail.gmail.com>

When using --function-context, the function that is claimed at the top of the diff does not match the actual function.

Note that the change exists in main, but the hunk header (terminology?) shows other_routine.

$ git --version git version 2.27.0

$ git diff -b --function-context
diff --git i/example.c w/example.c
index d87b59b..346e2a7 100644
--- i/example.c
+++ w/example.c
@@ -4,5 +4,5 @@ int other_routine() {
 }

 int main() {
-
+    puts("Hello, world!");
 }

Zach Riggle
Next: Junio C Hamano
Message 1 of 4 in “--function-context shows wrong function in chunk”
  1. Zach RiggleJul 10, 2020
  2. Junio C HamanoJul 10, 2020
  3. Zach RiggleJul 10, 2020
  4. Junio C HamanoJul 10, 2020

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.