Commit 886097241bdd8b9a2f0ea87f4791a549bb8e00c5

Stefan Sperling 2020-03-21T22:50:29

check tags for equality before complaining about rejected tag updates

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
diff --git a/got/got.c b/got/got.c
index 0420f2e..cebadef 100644
--- a/got/got.c
+++ b/got/got.c
@@ -1414,6 +1414,11 @@ update_ref(struct got_reference *ref, struct got_object_id *new_id,
 
 	if (!replace_tags &&
 	    strncmp(got_ref_get_name(ref), "refs/tags/", 10) == 0) {
+		err = got_ref_resolve(&old_id, repo, ref);
+		if (err)
+			goto done;
+		if (got_object_id_cmp(old_id, new_id) == 0)
+			goto done;
 		if (verbosity >= 0) {
 			printf("Rejecting update of existing tag %s: %s\n",
 			    got_ref_get_name(ref), new_id_str);