git-annex/doc/todo/Recovering_from_a_bad_sync.mdwn
Joey Hess 522a0922b8 sync: Fix git sync with local git remotes even when they don't have an annex.uuid set.
Catch an exception when ensureInitialized is run in a non-initted
repository. In this case, just read the git config, so that the Git.Repo
object is not LocalUnknown, which is what is used to represent remotes
on eg, drives that are not connected.

The assistant already got this right, and like with the assistant, this
causes an implicit git-annex init of the local remote on the second sync,
once the git-annex branch has been pushed to it.
See this comment for more analysis:
http://git-annex.branchable.com/todo/Recovering_from_a_bad_sync/#comment-64e469a2c1969829ee149cbb41b1c138

This commit was sponsored by jscit.
2014-07-15 14:27:43 -04:00

31 lines
1.1 KiB
Markdown

Instead of using `sync origin` for the first sync and a simple `sync` for the other syncs,
# on pc1
git annex init "pc1"
git annex direct
git annex add .
git annex sync origin # remote specified on the first sync
# add some files
git annex add .
git annex sync
I used `sync` first and only later I used `sync origin`
# on pc1
git annex init "pc1"
git annex direct
git annex add .
git annex sync
# add some files
git annex add .
git annex sync origin # remote specified on a later sync
These sequences of commands create two completely different git histories.
More important, if one clones on pc2 the first repository, they will see both the pc1 remote and the pc2 remote. Instead, if one clones on pc2 the repository created by the second combination of commands, they will see only the pc2 remote.
What commands should I use on pc1 to fix the history so that when pc2 clones from the origin repository it will see both the pc1 remote and its own local remote?
> [[done]]; fixed per my comments. --[[Joey]]