store new non-UTF-8 files raw and decode to deplay the contents

[?]
Feb 25, 2021, 8:47 AM
UM5DLRPBCQZQBEDJDLDPKODOKLACUHZD6YL6S4JRNKW6JLPNUVSAC

Dependencies

  • [2] W4NSLQNG make text_encoding available to all of libpijul
  • [3] IUH7IMWE Contributor license agreements
  • [4] 246V5TYI decode existing files
  • [5] NYOF5766 track file encoding in the record, including change text for file adds
  • [6] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [7] VO5OQW4W Removing anyhow in libpijul
  • [8] 6HNRL5RT detect non-utf8 text files
  • [9] VMOYG7MK text file decoding for new files

Change contents

  • replacement in libpijul/src/working_copy/mod.rs at line 36
    [4.66][4.67:139]()
    /// Read the file into the buffer, decoding to UTF-8 for text files
    [4.66]
    [4.139]
    /// Read the file into the buffer
  • replacement in libpijul/src/working_copy/mod.rs at line 38
    [4.147][4.147:213]()
    /// Returns the encoding used or None if it was a binary file
    [4.147]
    [4.213]
    /// Returns the file's text encoding or None if it was a binary file
  • replacement in libpijul/src/working_copy/mod.rs at line 48
    [4.444][4.444:513]()
    let (mut decoded, encoding) = if mime.starts_with("text/") {
    [4.444]
    [4.342]
    let encoding = if mime.starts_with("text/") {
  • replacement in libpijul/src/working_copy/mod.rs at line 53
    [4.560][4.560:636]()
    let (decoded, encoding, malformed) = encoding.decode(&uncoded);
    [4.560]
    [4.636]
    let (_decoded, encoding, malformed) = encoding.decode(&uncoded);
  • replacement in libpijul/src/working_copy/mod.rs at line 56
    [4.726][4.514:586]()
    (decoded.as_bytes().to_vec(), Some(Encoding(encoding)))
    [4.726]
    [4.788]
    Some(Encoding(encoding))
  • replacement in libpijul/src/working_copy/mod.rs at line 59
    [4.859][4.859:891]()
    (uncoded, None)
    [4.859]
    [4.891]
    None
  • replacement in libpijul/src/working_copy/mod.rs at line 62
    [4.922][4.922:950]()
    (uncoded, None)
    [4.922]
    [4.950]
    None
  • replacement in libpijul/src/working_copy/mod.rs at line 64
    [4.961][4.961:998]()
    buffer.append(&mut decoded);
    [4.961]
    [4.587]
    buffer.append(&mut uncoded);
  • file move: text.rs (-xwrx-rx-r)text.rs (-xw-x--x--)text.rs (-xw-x--x--)
    [4.248792]
    [4.10]
  • file move: mod.rs (-xwrx-rx-r)mod.rs (-xw-x--x--)mod.rs (-xw-x--x--)
    [4.768883]
    [4.793247]
  • replacement in libpijul/src/change/text_changes.rs at line 423
    [4.53215][4.53215:53268]()
    print_contents(&mut w, "+", c)?;
    [4.53215]
    [4.53268]
    print_contents(&mut w, "+", c, encoding)?;
  • edit in libpijul/src/change/text_changes.rs at line 1173
    [4.84694]
    [4.84694]
    encoding: &Option<Encoding>,
  • replacement in libpijul/src/change/text_changes.rs at line 1175
    [4.84728][4.5247:5313](),[4.5313][4.1745:1861]()
    if tree_magic_mini::from_u8(&contents).starts_with("text/") {
    for a in std::str::from_utf8(&contents)
    .unwrap()
    .split_terminator('\n')
    {
    [4.84728]
    [4.5804]
    if let Some(encoding) = encoding {
    for a in encoding.decode(&contents).split_terminator('\n') {
  • replacement in libpijul/src/change/text_changes.rs at line 1194
    [4.85538][4.85538:85578]()
    print_contents(w, "+", c)?;
    [4.85538]
    [4.85578]
    print_contents(w, "+", c, &None)?;
  • replacement in libpijul/src/change/text_changes.rs at line 1211
    [4.86133][4.86133:86184]()
    print_contents(w, "-", &buf[..])?;
    [4.86133]
    [4.86184]
    print_contents(w, "-", &buf[..], &None)?;