change: adjust printing of file adds

laumann
Jun 26, 2023, 9:05 PM
LPGHALLKCQRJUB7BNHABAG2VEEAFTUSN3WAPASM5B3V6JJ54GXJQC

Dependencies

  • [2] TGT4VSME change: decode FILE_ADD
  • [3] N3PUHKQN change: fix scoping issue
  • [4] XTVLIC24 change: refactor to print_change()
  • [5] NEORNIZE change: decode and print file moves
  • [*] Q7TKZCJP Add initial support for reading the offsets from a (fixed) change

Change contents

  • replacement in change.c at line 647
    [2.1008][2.1008:1140]()
    printf(" %s (%s)", f->path, f->encoding);
    printf("\n");
    /* FIXME: f->contents is optional, how should we indicate this? */
    [2.1008]
    [2.1140]
    struct filemetadata metadata = { 0 };
    uint64_t start, end;
    start = f->addname.newvertex.start;
    end = f->addname.newvertex.end;
    if (start == end) {
    /* a directory */
    } else {
    read_filemetadata(&metadata, &contents[start], end - start);
    }
    printf(" %s (%s)\n", metadata.basename, metadata.encoding);
    /* f->contents is presumably empty when either
    * (a) the file is a directory, or (b) the new
    * file is really empty. For now, assume it's
    * present (it's an Option<Atom> though) and
    * crash on dirs */
  • edit in change.c at line 665
    [2.1179]
    [2.1179]
    free(metadata.basename);
    if (metadata.encoding)
    free(metadata.encoding);