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

Re: Strange effect merging empty file

From
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Date
Mar 22, 2012, 12:47 UTC
Message-ID
<4F6B1F48.3040007@in.waw.pl>
In-Reply-To
<86iphwomnq.fsf@red.stonehenge.com>
On 03/22/2012 01:17 PM, Randal L. Schwartz wrote:
Show 8 quoted lines
>>>>>> "Zbigniew" == Zbigniew Jędrzejewski-Szmek<zbyszek@in.waw.pl>  writes:
>
> Zbigniew>  touch .gitignore
>
> If you're doing this to make sure git makes an empty directory, always
> put the directory name in there as a comment... that makes it (a) not an
> empty file (so merge doesn't get confused) and (b) unique, so when you
> change it, merge won't try to change other similar empty files.

Yes, this will indeed fix this particular problem. But in general, empty files can be used for various reasons, and it can be a pretty nasty surprise if they sprout random content as a result of a merge.

Maybe merge-recursive could special-case empty files?
Zbyszek
Previous: Ralf NyrenNext: Jeff King
Message 6 of 25 in “Strange effect merging empty file”
  1. Ralf NyrenMar 21, 2012
  2. Zbigniew Jędrzejewski-SzmekMar 21, 2012
  3. Junio C HamanoMar 21, 2012
  4. Randal L. SchwartzMar 22, 2012
  5. Ralf NyrenMar 22, 2012
  6. Zbigniew Jędrzejewski-SzmekMar 22, 2012
  7. Jeff KingMar 22, 2012
  8. Junio C HamanoMar 22, 2012
  9. Jeff KingMar 22, 2012
  10. Jeff KingMar 22, 2012
  11. Jeff KingMar 22, 2012
  12. 1/3 drop casts from users EMPTY_TREE_SHA1_BINJeff King, Mar 22, 2012
  13. 2/3 make is_empty_blob_sha1 available everywhereJeff King, Mar 22, 2012
  14. 3/3 merge-recursive: don't detect renames from empty filesJeff King, Mar 22, 2012
  15. Jonathan NiederMar 22, 2012
  16. Jeff KingMar 22, 2012
  17. Junio C HamanoMar 22, 2012
  18. Jeff KingMar 22, 2012
  19. Junio C HamanoMar 22, 2012
  20. 0/2 merging renames of empty filesJeff King, Mar 22, 2012
  21. 1/2 teach diffcore-rename to optionally ignore empty contentJeff King, Mar 22, 2012
  22. 2/2 merge-recursive: don't detect renames of empty filesJeff King, Mar 22, 2012
  23. Junio C HamanoMar 22, 2012
  24. Jeff KingMar 23, 2012
  25. Junio C HamanoMar 23, 2012

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.