Merge branch 'maint-1.5.4' into maint
authorJunio C Hamano <gitster@pobox.com>
Fri, 25 Apr 2008 04:50:48 +0000 (21:50 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 25 Apr 2008 04:50:48 +0000 (21:50 -0700)
* maint-1.5.4:
t5516: remove ambiguity test (1)
Linked glossary from cvs-migration page
write-tree: properly detect failure to write tree objects

Documentation/cvs-migration.txt
cache-tree.c
t/t0004-unwritable.sh [new file with mode: 0755]
t/t5516-fetch-push.sh
index ea98900228bda97cd4a3da190de9de5ecc3ec6e6..00f2e36b2ec162c6ef6d9c731ff549643ecb3ce7 100644 (file)
@@ -8,7 +8,8 @@ designating a single shared repository which people can synchronize with;
 this document explains how to do that.
 
 Some basic familiarity with git is required.  This
-link:tutorial.html[tutorial introduction to git] should be sufficient.
+link:tutorial.html[tutorial introduction to git] and the
+link:glossary.html[git glossary] should be sufficient.
 
 Developing against a shared repository
 --------------------------------------
index 39da54d1e56b5905655eafed1aff0f51c2540a8e..73cb3407077275f82677839d2c9e794c12833c95 100644 (file)
@@ -341,8 +341,11 @@ static int update_one(struct cache_tree *it,
 
        if (dryrun)
                hash_sha1_file(buffer.buf, buffer.len, tree_type, it->sha1);
-       else
-               write_sha1_file(buffer.buf, buffer.len, tree_type, it->sha1);
+       else if (write_sha1_file(buffer.buf, buffer.len, tree_type, it->sha1)) {
+               strbuf_release(&buffer);
+               return -1;
+       }
+
        strbuf_release(&buffer);
        it->entry_count = i;
 #if DEBUG
diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
new file mode 100755 (executable)
index 0000000..9255c63
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+test_description='detect unwritable repository and fail correctly'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+
+       >file &&
+       git add file &&
+       git commit -m initial &&
+       echo >file &&
+       git add file
+
+'
+
+test_expect_success 'write-tree should notice unwritable repository' '
+
+       (
+               chmod a-w .git/objects
+               test_must_fail git write-tree
+       )
+       status=$?
+       chmod 775 .git/objects
+       (exit $status)
+
+'
+
+test_expect_success 'commit should notice unwritable repository' '
+
+       (
+               chmod a-w .git/objects
+               test_must_fail git commit -m second
+       )
+       status=$?
+       chmod 775 .git/objects
+       (exit $status)
+
+'
+
+test_expect_success 'update-index should notice unwritable repository' '
+
+       (
+               echo a >file &&
+               chmod a-w .git/objects
+               test_must_fail git update-index file
+       )
+       status=$?
+       chmod 775 .git/objects
+       (exit $status)
+
+'
+
+test_expect_success 'add should notice unwritable repository' '
+
+       (
+               echo b >file &&
+               chmod a-w .git/objects
+               test_must_fail git add file
+       )
+       status=$?
+       chmod 775 .git/objects
+       (exit $status)
+
+'
+
+test_done
index 6d7e7385483bda6223d8d222980bf33b2679f711..f93a100f8732dcde2a8e52fc24ab5d54d4890b23 100755 (executable)
@@ -209,19 +209,7 @@ test_expect_success 'push with weak ambiguity (2)' '
 
 '
 
-test_expect_success 'push with ambiguity (1)' '
-
-       mk_test remotes/origin/master remotes/frotz/master &&
-       if git push testrepo master:master
-       then
-               echo "Oops, should have failed"
-               false
-       else
-               check_push_result $the_first_commit remotes/origin/master remotes/frotz/master
-       fi
-'
-
-test_expect_success 'push with ambiguity (2)' '
+test_expect_success 'push with ambiguity' '
 
        mk_test heads/frotz tags/frotz &&
        if git push testrepo master:frotz