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

Re: Expose subprojects as special files to "git diff" machinery

From
APAndy Parkins <andyparkins@gmail.com>
Date
Apr 15, 2007, 20:16 UTC
Message-ID
<200704152116.26773.andyparkins@gmail.com>
In-Reply-To
<Pine.LNX.4.64.0704151100550.5473@woody.linux-foundation.org>
On Sunday 2007, April 15, Linus Torvalds wrote:
Show 7 quoted lines
> 	diff --git a/sub-A b/sub-A
> 	index 2de597b..e8f11a4 160000
> 	--- a/sub-A
> 	+++ b/sub-A
> 	@@ -1 +1 @@
> 	-Subproject commit 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5
> 	+Subproject commit e8f11a45c5c6b9e2fec6d136d3fb5aff75393d42

Isn't this dangerous because it looks just like a normal diff with a file being rewritten, when in truth it is a tree entry record being rewritten. Possibly this is in the same category as the enhancements needed for rename support

cf.
diff --git a/file1 b/file2
similarity index 100%
rename from file1
rename to file2

There's no need to have a line marker, as there is only one "line" in 
the subproject "file", and no need for the index line because that 
information is contained in the change itself.  So something like:

diff --git a/sub-A b/sub-B
subproject from commit 2de597b5ad348b7db04bd10cdd38cd81cbc93ab5
subproject to commit e8f11a45c5c6b9e2fec6d136d3fb5aff75393d42

Regardless of the format, I'm sure this should be treated as part of 
git's extended diff syntax, so that if a diff like this ever got into 
the wild it wouldn't be a disaster if someone tried to apply it.



Andy
-- 
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
Previous: Sam RavnborgNext: Linus Torvalds
Message 5 of 12 in “Expose subprojects as special files to "git diff" machinery”
  1. Linus TorvaldsApr 15, 2007
  2. Sam RavnborgApr 15, 2007
  3. Linus TorvaldsApr 15, 2007
  4. Sam RavnborgApr 15, 2007
  5. Andy ParkinsApr 15, 2007
  6. Linus TorvaldsApr 15, 2007
  7. git-format-patch for binary files / merges [Re: Expose subprojects as special files to "git diff" machinery]Sam Vilain, Apr 18, 2007
  8. Alex RiesenApr 18, 2007
  9. Johannes SchindelinApr 18, 2007
  10. Linus TorvaldsApr 18, 2007
  11. Junio C HamanoApr 18, 2007
  12. Johannes SchindelinApr 19, 2007

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.