commit - 0e1d99b70d096dc74c53436437b7836ed9189543
commit + e42da5dbbf61c98edf34a31aa0c905099f9e91a4
blob - cc02089bfcb70faf1775da8b8a38eb7bfd903018
blob + 4181bc79115b549c541be0a74f00f51030a6135d
--- include/got_error.h
+++ include/got_error.h
#define GOT_ERR_BUNDLE_FORMAT 171
#define GOT_ERR_BAD_KEYWORD 172
#define GOT_ERR_UNKNOWN_CAPA 173
+#define GOT_ERR_REF_DUP_ENTRY 174
struct got_error {
int code;
blob - 8872bef06f42c654a7f90d728cc11aadb624cf2e
blob + b75dde1c3fc3d4e86f60fe5fa47a7f09526358bf
--- lib/error.c
+++ lib/error.c
{ GOT_ERR_BUNDLE_FORMAT, "unknown git bundle version" },
{ GOT_ERR_BAD_KEYWORD, "invalid commit keyword" },
{ GOT_ERR_UNKNOWN_CAPA, "unknown capability" },
+ { GOT_ERR_REF_DUP_ENTRY, "duplicate reference entry" },
};
static struct got_custom_error {
blob - f03b63655d11f0912e5c2dd4b182296979de8e36
blob + 4d56359502a5b5c1e7fc70c62f2355e4e13e7960
--- lib/fetch.c
+++ lib/fetch.c
packfile_size_cur = 0;
if (!done && refname && id) {
err = got_pathlist_insert(&pe, refs, refname, id);
- if (err)
- goto done;
- if (pe == NULL)
+ if (err || pe == NULL) {
free(id);
+ free(refname);
+ if (err != NULL)
+ goto done;
+ }
} else if (!done && server_progress) {
char *p;
/*
blob - 8ec7b9fb1ba48a9fa452a728bb1787df461ef284
blob + 65890785ca1e642d75f9495fc8450e57bdc2806a
--- lib/send.c
+++ lib/send.c
}
err = got_pathlist_insert(&new, refs, target_refname, id);
+ if (new == NULL && err == NULL)
+ err = got_error(GOT_ERR_REF_DUP_ENTRY);
+
done:
if (ref)
got_ref_close(ref);
- if (err || new == NULL /* duplicate */)
+ if (err)
free(id);
return err;
}
}
}
err = insert_sendable_ref(&have_refs, branchname, s, repo);
- if (err)
- goto done;
+ if (err) {
+ if (err->code != GOT_ERR_REF_DUP_ENTRY)
+ goto done;
+ err = NULL;
+ free(s);
+ }
s = NULL;
}
}
}
err = insert_sendable_ref(&have_refs, s, s, repo);
- if (err)
- goto done;
+ if (err) {
+ if (err->code != GOT_ERR_REF_DUP_ENTRY)
+ goto done;
+ err = NULL;
+ free(s);
+ }
s = NULL;
}