git-ftp icon indicating copy to clipboard operation
git-ftp copied to clipboard

Fail on errors?

Open thijzert opened this issue 13 years ago • 2 comments

If an FTP error arrises, shouldn't the post-receive hook have an error exit status as well? This would prevent half-uploaded wobsites that seem fine repository-wise.

thijzert avatar Oct 03 '11 15:10 thijzert

Yes. I'm a little confused why Python isn't zero exit status'ing on an exception.

ezyang avatar Oct 03 '11 18:10 ezyang

I keep getting this error:

remote: Traceback (most recent call last):
remote:   File "/share/home/thijs/Documents/Programs/zzNIH/git-ftp/git-ftp.py", line 357, in <module>
remote:     main()
remote:   File "/share/home/thijs/Documents/Programs/zzNIH/git-ftp/git-ftp.py", line 107, in main
remote:     upload_diff(repo, oldtree, tree, ftp, base)
remote:   File "/share/home/thijs/Documents/Programs/zzNIH/git-ftp/git-ftp.py", line 278, in upload_diff
remote:     node = tree[file]
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/tree.py", line 237, in __getitem__
remote:     return self.__div__(item)
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/tree.py", line 172, in __div__
remote:     item = tree[token]
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/tree.py", line 237, in __getitem__
remote:     return self.__div__(item)
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/tree.py", line 186, in __div__
remote:     for info in self._cache:
remote:   File "/usr/local/lib/python2.7/dist-packages/gitdb-0.5.4-py2.7-linux-x86_64.egg/gitdb/util.py", line 238, in __getattr__
remote:     self._set_cache_(attr)
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/tree.py", line 145, in _set_cache_
remote:     self._cache = tree_entries_from_data(ostream.read())
remote:   File "/usr/local/lib/python2.7/dist-packages/GitPython-0.3.2.RC1-py2.7.egg/git/objects/fun.py", line 73, in tree_entries_from_data
remote:     name_enc = name.decode("utf-8")
remote:   File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
remote:     return codecs.utf_8_decode(input, errors, True)
remote: UnicodeDecodeError: 'utf8' codec can't decode byte 0xe9 in position 28: invalid continuation byte
To ../.Wobsite-remote.git
   3e136fb..4c6ffe9  master -> master

It's caused by an invalid filename somewhere in my tree. Digging through the code reveals lots of try..except blocks, which would prevent an error exit status. However, as the stack trace is printed to the screen, it would appear that the failure correctly reaches "ground level". One would therefore expect this to be reflected in the exit status.

thijzert avatar Oct 03 '11 22:10 thijzert