}
cleanup:
+ /*
+ * When using batched updates, we want to commit the non-rejected
+ * updates and also handle the rejections.
+ */
+ if (retcode && !atomic_fetch && transaction)
+ commit_ref_transaction(&transaction, false,
+ transport->remote->name, &err);
+
if (retcode) {
if (err.len) {
error("%s", err.buf);
'
test_expect_success REFFILES 'D/F conflict on case sensitive filesystem with lock' '
+ test_when_finished rm -rf base repo &&
(
git init --ref-format=reftable base &&
cd base &&
)
'
+test_expect_success 'fetch --tags fetches existing tags' '
+ test_when_finished rm -rf base repo &&
+
+ git init base &&
+ git -C base commit --allow-empty -m "empty-commit" &&
+
+ git clone --bare base repo &&
+
+ git -C base tag tag-1 &&
+ git -C repo for-each-ref >out &&
+ test_grep ! "tag-1" out &&
+ git -C repo fetch --tags &&
+ git -C repo for-each-ref >out &&
+ test_grep "tag-1" out
+'
+
+test_expect_success 'fetch --tags fetches non-conflicting tags' '
+ test_when_finished rm -rf base repo &&
+
+ git init base &&
+ git -C base commit --allow-empty -m "empty-commit" &&
+ git -C base tag tag-1 &&
+
+ git clone --bare base repo &&
+
+ git -C base tag tag-2 &&
+ git -C repo for-each-ref >out &&
+ test_grep ! "tag-2" out &&
+
+ git -C base commit --allow-empty -m "second empty-commit" &&
+ git -C base tag -f tag-1 &&
+
+ test_must_fail git -C repo fetch --tags 2>out &&
+ test_grep "tag-1 (would clobber existing tag)" out &&
+ git -C repo for-each-ref >out &&
+ test_grep "tag-2" out
+'
+
+test_expect_success "backfill tags when providing a refspec" '
+ test_when_finished rm -rf source target &&
+
+ git init source &&
+ git -C source commit --allow-empty --message common &&
+ git clone file://"$(pwd)"/source target &&
+ (
+ cd source &&
+ test_commit history &&
+ test_commit fetch-me
+ ) &&
+
+ # The "history" tag is backfilled even though we requested
+ # to only fetch HEAD
+ git -C target fetch origin HEAD:branch &&
+ git -C target tag -l >actual &&
+ cat >expect <<-\EOF &&
+ fetch-me
+ history
+ EOF
+ test_cmp expect actual
+'
+
. "$TEST_DIRECTORY"/lib-httpd.sh
start_httpd