{"thread":{"id":"8053","subject":"[PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","startedAt":"2007-05-09T10:33:20Z","lastAt":"2007-05-09T21:50:21Z","messageCount":10,"participants":["Sven Verdoolaege","Petr Baudis","Junio C Hamano","Johannes Schindelin","Frank Lichtenheld"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"41568","messageId":"20070509103320.GA7257MdfPADPa@greensroom.kotnet.org","threadId":"8053","inReplyTo":null,"subject":"[PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2007-05-09T10:33:20Z","receivedAt":"2007-05-09T10:33:20Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"git-checkout is also adapted to make use of this new option\ninstead of the handcrafted command sequence.\n\nSigned-off-by: Sven Verdoolaege <skimo@kotnet.org>\n---\nAll tests pass, except the recently added cvsserver tests,\nbut they fail without this patch too.\n Documentation/git-update-ref.txt |    5 ++++-\n builtin-branch.c                 |    2 +-\n builtin-fetch--tool.c            |    2 +-\n builtin-reflog.c                 |    2 +-\n builtin-update-ref.c             |   11 ++++++++---\n fast-import.c                    |    2 +-\n git-checkout.sh                  |   10 +---------\n receive-pack.c                   |    2 +-\n refs.c                           |   30 +++++++++++++++++++-----------\n refs.h                           |    3 ++-\n 10 files changed, 39 insertions(+), 30 deletions(-)\n\ndiff --git a/Documentation/git-update-ref.txt b/Documentation/git-update-ref.txt\nindex 9424fea..f222616 100644\n--- a/Documentation/git-update-ref.txt\n+++ b/Documentation/git-update-ref.txt\n@@ -7,7 +7,7 @@ git-update-ref - Update the object name stored in a ref safely\n \n SYNOPSIS\n --------\n-'git-update-ref' [-m <reason>] (-d <ref> <oldvalue> | <ref> <newvalue> [<oldvalue>])\n+'git-update-ref' [-m <reason>] (-d <ref> <oldvalue> | [--no-deref] <ref> <newvalue> [<oldvalue>])\n \n DESCRIPTION\n -----------\n@@ -36,6 +36,9 @@ them and update them as a regular file (i.e. it will allow the\n filesystem to follow them, but will overwrite such a symlink to\n somewhere else with a regular filename).\n \n+If --no-deref is given, <ref> itself is overwritten, rather than\n+the result of following the symbolic pointers.\n+\n In general, using\n \n \tgit-update-ref HEAD \"$head\"\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 7408285..6bd5843 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -462,7 +462,7 @@ static void create_branch(const char *name, const char *start_name,\n \t\tdie(\"Not a valid branch point: '%s'.\", start_name);\n \thashcpy(sha1, commit->object.sha1);\n \n-\tlock = lock_any_ref_for_update(ref, NULL);\n+\tlock = lock_any_ref_for_update(ref, NULL, 0);\n \tif (!lock)\n \t\tdie(\"Failed to lock ref for update: %s.\", strerror(errno));\n \ndiff --git a/builtin-fetch--tool.c b/builtin-fetch--tool.c\nindex 2065466..b14e78a 100644\n--- a/builtin-fetch--tool.c\n+++ b/builtin-fetch--tool.c\n@@ -42,7 +42,7 @@ static int update_ref(const char *action,\n \tif (!rla)\n \t\trla = \"(reflog update)\";\n \tsnprintf(msg, sizeof(msg), \"%s: %s\", rla, action);\n-\tlock = lock_any_ref_for_update(refname, oldval);\n+\tlock = lock_any_ref_for_update(refname, oldval, 0);\n \tif (!lock)\n \t\treturn 1;\n \tif (write_ref_sha1(lock, sha1, msg) < 0)\ndiff --git a/builtin-reflog.c b/builtin-reflog.c\nindex 4c39f1d..ce093ca 100644\n--- a/builtin-reflog.c\n+++ b/builtin-reflog.c\n@@ -249,7 +249,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,\n \t/* we take the lock for the ref itself to prevent it from\n \t * getting updated.\n \t */\n-\tlock = lock_any_ref_for_update(ref, sha1);\n+\tlock = lock_any_ref_for_update(ref, sha1, 0);\n \tif (!lock)\n \t\treturn error(\"cannot lock ref '%s'\", ref);\n \tlog_file = xstrdup(git_path(\"logs/%s\", ref));\ndiff --git a/builtin-update-ref.c b/builtin-update-ref.c\nindex 5ee960b..feac2ed 100644\n--- a/builtin-update-ref.c\n+++ b/builtin-update-ref.c\n@@ -3,16 +3,17 @@\n #include \"builtin.h\"\n \n static const char git_update_ref_usage[] =\n-\"git-update-ref [-m <reason>] (-d <refname> <value> | <refname> <value> [<oldval>])\";\n+\"git-update-ref [-m <reason>] (-d <refname> <value> | [--no-deref] <refname> <value> [<oldval>])\";\n \n int cmd_update_ref(int argc, const char **argv, const char *prefix)\n {\n \tconst char *refname=NULL, *value=NULL, *oldval=NULL, *msg=NULL;\n \tstruct ref_lock *lock;\n \tunsigned char sha1[20], oldsha1[20];\n-\tint i, delete;\n+\tint i, delete, ref_flags;\n \n \tdelete = 0;\n+\tref_flags = 0;\n \tgit_config(git_default_config);\n \n \tfor (i = 1; i < argc; i++) {\n@@ -30,6 +31,10 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \t\t\tdelete = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(\"--no-deref\", argv[i])) {\n+\t\t\tref_flags |= REF_NODEREF;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!refname) {\n \t\t\trefname = argv[i];\n \t\t\tcontinue;\n@@ -59,7 +64,7 @@ int cmd_update_ref(int argc, const char **argv, const char *prefix)\n \tif (oldval && *oldval && get_sha1(oldval, oldsha1))\n \t\tdie(\"%s: not a valid old SHA1\", oldval);\n \n-\tlock = lock_any_ref_for_update(refname, oldval ? oldsha1 : NULL);\n+\tlock = lock_any_ref_for_update(refname, oldval ? oldsha1 : NULL, ref_flags);\n \tif (!lock)\n \t\tdie(\"%s: cannot lock the ref\", refname);\n \tif (write_ref_sha1(lock, sha1, msg) < 0)\ndiff --git a/fast-import.c b/fast-import.c\nindex 3a2d5ed..ffa00fd 100644\n--- a/fast-import.c\n+++ b/fast-import.c\n@@ -1271,7 +1271,7 @@ static int update_branch(struct branch *b)\n \n \tif (read_ref(b->name, old_sha1))\n \t\thashclr(old_sha1);\n-\tlock = lock_any_ref_for_update(b->name, old_sha1);\n+\tlock = lock_any_ref_for_update(b->name, old_sha1, 0);\n \tif (!lock)\n \t\treturn error(\"Unable to lock %s\", b->name);\n \tif (!force_update && !is_null_sha1(old_sha1)) {\ndiff --git a/git-checkout.sh b/git-checkout.sh\nindex ed7c2c5..6b6facf 100755\n--- a/git-checkout.sh\n+++ b/git-checkout.sh\n@@ -270,15 +270,7 @@ if [ \"$?\" -eq 0 ]; then\n \t\tfi\n \telif test -n \"$detached\"\n \tthen\n-\t\t# NEEDSWORK: we would want a command to detach the HEAD\n-\t\t# atomically, instead of this handcrafted command sequence.\n-\t\t# Perhaps:\n-\t\t#\tgit update-ref --detach HEAD $new\n-\t\t# or something like that...\n-\t\t#\n-\t\tgit-rev-parse HEAD >\"$GIT_DIR/HEAD.new\" &&\n-\t\tmv \"$GIT_DIR/HEAD.new\" \"$GIT_DIR/HEAD\" &&\n-\t\tgit-update-ref -m \"checkout: moving to $arg\" HEAD \"$detached\" ||\n+\t\tgit-update-ref --no-deref -m \"checkout: moving to $arg\" HEAD \"$detached\" ||\n \t\t\tdie \"Cannot detach HEAD\"\n \t\tif test -n \"$detach_warn\"\n \t\tthen\ndiff --git a/receive-pack.c b/receive-pack.c\nindex 26aa26b..d3c422b 100644\n--- a/receive-pack.c\n+++ b/receive-pack.c\n@@ -209,7 +209,7 @@ static const char *update(struct command *cmd)\n \t\treturn NULL; /* good */\n \t}\n \telse {\n-\t\tlock = lock_any_ref_for_update(name, old_sha1);\n+\t\tlock = lock_any_ref_for_update(name, old_sha1, 0);\n \t\tif (!lock) {\n \t\t\terror(\"failed to lock %s\", name);\n \t\t\treturn \"failed to lock\";\ndiff --git a/refs.c b/refs.c\nindex 89876bf..2ae3235 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -736,19 +736,20 @@ static int is_refname_available(const char *ref, const char *oldref,\n \treturn 1;\n }\n \n-static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char *old_sha1, int *flag)\n+static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char *old_sha1, int flags, int *type_p)\n {\n \tchar *ref_file;\n \tconst char *orig_ref = ref;\n \tstruct ref_lock *lock;\n \tstruct stat st;\n \tint last_errno = 0;\n+\tint type;\n \tint mustexist = (old_sha1 && !is_null_sha1(old_sha1));\n \n \tlock = xcalloc(1, sizeof(struct ref_lock));\n \tlock->lock_fd = -1;\n \n-\tref = resolve_ref(ref, lock->old_sha1, mustexist, flag);\n+\tref = resolve_ref(ref, lock->old_sha1, mustexist, &type);\n \tif (!ref && errno == EISDIR) {\n \t\t/* we are trying to lock foo but we used to\n \t\t * have foo/bar which now does not exist;\n@@ -761,8 +762,10 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char\n \t\t\terror(\"there are still refs under '%s'\", orig_ref);\n \t\t\tgoto error_return;\n \t\t}\n-\t\tref = resolve_ref(orig_ref, lock->old_sha1, mustexist, flag);\n+\t\tref = resolve_ref(orig_ref, lock->old_sha1, mustexist, &type);\n \t}\n+\tif (type_p)\n+\t    *type_p = type;\n \tif (!ref) {\n \t\tlast_errno = errno;\n \t\terror(\"unable to resolve reference %s: %s\",\n@@ -780,10 +783,15 @@ static struct ref_lock *lock_ref_sha1_basic(const char *ref, const unsigned char\n \n \tlock->lk = xcalloc(1, sizeof(struct lock_file));\n \n+\tif (flags & REF_NODEREF)\n+\t\tref = orig_ref;\n \tlock->ref_name = xstrdup(ref);\n \tlock->orig_ref_name = xstrdup(orig_ref);\n \tref_file = git_path(\"%s\", ref);\n-\tlock->force_write = lstat(ref_file, &st) && errno == ENOENT;\n+\tif (lstat(ref_file, &st) && errno == ENOENT)\n+\t\tlock->force_write = 1;\n+\tif ((flags & REF_NODEREF) && (type & REF_ISSYMREF))\n+\t\tlock->force_write = 1;\n \n \tif (safe_create_leading_directories(ref_file)) {\n \t\tlast_errno = errno;\n@@ -806,14 +814,14 @@ struct ref_lock *lock_ref_sha1(const char *ref, const unsigned char *old_sha1)\n \tif (check_ref_format(ref))\n \t\treturn NULL;\n \tstrcpy(refpath, mkpath(\"refs/%s\", ref));\n-\treturn lock_ref_sha1_basic(refpath, old_sha1, NULL);\n+\treturn lock_ref_sha1_basic(refpath, old_sha1, 0, NULL);\n }\n \n-struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1)\n+struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1, int flags)\n {\n \tif (check_ref_format(ref) == -1)\n \t\treturn NULL;\n-\treturn lock_ref_sha1_basic(ref, old_sha1, NULL);\n+\treturn lock_ref_sha1_basic(ref, old_sha1, flags, NULL);\n }\n \n static struct lock_file packlock;\n@@ -858,7 +866,7 @@ int delete_ref(const char *refname, const unsigned char *sha1)\n \tstruct ref_lock *lock;\n \tint err, i, ret = 0, flag = 0;\n \n-\tlock = lock_ref_sha1_basic(refname, sha1, &flag);\n+\tlock = lock_ref_sha1_basic(refname, sha1, 0, &flag);\n \tif (!lock)\n \t\treturn 1;\n \tif (!(flag & REF_ISPACKED)) {\n@@ -909,7 +917,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n \tif (!is_refname_available(newref, oldref, get_loose_refs(), 0))\n \t\treturn 1;\n \n-\tlock = lock_ref_sha1_basic(renamed_ref, NULL, NULL);\n+\tlock = lock_ref_sha1_basic(renamed_ref, NULL, 0, NULL);\n \tif (!lock)\n \t\treturn error(\"unable to lock %s\", renamed_ref);\n \tlock->force_write = 1;\n@@ -963,7 +971,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n \t}\n \tlogmoved = log;\n \n-\tlock = lock_ref_sha1_basic(newref, NULL, NULL);\n+\tlock = lock_ref_sha1_basic(newref, NULL, 0, NULL);\n \tif (!lock) {\n \t\terror(\"unable to lock %s for update\", newref);\n \t\tgoto rollback;\n@@ -979,7 +987,7 @@ int rename_ref(const char *oldref, const char *newref, const char *logmsg)\n \treturn 0;\n \n  rollback:\n-\tlock = lock_ref_sha1_basic(oldref, NULL, NULL);\n+\tlock = lock_ref_sha1_basic(oldref, NULL, 0, NULL);\n \tif (!lock) {\n \t\terror(\"unable to lock %s for rollback\", oldref);\n \t\tgoto rollbacklog;\ndiff --git a/refs.h b/refs.h\nindex f61f6d9..f234eb7 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -33,7 +33,8 @@ extern int get_ref_sha1(const char *ref, unsigned char *sha1);\n extern struct ref_lock *lock_ref_sha1(const char *ref, const unsigned char *old_sha1);\n \n /** Locks any ref (for 'HEAD' type refs). */\n-extern struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1);\n+#define REF_NODEREF\t0x01\n+extern struct ref_lock *lock_any_ref_for_update(const char *ref, const unsigned char *old_sha1, int flags);\n \n /** Release any lock taken but not written. **/\n extern void unlock_ref(struct ref_lock *lock);\n-- \n1.5.2.rc2.26.gb822e-dirty\n"},{"id":"41579","messageId":"20070509123914.GO4489@pasky.or.cz","threadId":"8053","inReplyTo":"20070509103320.GA7257MdfPADPa@greensroom.kotnet.org","subject":"Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2007-05-09T12:39:14Z","receivedAt":"2007-05-09T12:39:14Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"On Wed, May 09, 2007 at 12:33:20PM CEST, Sven Verdoolaege wrote:\n> git-checkout is also adapted to make use of this new option\n> instead of the handcrafted command sequence.\n> \n> Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>\n\nIsn't this what git-symbolic-ref is about?\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nEver try. Ever fail. No matter. // Try again. Fail again. Fail better.\n\t\t-- Samuel Beckett\n"},{"id":"41584","messageId":"20070509125306.GV942MdfPADPa@greensroom.kotnet.org","threadId":"8053","inReplyTo":"20070509123914.GO4489@pasky.or.cz","subject":"Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2007-05-09T12:53:06Z","receivedAt":"2007-05-09T12:53:06Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Wed, May 09, 2007 at 02:39:14PM +0200, Petr Baudis wrote:\n> On Wed, May 09, 2007 at 12:33:20PM CEST, Sven Verdoolaege wrote:\n> > git-checkout is also adapted to make use of this new option\n> > instead of the handcrafted command sequence.\n> > \n> > Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>\n> \n> Isn't this what git-symbolic-ref is about?\n\nYou certainly can't use git-symbolic-ref now to overwrite a symbolic\nref by a non-symbolic ref.  It allows you to do the equivalent\nof symlink/readlink, while we want to _remove_ the link here.\n\nskimo\n"},{"id":"41601","messageId":"7vk5viuim5.fsf@assigned-by-dhcp.cox.net","threadId":"8053","inReplyTo":"20070509103320.GA7257MdfPADPa@greensroom.kotnet.org","subject":"Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T15:22:42Z","receivedAt":"2007-05-09T15:22:42Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Verdoolaege <skimo@kotnet.org> writes:\n\n> git-checkout is also adapted to make use of this new option\n> instead of the handcrafted command sequence.\n>\n> Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>\n> ---\n> All tests pass, except the recently added cvsserver tests,\n> but they fail without this patch too.\n\nCan you retry after installing libdbi and libdbd-sqlite-perl?\n"},{"id":"41606","messageId":"20070509153831.GW942MdfPADPa@greensroom.kotnet.org","threadId":"8053","inReplyTo":"7vk5viuim5.fsf@assigned-by-dhcp.cox.net","subject":"failing test t9400 (Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref)","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2007-05-09T15:38:31Z","receivedAt":"2007-05-09T15:38:31Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Wed, May 09, 2007 at 08:22:42AM -0700, Junio C Hamano wrote:\n> Can you retry after installing libdbi and libdbd-sqlite-perl?\n\nI'd rather spend my (limited) time on the submodules thing.\nShouldn't these tests be skipped if I don't have all that stuff installed?\nThere doesn't even seem to be an option to turn off these tests.\n\nYour hunch was correct, btw:\n\nbash-3.00$ sh t9400-git-cvsserver-server.sh --verbose --immediate\n* expecting success: cvs -Q co -d cvswork master &&\n   test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"\ninstall_driver(SQLite) failed: Can't locate DBD/SQLite.pm in @INC (@INC contains: /home/skimo/src/git/t/../perl/blib/lib /home/skimo/src/git/t/../perl/blib/arch/auto/Git /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at (eval 2) line 3, <STDIN> line 16.\nPerhaps the DBD::SQLite perl module hasn't been fully installed,\nor perhaps the capitalisation of 'SQLite' isn't right.\nAvailable drivers: ExampleP, Proxy.\n at /home/skimo/src/git/t/../git-cvsserver line 2212\ncvs [checkout aborted]: end of file from server (consult above messages if any)\n* FAIL 1: basic checkout\n        cvs -Q co -d cvswork master &&\n           test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"\n\nskimo\n"},{"id":"41610","messageId":"Pine.LNX.4.64.0705091806070.4167@racer.site","threadId":"8053","inReplyTo":"7vk5viuim5.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-05-09T16:07:05Z","receivedAt":"2007-05-09T16:07:05Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 9 May 2007, Junio C Hamano wrote:\n\n> Sven Verdoolaege <skimo@kotnet.org> writes:\n> \n> > git-checkout is also adapted to make use of this new option\n> > instead of the handcrafted command sequence.\n> >\n> > Signed-off-by: Sven Verdoolaege <skimo@kotnet.org>\n> > ---\n> > All tests pass, except the recently added cvsserver tests,\n> > but they fail without this patch too.\n> \n> Can you retry after installing libdbi and libdbd-sqlite-perl?\n\nWe have quite a few tests which are ignored when the prerequisites are not \ninstalled. I wonder if we could do the same with t9400...\n\nCiao,\nDscho\n"},{"id":"41613","messageId":"7vr6pqt1fu.fsf@assigned-by-dhcp.cox.net","threadId":"8053","inReplyTo":"20070509153831.GW942MdfPADPa@greensroom.kotnet.org","subject":"Re: failing test t9400 (Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T16:19:01Z","receivedAt":"2007-05-09T16:19:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sven Verdoolaege <skimo@kotnet.org> writes:\n\n> On Wed, May 09, 2007 at 08:22:42AM -0700, Junio C Hamano wrote:\n>> Can you retry after installing libdbi and libdbd-sqlite-perl?\n>\n> I'd rather spend my (limited) time on the submodules thing.\n\nHeh, everybody wants to futz with new things ;-)\n\n> Shouldn't these tests be skipped if I don't have all that stuff installed?\n> There doesn't even seem to be an option to turn off these tests.\n\nI agree.  We would need something like this, but I have no easy\nway to test it myself, short of uninstalling what I need on the\nbox.  As you do not have them, maybe you can give it a quick\nwhirl?\n\nThanks.\n\n---\ndiff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\nindex f17be6b..98d6bb4 100755\n--- a/t/t9400-git-cvsserver-server.sh\n+++ b/t/t9400-git-cvsserver-server.sh\n@@ -17,6 +17,11 @@ then\n     test_done\n     exit\n fi\n+perl -e 'use DBI; use DBD::SQLite' 2>&1 || {\n+    test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' :\n+    test_done\n+    exit\n+}\n \n unset GIT_DIR GIT_CONFIG\n WORKDIR=$(pwd)\n"},{"id":"41626","messageId":"20070509165820.GX942MdfPADPa@greensroom.kotnet.org","threadId":"8053","inReplyTo":"7vr6pqt1fu.fsf@assigned-by-dhcp.cox.net","subject":"Re: failing test t9400 (Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref)","fromName":"Sven Verdoolaege","fromEmail":"skimo@kotnet.org","sentAt":"2007-05-09T16:58:20Z","receivedAt":"2007-05-09T16:58:20Z","isPatch":true,"sender":{"key":"skimo@kotnet.org","avatar":null},"body":"On Wed, May 09, 2007 at 09:19:01AM -0700, Junio C Hamano wrote:\n> Sven Verdoolaege <skimo@kotnet.org> writes:\n> > Shouldn't these tests be skipped if I don't have all that stuff installed?\n> > There doesn't even seem to be an option to turn off these tests.\n> \n> I agree.  We would need something like this, but I have no easy\n> way to test it myself, short of uninstalling what I need on the\n> box.  As you do not have them, maybe you can give it a quick\n> whirl?\n\nSeems to work, albeit with a nasty warning,\n\nbash-3.00$ sh t9400-git-cvsserver-server.sh \nCan't locate DBD/SQLite.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i686-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i686-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at -e line 1.\nBEGIN failed--compilation aborted at -e line 1.\n*   ok 1: skipping git-cvsserver tests, Perl SQLite interface unavailable\n* passed all 1 test(s)\n\nskimo\n"},{"id":"41658","messageId":"20070509202720.GN30324@planck.djpig.de","threadId":"8053","inReplyTo":"7vr6pqt1fu.fsf@assigned-by-dhcp.cox.net","subject":"Re: failing test t9400 (Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref)","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-09T20:27:20Z","receivedAt":"2007-05-09T20:27:20Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Wed, May 09, 2007 at 09:19:01AM -0700, Junio C Hamano wrote:\n> Sven Verdoolaege <skimo@kotnet.org> writes:\n> > Shouldn't these tests be skipped if I don't have all that stuff installed?\n> > There doesn't even seem to be an option to turn off these tests.\n> \n> I agree.  We would need something like this, but I have no easy\n> way to test it myself, short of uninstalling what I need on the\n> box.  As you do not have them, maybe you can give it a quick\n> whirl?\n\nYeah, I totally forgot add such a check, even though I added one for\ncvs.\n\n> ---\n> diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\n> index f17be6b..98d6bb4 100755\n> --- a/t/t9400-git-cvsserver-server.sh\n> +++ b/t/t9400-git-cvsserver-server.sh\n> @@ -17,6 +17,11 @@ then\n>      test_done\n>      exit\n>  fi\n> +perl -e 'use DBI; use DBD::SQLite' 2>&1 || {\n\nMaybe there is a >/dev/null missing here?\n\nI personally would prefer \"perl -MDBI -MDBD::SQLite\" stylewise, but I\nguess it makes no difference in the end.\n\n> +    test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' :\n> +    test_done\n> +    exit\n> +}\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"41670","messageId":"7vejlpsm3m.fsf@assigned-by-dhcp.cox.net","threadId":"8053","inReplyTo":"20070509202720.GN30324@planck.djpig.de","subject":"Re: failing test t9400 (Re: [PATCH] git-update-ref: add --no-deref option for overwriting/detaching ref)","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-09T21:50:21Z","receivedAt":"2007-05-09T21:50:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Frank Lichtenheld <frank@lichtenheld.de> writes:\n\n> On Wed, May 09, 2007 at 09:19:01AM -0700, Junio C Hamano wrote:\n>> Sven Verdoolaege <skimo@kotnet.org> writes:\n>> > Shouldn't these tests be skipped if I don't have all that stuff installed?\n>> > There doesn't even seem to be an option to turn off these tests.\n>> \n>> I agree.  We would need something like this, but I have no easy\n>> way to test it myself, short of uninstalling what I need on the\n>> box.  As you do not have them, maybe you can give it a quick\n>> whirl?\n>\n> Yeah, I totally forgot add such a check, even though I added one for\n> cvs.\n>\n>> ---\n>> diff --git a/t/t9400-git-cvsserver-server.sh b/t/t9400-git-cvsserver-server.sh\n>> index f17be6b..98d6bb4 100755\n>> --- a/t/t9400-git-cvsserver-server.sh\n>> +++ b/t/t9400-git-cvsserver-server.sh\n>> @@ -17,6 +17,11 @@ then\n>>      test_done\n>>      exit\n>>  fi\n>> +perl -e 'use DBI; use DBD::SQLite' 2>&1 || {\n>\n> Maybe there is a >/dev/null missing here?\n\nYes, I have it in the committed version.  I wanted to make sure\nSven gets the expected error message from Perl in this test\npatch.\n"}]}