mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Cloud storage: attempt to deal with conflicts about deleted files
This doesn't seem right, but it works. Definitely needs more analysis. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
9f5a944107
commit
a2c638f63f
1 changed files with 13 additions and 2 deletions
15
git-access.c
15
git-access.c
|
@ -222,12 +222,23 @@ static int try_to_git_merge(git_repository *repo, git_reference *local, git_refe
|
|||
while (git_index_conflict_next(&ancestor, &ours, &theirs, iter)
|
||||
!= GIT_ITEROVER) {
|
||||
/* Mark this conflict as resolved */
|
||||
fprintf(stderr, "conflict in %s / %s / %s\n",
|
||||
fprintf(stderr, "conflict in %s / %s / %s -- ",
|
||||
ours ? ours->path : "-",
|
||||
theirs ? theirs->path : "-",
|
||||
ancestor ? ancestor->path : "-");
|
||||
error = git_index_conflict_remove(merged_index, ours->path);
|
||||
if ((!ours && theirs && ancestor) ||
|
||||
(ours && !theirs && ancestor)) {
|
||||
// the file was removed on one side or the other - just remove it
|
||||
fprintf(stderr, "looks like a delete on one side; removing the file from the index\n");
|
||||
error = git_index_remove(merged_index, ours ? ours->path : theirs->path, GIT_INDEX_STAGE_ANY);
|
||||
} else {
|
||||
error = git_index_conflict_remove(merged_index, ours ? ours->path : theirs ? theirs->path : ancestor->path);
|
||||
}
|
||||
if (error) {
|
||||
fprintf(stderr, "error at conflict resplution (%s)", giterr_last()->message);
|
||||
}
|
||||
}
|
||||
git_index_conflict_cleanup(merged_index);
|
||||
git_index_conflict_iterator_free(iter);
|
||||
report_error(translate("gettextFromC", "Remote storage and local data diverged. Error: merge conflict - manual intervention needed"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue