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

git diff annoyance / feature request

From
Boaz Harrosh <bharrosh@panasas.com>
Date
Aug 25, 2011, 19:14 UTC
Message-ID
<4E569F10.8060808@panasas.com>

git diff has this very annoying miss-fixture where it will state as hunk header the closest label instead of the function name.

So I get:
@@ -675,9 +670,23 @@ try_again:
 	}
 
 	if (flag) {
-		foo();
+		bazz();
 	}
 
 
Instead of what I'd like:
@@ -563,12 +563,7 @@ static int write_exec(struct page_collect *pcol)
 	}
 
 	if (flag) {
-		foo();
+		bazz();
 	}
 

I mean. The label "try_again" is not at all unique in my file. As a
reader I would like to see where is that code going to. The function
name is a unique file identifier that tells me exactly where the change
is going. The label is not. (It's not freaking BASIC)

I bet all this was just inherited from diff. Would it be accepted if
I send a patch to fix it? What you guys think a goto label makes any
sense at all?

Thanks
Boaz
Next: Jeff King
Message 1 of 23 in “git diff annoyance / feature request”
  1. Boaz HarroshAug 25, 2011
  2. Jeff KingAug 25, 2011
  3. attr: map builtin userdiff drivers to well-known extensionsJeff King, Aug 25, 2011
  4. Eric SunshineAug 25, 2011
  5. Jeff KingAug 25, 2011
  6. Boaz HarroshAug 25, 2011
  7. Eric SunshineAug 25, 2011
  8. Jeff KingAug 26, 2011
  9. Brandon CaseyAug 25, 2011
  10. Jeff KingAug 26, 2011
  11. Eric SunshineAug 26, 2011
  12. Brandon CaseyAug 26, 2011
  13. Junio C HamanoAug 25, 2011
  14. Jeff KingAug 26, 2011
  15. Junio C HamanoAug 26, 2011
  16. Thomas RastAug 26, 2011
  17. Alexey ShumkinAug 27, 2011
  18. Junio C HamanoAug 25, 2011
  19. Boaz HarroshAug 25, 2011
  20. Miles BaderAug 26, 2011
  21. René ScharfeAug 26, 2011
  22. Boaz HarroshAug 26, 2011
  23. Junio C HamanoAug 26, 2011

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.