[[!comment format=mdwn
 username="joey"
 subject="""comment 1"""
 date="2021-01-28T15:52:03Z"
 content="""
Note that there's not data loss here, you can still check
out branches with the deleted files, or revert the merge.

Seems like importtree should add to the imported tree all files that
were in the export but were not preferred content.

Hmm, in Annex.Import.addBackExportExcluded, it tries to do just that. The
implementation uses a log file in .git/annex/export.ex that lists the
previously excluded files. There must be a bug in that.

I can easily reproduce this bug:

	joey@darkstar:/tmp/bench2>mkdir d
	joey@darkstar:/tmp/bench2>git init r
	joey@darkstar:/tmp/bench2>cd r
	joey@darkstar:/tmp/bench2/r>git annex init
	joey@darkstar:/tmp/bench2/r>git annex initremote d type=directory directory=../d exporttree=yes importtree=yes encryption=none
	joey@darkstar:/tmp/bench2/r>git annex wanted d 'exclude=*.mp3'
	joey@darkstar:/tmp/bench2/r>date > foo.bar
	joey@darkstar:/tmp/bench2/r>date > foo.mp3
	joey@darkstar:/tmp/bench2/r>git annex add
	joey@darkstar:/tmp/bench2/r>git commit -m add
	joey@darkstar:/tmp/bench2/r>git annex export master --to d
	export d foo.bar ok
	joey@darkstar:/tmp/bench2/r>git annex import master --from d
	list d ok
	update refs/remotes/d/master ok
	(recording state in git...)
	joey@darkstar:/tmp/bench2/r>git merge d/master
	Updating f818c13..b1a0434
	Fast-forward
	 foo.mp3 | 1 -
	 1 file changed, 1 deletion(-)
	 delete mode 120000 foo.mp3
	joey@darkstar:/tmp/bench2/r>cat .git/annex/export.ex/72c8d14c-af03-408c-845d-cac418d49e61 
	120000 blob 64c3e1f1f81026cb8ab5a6593d4120a1d73044c3 foo.mp3

So it seems adding back the exported file from the log is where the bug lies.
And specifically, it seems when it tries to read this log, it silently fails
to parse it, and so adds nothing back. 

Aha! -- The parser is expecting a tab in the git ls-tree like log, but it's
written with a space instead. It did used to work but the parser got rewritten
for speed and was changed to only accept tab, not both space and tab.
"""]]
