Login
Update of ”FIXMEs”
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: fdb99b22d9aa4539e199dfaf06b121077911e37c
Page Name:FIXMEs
Date: 2022-01-03 03:29:47
Original User: stephan
Mimetype:text/x-markdown
Parent: 03d0a170e6123f7d2375d8f9d6a52c33cf788436 (diff)
Next fa391f38981fd9788a16b5aacf73ddfcfa22243f
Content

An informal list of FIXMEs which don't warrant full tickets...

This is not intended to be a list of long-lived fixme's, but more of a scratchpad for things which come up spontaneously and shouldn't be forgotten.

In no particular order...

Global Config DB Handle (2021-11-09)

Currently the global config db handle is managed the same as the repo and checkout handles: they are ATTACHed to an in-memory main db. Experience with fnc suggests that we probably want to split it into its own db handle so that it can be opened and closed at will without locking-related issues. As of this writing, it's not possible to close (detach) the config db while any statement handle is currently being processed (that is, has been stepped but not yet finalized or reset) because any statement in such a state will lock the ATTACHed dbs.

The internals are set up to handle such a thing but this will require many small changes, some of which will certainly have to be discovered via trial and error.

There are currently no known use cases which require doing SQL joins on data from the global config db and the repo/checkout dbs, so no significant SQL needs to be changed for this.

Sidebar: this will have one significant change: the db name for that db will no longer be cfg, but main for its handle. We'll need to ensure that the schema does not use the name cfg anywhere.

Diff Engine v2

Related to the "v2" diff engine (2021 edition)...

Diff formats with chunk headers sometimes split unnecessarily

When outputing to a format which uses "chunk headers" (like unified) can sometimes split two chunks which are directly adjacent:

$ ./f-vdiff 072d63965188 a725befe5863 -l '*vdiff*' | head -30
Index: f-apps/f-vdiff.c
==================================================================
--- f-apps/f-vdiff.c
+++ f-apps/f-vdiff.c
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    36     36    fsl_buffer fname;
    37     37    fsl_buffer fcontent1;
    38     38    fsl_buffer fcontent2;
    39     39    fsl_buffer fhash;
    40     40    fsl_list globs;
           41 +  fsl_diff_opt diffOpt;
           42 +  fsl_diff_builder * diffBuilder;
    41     43  } VDiffApp = {
    42     44  NULL/*glob*/,
    43     45  5/*contextLines*/,
    44     46  0/*sbsWidth*/,
    45     47  0/*diffFlags*/,
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    46     48  0/*brief*/,
    47     49  fsl_buffer_empty_m/*fname*/,
    48     50  fsl_buffer_empty_m/*fcontent1*/,
    49     51  fsl_buffer_empty_m/*fcontent2*/,
    50     52  fsl_buffer_empty_m/*fhash*/,
    51        -fsl_list_empty_m/*globs*/
           53 +fsl_list_empty_m/*globs*/,
           54 +fsl_diff_opt_empty_m/*diffOpt*/,
           55 +NULL/*diffBuilder*/
    52     56  };
    53     57  
    54     58  static int f_vdiff_hash(fsl_card_F const * const fc,

Note how line numbers above and below the ~~~~~ (diff chunk separator) are consecutive. fossil(1) doesn't do that because it handles the chunk separator at a higher level of the API, whereas libf moves that into the diff builder interface. That change requires that libf forego a step fossil performs which tries to merge chunks of a diff together if the distance between them is smaller than the number of context lines. That change in libf is apparently the root cause of this. It's purely cosmetic, but it's annoying. The core of the discrepancy comes from fossil mixing the output of of the diffs: most of it is done from the diff builders but some pieces, like Unified-format diff line number markers, are output from the core diff driver algorithm. That gives it more control over the output, but it also only supports a single output channel (a memory buffer), whereas libf needs to be able to support arbitrary output channels (some of which, like ncurses widgets, cannot simply be streamed-to).

TODO: figure out how to adapt libf to (A) not require that the higher-level API know such details about the diff builder but (B) still be able to apply that "cosmetic optimization."

Checkin 08fdbacefacd2b partially resolves this, but only for the case when we're using line numbers (as in the above example).

Backports from Fossil

This list is for potential backports from fossil which should be investigated more closely to determine whether they need to be adapted for use in this library:

f-apps-specific

f-vdiff

Recognize Renames

f-vdiff, when comparing to the local checkout, needs to be able to recognize renames. Case in point:

[stephan@nuc:~/fossil/fossil]$ f-vdiff . . 
f-vdiff: ERROR #107 (FSL_RC_NOT_FOUND): Cannot stat file; /home/stephan/fossil/fossil/src/codecheck1.c

That file, along with many others, was moved to ../tools in this checkout. We have the state necessary to do this check (namely, the vfile table), it just needs to get done).

Optionally show full content of added/removed files

For newly-added/removed files, f-vdiff politely only shows "added" or "removed," not the whole content. Thought it's ostensibly easy to add an option to do this, f-vdiff's internal structure didn't really foresee that possibility and retrofitting it now requires some reworking.