commit 6bdea1b4f0eadfdbbcb9d9b9aa0645b52501273f from: Mark Jamsek date: Tue Dec 31 14:05:23 2024 UTC tog: don't mark incorrect base commit in nested log views If a nested log view is opened, don't reuse the work tree's base commit index from the initial `tog log` invocation because it is based on the initial commit queue. If it has become invalid, an incorrect log view commit entry is painted with the base commit marker. Reset the index whenever opening nested log views so that it is recomputed, and write a regression test to cover this case. ok stsp@ commit - 35c7ffa4d97796f8a99059d3e45a7aa100352c0a commit + 6bdea1b4f0eadfdbbcb9d9b9aa0645b52501273f blob - 5329319eb952b701fc799caf6f0648c80bd83b52 blob + 01a33201435af4ba4c618c10db784372be30bea2 --- regress/tog/log.sh +++ regress/tog/log.sh @@ -542,7 +542,7 @@ test_log_commit_keywords() test_log_show_base_commit() { # make view wide enough to show full headline - test_init log_show_base_commit 80 3 + test_init log_show_base_commit 80 4 local repo="$testroot/repo" local id=$(git_show_head "$repo") @@ -574,6 +574,7 @@ test_log_show_base_commit() $(trim 80 "commit $head_id [1/2] master") $ymd flan_hacker *[master] base commit $ymd flan_hacker adding the test tree + EOF tog log @@ -590,6 +591,7 @@ test_log_show_base_commit() $(trim 80 "commit $head_id [1/2] master") $ymd flan_hacker [master] base commit $ymd flan_hacker adding the test tree + EOF tog log -r "$repo" @@ -615,6 +617,7 @@ test_log_show_base_commit() $(trim 80 "commit $head_id [1/3] master") $ymd flan_hacker ~[master] new base mixed-commit $ymd flan_hacker base commit + $ymd flan_hacker adding the test tree EOF tog log @@ -625,7 +628,31 @@ test_log_show_base_commit() test_done "$testroot" "$ret" return 1 fi + + # check marker is not incorrectly drawn when opening a nested log view + cat <<-EOF >$TOG_TEST_SCRIPT + T # open tree view of base commit + j # select beta tree entry + L # load log view of commits involving beta + SCREENDUMP + EOF + cat <<-EOF >$testroot/view.expected + $(trim 80 "commit $id /beta [1/1]") + $ymd flan_hacker adding the test tree + + + EOF + + tog log + cmp -s "$testroot/view.expected" "$testroot/view" + ret=$? + if [ $ret -ne 0 ]; then + diff -u "$testroot/view.expected" "$testroot/view" + test_done "$testroot" "$ret" + return 1 + fi + test_done "$testroot" "$ret" } blob - fe799cdf0299588e54f5654e65a0af63994dedf3 blob + e31dd5f281a3090496215529ba601df0b1b29849 --- tog/tog.c +++ tog/tog.c @@ -11305,6 +11305,7 @@ view_dispatch_request(struct tog_view **new_view, stru "parent/child view pair not supported"); break; case TOG_VIEW_LOG: + tog_base_commit.idx = -1; if (view->type == TOG_VIEW_BLAME) err = log_annotated_line(new_view, y, x, view->state.blame.repo, view->state.blame.id_to_log);