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

git 1.5.1-rc1 doesn't like empty files

From
PRPavel Roskin <proski@gnu.org>
Date
Mar 20, 2007, 03:30 UTC
Message-ID
<1174361424.3143.42.camel@dv>
Hello!

I don't know where this problem appeared, but it present in the current git (1.5.1-rc1). Empty files become invalid objects in the repository:

$ touch file 
$ git-init
Initialized empty Git repository in .git/
$ git-add file
$ git-commit -m "first commit"
Created initial commit 16a476808d3cb0a4758997ba58193a9dcfad0fd8
error: garbage at end of loose object
'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391'
 0 files changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 file
$

A file with a one newline is OK (replace "touch file with "echo >file" and the error will go away).

This is Linux, Fedora Development, i386.

The testsuite fails at test 7 in t9200-git-cvsexportcommit.sh, but it seems to be unrelated.

-- 
Regards,
Pavel Roskin
Next: Nicolas Vilz
Message 1 of 18 in “git 1.5.1-rc1 doesn't like empty files”
  1. Pavel RoskinMar 20, 2007
  2. Nicolas VilzMar 20, 2007
  3. Linus TorvaldsMar 20, 2007
  4. Pavel RoskinMar 20, 2007
  5. Linus TorvaldsMar 20, 2007
  6. Pavel RoskinMar 20, 2007
  7. Shawn O. PearceMar 20, 2007
  8. Alexander LitvinovMar 20, 2007
  9. Andy ParkinsMar 20, 2007
  10. Junio C HamanoMar 20, 2007
  11. Andy ParkinsMar 20, 2007
  12. Linus TorvaldsMar 20, 2007
  13. Junio C HamanoMar 20, 2007
  14. Pavel RoskinMar 20, 2007
  15. Linus TorvaldsMar 20, 2007
  16. Junio C HamanoMar 20, 2007
  17. Junio C HamanoMar 20, 2007
  18. Linus TorvaldsMar 20, 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.