ciena-blueplanet / git-fat

Manage large binary files with git
BSD 2-Clause "Simplified" License
97 stars 20 forks source link

Clearly notify about errors when pulling of fat files failed #32

Open cztomczak opened 9 years ago

cztomczak commented 9 years ago

Here are the logs from when cloning repository (which executes git fat pull command via git hook):

Cloning into 'cybase2'...
Updating git-fat files
ERROR:git_fat.py: Downloaded digest (e1843ad87b38b6f6e3c150bc6222121cb249c228) did not match stored digest for orphan: 2f3a61fe9c5306cbdc2d6da61863364c0c9492dd
ERROR:git_fat.py: Downloaded digest (86cbba2f1cf234401faa00b4533299da1e28381b) did not match stored digest for orphan: 5a34ddf19d37c741f74652ee847df9568a8b81e1
Setting filters in .git/config
Creating .git/fat/objects
Initialized git-fat
Downloading: c292cd45b51e29c558c4d9cacf93c4616ed738b9
Downloading: ad428fc9cefeb8219712bcceaf96d622f8593b56
Downloading: 54ffad3aa1a02719dad48c6a85a71015304f034e
Downloading: dffdffcfc4c508a528d438f71a05093a8a842ea5
Downloading: 3c1592e3d3cadd8a72127e520b106536feb9ab74
Downloading: e7535e1de394549a6facd6a1e44d64c72a43bf8e
Downloading: c4f6dd16f8f4d81396371c8b08f2eab9956467ee
Downloading: 3f73ff9231a1c15e28e6e259ef5cc35a72b34059
Downloading: ace563563a8f6f367ba82236e5bea240adea0d94
Downloading: 18982edc236a1d87e4eef018928358c925aa5b17
Downloading: f4427f241652dd656be856fa96b8ae8f390935ab
.... 100 morefiles ...

The error messages are displayed at the very top due to issues with flushing output buffer. After downloading 100 files you don't see no error messages when git fat pull completes. Files are not restored and cloning really failed. There is no clear indication whether git fat pull succeeded or failed.

There are two issues:

  1. At the end of git fat pull function, if downloading of any files failed there should be displayed an error message like: "ERROR: git fat pull failed.. failed to download 3 files. Restoring of files was aborted.".
  2. Order of log messages is wrong, there are problems with flushing the buffer. The "Downloading..." messages are displayed using the print() function, while the error messages are displayed using logger.error(). This is causing the wrong order of log messages. Using logger.info() instead of print() should fix the issue.

Currently you see:

ERROR:git_fat.py: Downloaded digest (86cbba2f1cf234401faa00b4533299da1e28381b) did not match stored digest for orphan: 5a34ddf19d37c741f74652ee847df9568a8b81e1
Initialized git-fat
Downloading: c292cd45b51e29c558c4d9cacf93c4616ed738b9
Downloading: ad428fc9cefeb8219712bcceaf96d622f8593b56
Downloading: 54ffad3aa1a02719dad48c6a85a71015304f034e

But instead I think it should be:

Initialized git-fat
Downloading: c292cd45b51e29c558c4d9cacf93c4616ed738b9
Downloading: ad428fc9cefeb8219712bcceaf96d622f8593b56
ERROR:git_fat.py: Downloaded digest (86cbba2f1cf234401faa00b4533299da1e28381b) did not match stored digest for orphan: 5a34ddf19d37c741f74652ee847df9568a8b81e1
Downloading: 54ffad3aa1a02719dad48c6a85a71015304f034e
abraithwaite commented 9 years ago

I agree with this. I've wanted to consolidate error handling when I moved to a single backend interface but I never got around to it.

justinclift commented 9 years ago

@CzarekTomczak Want to do a Pull Request with the fix(es)?

cztomczak commented 9 years ago

@justinclift Not right now. Later, maybe.