commit - 4c573c7c79e170567111adc245c8f3d80ff7f879
commit + 4064588e9563c73b3a08166b9665a4c9b7c69ae1
blob - d983e298afbf41bdaf8560eb6a46db4c9148df0c
blob + ccbf90715f4f221a82615360de55231aff22beda
--- lib/send.c
+++ lib/send.c
if (!got_ref_name_is_valid(refname))
continue;
+ if (strncmp(refname, "refs/tags/", 10) == 0)
+ is_tag = 1;
/*
* Find out whether this is a reference we want to upload.
* Otherwise we can still use this reference as a hint to
err = got_ref_resolve(&my_id, repo, my_ref);
if (err)
goto done;
- if (got_object_id_cmp(my_id, their_id) != 0)
+ if (got_object_id_cmp(my_id, their_id) != 0) {
+ if (!overwrite_refs && is_tag) {
+ err = got_error_fmt(
+ GOT_ERR_SEND_TAG_EXISTS,
+ "%s", refname);
+ free(my_id);
+ goto done;
+ }
refs_to_send++;
+ }
free(my_id);
-
}
- if (strncmp(refname, "refs/tags/", 10) == 0)
- is_tag = 1;
-
- /* Prevent tags from being overwritten by default. */
- if (!overwrite_refs && my_ref && is_tag) {
- err = got_error_fmt(GOT_ERR_SEND_TAG_EXISTS,
- "%s", refname);
- goto done;
- }
-
/* Check if their object exists locally. */
err = got_object_open(&obj, repo, their_id);
if (err) {
blob - bf7378666fbaffcdef506f93bd3df20d0c8e454b
blob + 3eb8e7e29c0385103d644e4f76b51d8f5f478922
--- regress/cmdline/send.sh
+++ regress/cmdline/send.sh
got tag -l -r $testroot/repo-clone | grep ^tag | sort > $testroot/stdout
echo "tag 1.0 $tag_id" > $testroot/stdout.expected
echo "tag 2.0 $tag_id2" >> $testroot/stdout.expected
+ cmp -s $testroot/stdout $testroot/stdout.expected
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ diff -u $testroot/stdout.expected $testroot/stdout
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ # Send the same tags again. This should be a no-op.
+ got send -q -r $testroot/repo -T > $testroot/stdout 2> $testroot/stderr
+ ret="$?"
+ if [ "$ret" != "0" ]; then
+ echo "got send command failed unexpectedly" >&2
+ test_done "$testroot" "$ret"
+ return 1
+ fi
+
+ echo -n > $testroot/stdout.expected
cmp -s $testroot/stdout $testroot/stdout.expected
ret="$?"
if [ "$ret" != "0" ]; then