Issue 2258 darcs optimize --patch-index reports: "darcs: error: patch index entry for file ./foo.html created >1 times."

Title darcs optimize --patch-index reports: "darcs: error: patch index entry for file ./foo.html created >1 times."
Priority bug Status resolved
Milestone Resolved in 2.12.0
Superseder Nosy List markstos
Assigned To
Topics PatchIndex

Created on 2012-10-18.17:32:54 by markstos, last changed 2016-04-11.17:22:49 by noreply.

msg16244 (view) Author: markstos Date: 2012-10-18.17:32:51
1. Summarise the issue (what were doing, what went wrong?)

I ran: 

darcs optimize --patch-index

The result was:
darcs: error: patch index entry for file ./foo.html created >1 times.

2. What behaviour were you expecting instead?

I expected it to succeed.

3. What darcs version are you using? (Try: darcs --exact-version)

2.9.5 (+ 153 patches)

4. What operating system are you running?

Ubuntu 10.04.


I looked up the history for that file. Incredibly, darcs shows the file 
being added twice, with no "remove" in between that I can see. The first 
time was in 2004, possibly pre darcs-1.0. I don't understand how darcs 
could have allowed that.

But, since apparently can actually happen, it would be nice if --patch-
index could deal with it. :)

Perhaps it can "warn" and tell me there's a problem with the file, and 
the history for it will be incomplete... or just have no index for that 
file in particular?

I would really like to use Patch Index on this particular repo, so 
workarounds are also welcome.
msg16245 (view) Author: markstos Date: 2012-10-18.17:33:32
I'll also pre-empt the question: Unfortunately, no, I can't publish the 
problematic repo.
msg16246 (view) Author: ganesh Date: 2012-10-18.18:02:00
What does 'darcs check' say?
msg16247 (view) Author: markstos Date: 2012-10-18.18:31:02
Thanks for the reply. Here's the output of "darcs check". We have about 
16,000 patches in the repo at this point (!!).

The repo is in the "hashed" format. We would like to upgrade to the 
"darcs-2" format, but switching all repos at once has a been a hurdle, 
as we have several that each have their relative state... and we have 
thus far not run into major problems with "hashed". 


$ time -p darcs check
WARNING: Dropping add of existing file 
Looks like we have a difference...
darcs: /usr/tmp/darcs-
openBinaryFile: does )


I'm not sure what comes after "does" ... my terminal cut it off. I could 
run it again with the terminal open very wide if that would help.
msg16248 (view) Author: owst Date: 2012-10-18.18:34:42
I can confirm that I have this issue also (hence my recent patch to
improve the error message). I haven't run a `darcs check`, and probably
can't publish the repo.
msg16249 (view) Author: markstos Date: 2012-10-18.18:42:43
OK, so after running

$ darcs repair


$ darcs check 

now runs clean. Great!

So maybe the conclusion to this bug report should be:

When the headline diagnostic message is reported, it should be followed 
by a message like this:

This issue is likely fixable by "darcs repair". Run "darcs repair" and 
then try "darcs optimize --patch-index" again.
msg19154 (view) Author: noreply Date: 2016-04-11.17:22:48
The following patch sent by Guillaume Hoffmann <guillaumh@gmail.com> updated issue issue2258 with
status=resolved;resolvedin=2.12.0 HEAD

* resolve issue2258: improve patch index error message with suggestion 
Ignore-this: 340d494a1fcf64c82f946d61cb968443
Date User Action Args
2012-10-18 17:32:54markstoscreate
2012-10-18 17:33:34markstossetmessages: + msg16245
2012-10-18 18:02:01ganeshsetmessages: + msg16246
2012-10-18 18:31:03markstossetmessages: + msg16247
2012-10-18 18:34:43owstsetmessages: + msg16248
2012-10-18 18:42:44markstossetmessages: + msg16249
2016-04-11 17:22:49noreplysetstatus: unknown -> resolved
messages: + msg19154
resolvedin: 2.12.0