[Bug 5685] New: backup files can clobber tracked file contents

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Wed Sep 20 15:24:30 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5685

            Bug ID: 5685
           Summary: backup files can clobber tracked file contents
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: mbthomas at fb.com
                CC: mercurial-devel at mercurial-scm.org

When backing up files during merge conflict resolution, the backup filename is
just the tracked file with ".orig" appended.  This is bad when the repository
also contains a file with a ".orig" suffix.

Steps to reproduce:

  $ hg init repo
  $ cd repo
  $ echo "important data" > a
  $ echo "old important data" > a.orig
  $ hg add a a.orig
  $ hg commit -m "Add important data"
  $ echo "new important data" > a
  $ hg commit -m "New important data"
  $ hg up -q 0
  $ echo "more important data" > a
  $ hg up 1

At this point, the tracked file "a.orig" has been clobbered with the contents
"more important data".  It shows as modified in the dirstate, and would be
changed if the user committed at this point.

I don't think it's unreasonable for a user to create a file called
"something.orig", even if that seems a bit unusual.  Mercurial also doesn't
complain if it happens.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list