darcs

Issue 1785 mechanism to force darcs to treat binary-looking file as text

Title mechanism to force darcs to treat binary-looking file as text
Priority wishlist Status needs-reproduction
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, twb
Assigned To
Topics

Created on 2010-03-22.08:16:16 by twb, last changed 2010-11-09.21:20:21 by gwern.

Messages
msg10407 (view) Author: twb Date: 2010-03-22.08:16:11
Real-world use case: to work around a broken web browser, I put a
literal zero-byte (^@) character in an otherwise-normal CSS file.
After doing so, "darcs w" claimed the file was binary, and AFAICT
there's no way to force it to continue treating the CSS file as a text
file that happens to contain a non-printable character.

Cf. UTF-8 source files, which as far as Darcs' byte-oriented mind is
concerned, contain non-printable characters -- yet it treats them as
text, not binary, files.

I then turned this into a pathological case where mark-conflicts
throws away one branch (below).

    $ with-temp-dir
    with-temp-dir: entering directory `/tmp/with-temp-dir.LRnsxo'
    This directory will be deleted when you exit.
    $ darcs init
    $ date >x
    $ darcs rec -lamx
    Finished recording patch 'x'
    $ printf '\000\n' >>x
    $ cat x
    Mon Mar 22 19:07:00 EST 2010
    ^@
    $ darcs rec -lamx2
    Finished recording patch 'x2'
    $ darcs cha -v
    Mon Mar 22 19:07:55 EST 2010  Trent W. Buck <trentbuck@gmail.com>
      * x2
        binary ./x

    Mon Mar 22 19:07:07 EST 2010  Trent W. Buck <trentbuck@gmail.com>
      * x
        addfile ./x
        hunk ./x 1
        +Mon Mar 22 19:07:00 EST 2010
    $ darcs init --repo R
    $ darcs push -apx$ R
    Finished applying...
    Push successful.
    $ date >R/x
    $ darcs rec --repo R -lamxR
    Finished recording patch 'xR'
    $ darcs pull -a R
    Pulling from "/tmp/with-temp-dir.LRnsxo/R"...
    Backing up ./x(-darcs-backup0)
    There are conflicts in the following files:
    ./x

    darcs failed:  Refusing to pull patches leading to conflicts.
    If you would rather apply the patch and mark the conflicts,
    use the --mark-conflicts or --allow-conflicts options to pull
    These can set as defaults by adding
     pull mark-conflicts
    to _darcs/prefs/defaults in the target repo.
    $ darcs pull -a R --mark-conflicts
    Pulling from "/tmp/with-temp-dir.LRnsxo/R"...
    Backing up ./x(-darcs-backup1)
    We have conflicts in the following files:
    ./x
    Finished pulling and applying.
    $ cat x
    Mon Mar 22 19:08:33 EST 2010
    $ # Looks like the xR patch completely overwrote the x-and-x2 patchset.
    $ exit
    with-temp-dir: leaving directory `/tmp/with-temp-dir.LRnsxo'
    $
msg10435 (view) Author: kowey Date: 2010-03-23.01:43:18
At the risk of flippancy, I'm marking this as a wishlist item as I
believe it affects too small a number of users to think hard about.

Am I mistaken?
msg12973 (view) Author: gwern Date: 2010-11-09.21:20:20
I'd like to add another real-world example. One little tool of mine is a
module in Yi (http://code.haskell.org/yi/src/Yi/IReader.hs) inspired by
incremental reading (http://en.wikipedia.org/wiki/Incremental_reading).
It's basically a circular list of text files; I use it to organize my
reading and take notes. Do a little bit each day and it adds up, that
sort of thing.

Unfortunately the use of Data.Binary and some ill-advised concurrency
meant that I sometimes corrupted the big file/database. (33M and counting.)

So I put it in darcs. Now each time it changes, Darcs seems to make a
new copy and my ~/_darcs/ repo is suddenly up to 88M.

This annoys me because most of the file is textual. I copied the
database, did some reading/editing, and forced `diff` to work on the 2,
and the diff turned out to be only 3M or so - which is very different
from 33M.
History
Date User Action Args
2010-03-22 08:16:17twbcreate
2010-03-23 01:43:22koweysetpriority: wishlist
status: unknown -> needs-reproduction
title: text vs. binary files -> mechanism to force darcs to treat binary-looking file as text
messages: + msg10435
nosy: + kowey
2010-11-09 21:20:21gwernsetmessages: + msg12973