This doesn't look particularly elegant. Why not dereference the struct directly?

````c
struct each_branch_args *args = payload;

...

rb_protect(rb_yield, rugged_branch_new(args->rb_repo, branch), &args->exception);
return args->exception ? GIT_ERROR : GIT_OK;
```