summaryrefslogtreecommitdiffstats
path: root/src/merge.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/merge.c')
-rw-r--r--src/merge.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/merge.c b/src/merge.c
index b281b06..206e2d9 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -44,6 +44,7 @@ struct cb_info {
static int conflict_phase(DB *ddb, struct syrep_name *name, struct diff_entry *de, void *p) {
struct cb_info *cb_info = p;
struct syrep_md md1, md2;
+ struct syrep_nrecno nrecno1, nrecno2;
int writeback = 0;
int f1, f2;
char path[PATH_MAX+1];
@@ -53,11 +54,19 @@ static int conflict_phase(DB *ddb, struct syrep_name *name, struct diff_entry *d
if (de->action != DIFF_CONFLICT)
return 0;
- if ((f1 = get_current_md_by_name(cb_info->c1, name, &md1)) < 0)
+ if ((f1 = get_nrecno_by_name(cb_info->c1, name, &nrecno1, 0)) < 0)
return -1;
- if ((f2 = get_current_md_by_name(cb_info->c2, name, &md2)) < 0)
+ if (f1)
+ if ((f1 = get_current_md_by_nrecno(cb_info->c1, &nrecno1, &md1)) < 0)
+ return -1;
+
+ if ((f2 = get_nrecno_by_name(cb_info->c2, name, &nrecno1, 0)) < 0)
return -1;
+
+ if (f2)
+ if ((f2 = get_current_md_by_nrecno(cb_info->c2, &nrecno2, &md2)) < 0)
+ return -1;
snprintf(path, sizeof(path), "%s/%s", cb_info->root, name->path);
@@ -161,6 +170,7 @@ static char *escape_path(const char *path, char *dst, unsigned l) {
static int copy_phase(DB *ddb, struct syrep_name *name, struct diff_entry *de, void *p) {
struct cb_info *cb_info = p;
struct syrep_name name2;
+ struct syrep_nrecno nrecno, nrecno2;
struct syrep_md md;
char path[PATH_MAX+1];
int f;
@@ -176,9 +186,13 @@ static int copy_phase(DB *ddb, struct syrep_name *name, struct diff_entry *de, v
snprintf(path, sizeof(path), "%s/%s", cb_info->root, name->path);
- if ((f = get_current_md_by_name(cb_info->c1, name, &md)) < 0)
+ if ((f = get_nrecno_by_name(cb_info->c1, name, &nrecno, 0)) < 0)
return -1;
+ if (f)
+ if ((f = get_current_md_by_nrecno(cb_info->c1, &nrecno, &md)) < 0)
+ return -1;
+
if (!f) {
fprintf(stderr, "Diff invalid!\n");
return -1;
@@ -187,8 +201,12 @@ static int copy_phase(DB *ddb, struct syrep_name *name, struct diff_entry *de, v
fhex(md.digest, SYREP_DIGESTLENGTH, d);
d[SYREP_DIGESTLENGTH*2] = 0;
- if ((f = get_current_name_by_md(cb_info->c2, &md, &name2)) < 0)
+ if ((f = get_current_nrecno_by_md(cb_info->c2, &md, &nrecno2)) < 0)
return -1;
+
+ if (f)
+ if ((f = get_name_by_nrecno(cb_info->c2, &nrecno2, &name2)) < 0)
+ return -1;
if (f) {
char path2[PATH_MAX+1];