{"thread":{"id":"1677","subject":"cvsimport error: need a valid pathname","startedAt":"2005-08-27T14:48:26Z","lastAt":"2005-08-28T04:56:47Z","messageCount":5,"participants":["Kalle Valo","Martin Langhoff","Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7845","messageId":"874q9bcu6d.fsf@litku.valo.iki.fi","threadId":"1677","inReplyTo":null,"subject":"cvsimport error: need a valid pathname","fromName":"Kalle Valo","fromEmail":"kalle.valo@iki.fi","sentAt":"2005-08-27T14:48:26Z","receivedAt":"2005-08-27T14:48:26Z","isPatch":false,"sender":{"key":"kalle.valo@iki.fi","avatar":null},"body":"I have already imported a full CVS repository using this command:\n\ngit cvsimport -v -d :pserver:anonymous@hostap.epitest.fi:/cvs hostap\n\nIt completed without errors and I could use git to access the hostap\nhistory, just like I wanted. But now, when I was trying to get updates\nfrom the CVS repository, I got an error running the command in the\nsame directory:\n\n$ git cvsimport -v -d :pserver:anonymous@hostap.epitest.fi:/cvs hostap\nfileparse(): need a valid pathname at /usr/bin/git-cvsimport-script line 435\n$\n\nThe documentation says that it should be possible to update\nincrementally from the CVS repository. Am I doing something wrong or\nis this a bug?\n\nI'm using git updated today from the master branch on Debian unstable.\n\n-- \nKalle Valo\n"},{"id":"7846","messageId":"46a038f905082708371719121c@mail.gmail.com","threadId":"1677","inReplyTo":"874q9bcu6d.fsf@litku.valo.iki.fi","subject":"Re: cvsimport error: need a valid pathname","fromName":"Martin Langhoff","fromEmail":"martin.langhoff@gmail.com","sentAt":"2005-08-27T15:37:48Z","receivedAt":"2005-08-27T15:37:48Z","isPatch":false,"sender":{"key":"martin.langhoff@gmail.com","avatar":"https://gravatar.com/avatar/1e3f311b6c4c15836501901ca58f8c0b0667246488084ba524d8bc9867e22fd9?d=mp&s=160"},"body":"On 8/28/05, Kalle Valo <Kalle.Valo@iki.fi> wrote:\n> The documentation says that it should be possible to update\n> incrementally from the CVS repository. Am I doing something wrong or\n> is this a bug?\n\nIt _should_ work the way you are running it, so consider it a bug. Do\nyou think you can do some tinkering/debugging to tell us some more?\nOtherwise. how large is the cvs repo?\n\n(Debugging this kind of stuff, when it only fails on a specific repo,\nis tricky and time-consuming. Any help we get is _really_ appreciated.\nI have imported many trees, and several of them I am tracking -\nimporting new commits on a daily basis - without much trouble, except\nfor invalid/force-moved tags.)\n\ncheers,\n\n\nmartin\n"},{"id":"7847","messageId":"87zmr39svy.fsf@litku.valo.iki.fi","threadId":"1677","inReplyTo":"46a038f905082708371719121c@mail.gmail.com","subject":"Re: cvsimport error: need a valid pathname","fromName":"Kalle Valo","fromEmail":"kalle.valo@iki.fi","sentAt":"2005-08-27T17:44:33Z","receivedAt":"2005-08-27T17:44:33Z","isPatch":false,"sender":{"key":"kalle.valo@iki.fi","avatar":null},"body":"Martin Langhoff <martin.langhoff@gmail.com> writes:\n\n> On 8/28/05, Kalle Valo <Kalle.Valo@iki.fi> wrote:\n>> The documentation says that it should be possible to update\n>> incrementally from the CVS repository. Am I doing something wrong or\n>> is this a bug?\n>\n> It _should_ work the way you are running it, so consider it a bug. Do\n> you think you can do some tinkering/debugging to tell us some more?\n\nI investigated it and realized that this was my mistake. I had copied\nthe imported git repository from my laptop to my desktop using 'scp\n-r' and it changed .git/HEAD to a file, not a link as it should have\nbeen. I copied it again, this time with tar to preserve symbolic\nlinks, and cvsimport started to work again. So this was just a PEBCAK.\nThanks for your help.\n\n> Otherwise. how large is the cvs repo?\n\n'git log | grep commit | wc -l' says 2704 commits. I have to say that\ngit has made my life a lot easier. It was really easy to import the\nCVS history to git and now I can read the history properly with gitk.\nWith CVS I would have been banging my head to the wall all the time.\n\nNow all I want is svnimport and darcsimport :)\n\n-- \nKalle Valo\n"},{"id":"7850","messageId":"Pine.LNX.4.58.0508271334320.3317@g5.osdl.org","threadId":"1677","inReplyTo":"87zmr39svy.fsf@litku.valo.iki.fi","subject":"Make .git directory validation code test HEAD","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-08-27T20:54:42Z","receivedAt":"2005-08-27T20:54:42Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nInspired by a report by Kalle Valo, this changes git-sh-setup-script and\nthe \"setup_git_directory()\" function to test that $GIT_DIR/HEAD is a\nsymlink, since a number of core git features depend on that these days.\n\nWe used to allow a regular file there, but git-fsck-cache has been \ncomplaining about that for a while, and anything that uses branches \ndepends on the HEAD file being a symlink, so let's just encode that as a \nfundamental requirement.\n\nBefore, a non-symlink HEAD file would appear to work, but have subtle bugs \nlike not having the HEAD show up as a valid reference (because it wasn't \nunder \"refs\"). Now, we will complain loudly, and the user can fix it up \ntrivially instead of getting strange behaviour.\n\nThis also removes the tests for \"$GIT_DIR\" and \"$GIT_OBJECT_DIRECTORY\" \nbeing directories, since the other tests will implicitly test for that \nanyway (ie the tests for HEAD, refs and 00 would fail).\n\nSigned-off-by: Linus Torvalds <torvalds@osdl.org>\n---\n\nOn Sat, 27 Aug 2005, Kalle Valo wrote:\n> \n> I investigated it and realized that this was my mistake. I had copied\n> the imported git repository from my laptop to my desktop using 'scp\n> -r' and it changed .git/HEAD to a file, not a link as it should have\n> been. I copied it again, this time with tar to preserve symbolic\n> links, and cvsimport started to work again. So this was just a PEBCAK.\n\ndiff --git a/git-sh-setup-script b/git-sh-setup-script\n--- a/git-sh-setup-script\n+++ b/git-sh-setup-script\n@@ -11,7 +11,6 @@ die() {\n \texit 1\n }\n \n-[ -d \"$GIT_DIR\" ] &&\n+[ -h \"$GIT_DIR/HEAD\" ] &&\n [ -d \"$GIT_DIR/refs\" ] &&\n-[ -d \"$GIT_OBJECT_DIRECTORY\" ] &&\n [ -d \"$GIT_OBJECT_DIRECTORY/00\" ]\ndiff --git a/setup.c b/setup.c\n--- a/setup.c\n+++ b/setup.c\n@@ -72,6 +72,24 @@ const char **get_pathspec(const char *pr\n \treturn (const char **) pathspec;\n }\n \n+/*\n+ * Test it it looks like we're at the top\n+ * level git directory. We want to see a\n+ *\n+ *  - a HEAD symlink and a refs/ directory under \".git\"\n+ *  - either a .git/objects/ directory _or_ the proper\n+ *    GIT_OBJECT_DIRECTORY environment variable\n+ */\n+static int is_toplevel_directory(void)\n+{\n+\tstruct stat st;\n+\n+\treturn\t!lstat(\".git/HEAD\", &st) &&\n+\t\tS_ISLNK(st.st_mode) &&\n+\t\t!access(\".git/refs/\", X_OK) &&\n+\t\t(gitenv(DB_ENVIRONMENT) || !access(\".git/objects/\", X_OK));\n+}\n+\n const char *setup_git_directory(void)\n {\n \tstatic char cwd[PATH_MAX+1];\n@@ -89,17 +107,8 @@ const char *setup_git_directory(void)\n \n \toffset = len = strlen(cwd);\n \tfor (;;) {\n-\t\t/*\n-\t\t * We always want to see a .git/refs/ subdirectory\n-\t\t */\n-\t\tif (!access(\".git/refs/\", X_OK)) {\n-\t\t\t/*\n-\t\t\t * Then we need either a GIT_OBJECT_DIRECTORY define\n-\t\t\t * or a .git/objects/ directory\n-\t\t\t */\n-\t\t\tif (gitenv(DB_ENVIRONMENT) || !access(\".git/objects/\", X_OK))\n-\t\t\t\tbreak;\n-\t\t}\n+\t\tif (is_toplevel_directory())\n+\t\t\tbreak;\n \t\tchdir(\"..\");\n \t\tdo {\n \t\t\tif (!offset)\n"},{"id":"7856","messageId":"7v7je6slps.fsf@assigned-by-dhcp.cox.net","threadId":"1677","inReplyTo":"Pine.LNX.4.58.0508271334320.3317@g5.osdl.org","subject":"Re: Make .git directory validation code test HEAD","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-28T04:56:47Z","receivedAt":"2005-08-28T04:56:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@osdl.org> writes:\n\n> This also removes the tests for \"$GIT_DIR\" and \"$GIT_OBJECT_DIRECTORY\" \n> being directories, since the other tests will implicitly test for that \n> anyway (ie the tests for HEAD, refs and 00 would fail).\n\nI've thought about it when you brought up the Andrew's naked git\nrepository detection issue, but one thing I was undecided was\nthat if we would want to forbid either of these \"directories\"\nbeing a symlink to another directory.  I think it would be OK;\nadmittedly \"test -d\" says OK for a symlink to a directory.\n\nI accept the patch, but will not apply and push it out right\nnow; I am not in a shape to be operating heavy equipment ;-).\nPlease wait until tomorrow morning.\n"}]}