Download raw body.
Make missing worktree author non-fatal in tog
Hey,
My tog started dying like this
$ tog
tog: GOT_AUTHOR environment variable is not set
This started happening with a66bb113790d6808d3a1646844962ac4d5153dec .
tog_worktree_status exits with an error if it doesn't manage to find an
author. This is easily reproducible by running tog in a dirty worktree
from a cloned repo while GOT_AUTHOR is unset.
The following patch addresses that, by setting wt_author to "". I don't
consider the situation should be fatal for this purpouse.
btw, I think that wctx->wt_author leaks? I couldn't convince myself that
tog_worktree_status is called only once before worktree_ctx_close.
comments? oks?
Lucas
-----------------------------------------------
commit d1c57f93c421e5d51c8a515510d153975f1d3640 (wt-author)
from: Lucas Gabriel Vuotto <lucas@sexy.is>
date: Tue Dec 10 21:14:55 2024 UTC
tog: don't make a missing worktree author fatal
Avoids tog from exiting if running it in a dirty checkout of a cloned
repository while GOT_AUTHOR is unset.
diff f6997150bbf387dd302b2fede9eeca6cee620f0f d1c57f93c421e5d51c8a515510d153975f1d3640
commit - f6997150bbf387dd302b2fede9eeca6cee620f0f
commit + d1c57f93c421e5d51c8a515510d153975f1d3640
blob - 2ce26fea02651c5c22189e43095204197b89c0d7
blob + b87b3b6d0e113a46fed343d94e4efc7c1f3c8cd5
--- tog/tog.c
+++ tog/tog.c
@@ -3244,8 +3244,14 @@ tog_worktree_status(struct tog_log_thread_args *ta)
if (wt_state != 0) {
err = get_author(&wctx->wt_author, ta->repo, wt);
- if (err != NULL)
- goto done;
+ /* Not finding an author is fine. */
+ if (err != NULL) {
+ wctx->wt_author = strdup("");
+ if (wctx->wt_author == NULL) {
+ /* Propagate the original error. */
+ goto done;
+ }
+ }
wctx->wt_root = strdup(got_worktree_get_root_path(wt));
if (wctx->wt_root == NULL) {
Make missing worktree author non-fatal in tog