[darcs-devel] [issue1785] text vs. binary files

Trent W. Buck bugs at darcs.net
Mon Mar 22 08:16:17 UTC 2010


New submission from Trent W. Buck <trentbuck at gmail.com>:

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 at gmail.com>
      * x2
        binary ./x

    Mon Mar 22 19:07:07 EST 2010  Trent W. Buck <trentbuck at 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'
    $

----------
messages: 10407
nosy: darcs-devel, dmitry.kurochkin, twb
status: unknown
title: text vs. binary files

__________________________________
Darcs bug tracker <bugs at darcs.net>
<http://bugs.darcs.net/issue1785>
__________________________________


More information about the darcs-devel mailing list