Looking at `pack_backend__writepack_add()` and then following through to `git_indexer_stream_add()`, I don't think this is a case where you should be testing for `!= 0`. Actually, `git_indexer_stream_add()` appears to be ignoring the return value of the progress callback (i.e. is it not abortable) and when it does return a value, it is returning a classic libgit2 error (i.e. less than zero to indicate an error).

If you do want to make this part of the process abortable, I believe you'll have to push the check all the way into `git_indexer_stream_add` and fix `indexer.c:do_progress_callback()`; and if you do that, the conversion from `!= 0` to `GIT_EUSER` should happen at that level and this code in `smart_protocol.c` should still just be checking `< 0` for the high level return value. The change here to make this line preserve the error value returned by `writepack->add()` would be needed still, of course.