{"thread":{"id":"1839","subject":"Newbie falls at first hurdle","startedAt":"2005-09-17T12:09:46Z","lastAt":"2005-09-18T19:09:22Z","messageCount":8,"participants":["Alan Chandler","Junio C Hamano","Petr Baudis"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"8758","messageId":"200509171309.46893.alan@chandlerfamily.org.uk","threadId":"1839","inReplyTo":null,"subject":"Newbie falls at first hurdle","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-09-17T12:09:46Z","receivedAt":"2005-09-17T12:09:46Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"I have been lurking on this mailing list since the beginning, but have just \ngot to the point where I want to use git to manage something I am doing.\n\nI have already got a working directory (or rather a directory hierarchy) of an \napplication with files (combination of html and java), and I need to start \napplying some control to it.  The Tutorial unfortunately does not cover this \ncase.  Nevertheless I have proceeded.\n\nSo at the top-level I have done 'git-init-db'\n\nbut I now assume I have to add all the files to the cache\n\nSo 'git-update-cache --add *' would seem to be the next step.\n\nHowever this fails with a message \n\nerror: JavaSource: is a directory\nfatal: Unable to add JavaSource to database; maybe you want to use --add \noption?\n\nSince I am already using the --add option, I really don't understand what I am \ndoing wrong.\n\nHelp please.\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"8760","messageId":"7vek7nbrk7.fsf@assigned-by-dhcp.cox.net","threadId":"1839","inReplyTo":"200509171309.46893.alan@chandlerfamily.org.uk","subject":"Re: Newbie falls at first hurdle","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-17T16:13:44Z","receivedAt":"2005-09-17T16:13:44Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n> So 'git-update-cache --add *' would seem to be the next step.\n>\n> However this fails with a message \n>\n> error: JavaSource: is a directory\n> fatal: Unable to add JavaSource to database; maybe you want to use --add \n> option?\n\nSorry, that is not a very helpful error message.\n\nWe do not track 'directories'.  Only files and symlinks, which\ncould live within subdirectories, and that's why you got that\nerror message -- you told it to add a directory.  You'd need\nsomething like this:\n\n    $ find * ! -type d -print0 | xargs -0 git add\n"},{"id":"8761","messageId":"200509171730.19055.alan@chandlerfamily.org.uk","threadId":"1839","inReplyTo":"7vek7nbrk7.fsf@assigned-by-dhcp.cox.net","subject":"Re: Newbie falls at first hurdle","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-09-17T16:30:18Z","receivedAt":"2005-09-17T16:30:18Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Saturday 17 Sep 2005 17:13, Junio C Hamano wrote:\n> Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n> We do not track 'directories'.  ...\n\n>\n>     $ find * ! -type d -print0 | xargs -0 git add\n\nI did actually manage to create content with\n\nfind . -wholename './.git' -prune -o -wholename './.deployables' -prune -o \n\\( -type f -print \\) | xargs git-update-cache --add \n\nand then commited it (with git commit)\n\nThe editor file that came up with this listed all the files it was going to \ncommit INCLUDING some .files from the root directory (I am using eclipse, so \nI had files like .project and .classpath there).  It says in the \nDocumentation that git ignores those - has it done?\n\n\nI then blew away (ie deleted) a couple of directories in my working tree and \nloaded them from an earlier backup and git diff HEAD showed the differences \nof the content of these new directories against the committed ones just fine.  \nI then deleted these directories again and then attempted to check them out \nfrom the repository with\n\ngit checkout master\n\nNone of these directories has been created in my working directory.\n\nDoes this mean that I have to manually create the directory structure for the \nfiles to be checked into?\n\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"8763","messageId":"7v1x3n8wps.fsf@assigned-by-dhcp.cox.net","threadId":"1839","inReplyTo":"200509171730.19055.alan@chandlerfamily.org.uk","subject":"Re: Newbie falls at first hurdle","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-17T16:50:39Z","receivedAt":"2005-09-17T16:50:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alan Chandler <alan@chandlerfamily.org.uk> writes:\n\n> The editor file that came up with this listed all the files it was going to \n> commit INCLUDING some .files from the root directory (I am using eclipse, so \n> I had files like .project and .classpath there).  It says in the \n> Documentation that git ignores those - has it done?\n\nWe ignore '.git' but we let you have paths starting with dots\nthese days -- the change happened quite a while ago and if some\ndocumentation still says we do not, then you spotted a\ndocumentation bug.\n\n> I then deleted these directories again and then attempted to check them out \n> from the repository with\n>\n> git checkout master\n>\n> None of these directories has been created in my working directory.\n\nAfter you told git about those files, you removed them from your\nworking tree.  \"git checkout\" tries not to lose your local\nchanges -- which means that what you removed will be left\nremoved (so are what you locally edited).\n\n    $ git checkout -f\n\nwould give them back, but you would also lose other local\nchanges if you have some.\n"},{"id":"8764","messageId":"200509171801.35612.alan@chandlerfamily.org.uk","threadId":"1839","inReplyTo":"7v1x3n8wps.fsf@assigned-by-dhcp.cox.net","subject":"Re: Newbie falls at first hurdle","fromName":"Alan Chandler","fromEmail":"alan@chandlerfamily.org.uk","sentAt":"2005-09-17T17:01:35Z","receivedAt":"2005-09-17T17:01:35Z","isPatch":false,"sender":{"key":"alan@chandlerfamily.org.uk","avatar":"https://gravatar.com/avatar/1862247e5ea8eac114c842f9dc3a5db6253754e24ef7171757cf97eedce48b8c?d=mp&s=160"},"body":"On Saturday 17 Sep 2005 17:50, Junio C Hamano wrote:\n> Alan Chandler <alan@chandlerfamily.org.uk> writes:\n> > The editor file that came up with this listed all the files it was going\n> > to commit INCLUDING some .files from the root directory (I am using\n> > eclipse, so I had files like .project and .classpath there).  It says in\n> > the Documentation that git ignores those - has it done?\n>\n> We ignore '.git' but we let you have paths starting with dots\n> these days -- the change happened quite a while ago and if some\n> documentation still says we do not, then you spotted a\n> documentation bug.\n\nI think that is probably my problem.  I deleted all of /usr/local/bin (which \nhad an earlier version of git in it) and then tried to re-install git 99.6.  \nWhen I got a permissions error I gave up and installed into ~/bin.\n\n\nBut of course - that probably means that the man pages are old ones from when \nI last installed git (very early in the development cycle).\n\n-- \nAlan Chandler\nhttp://www.chandlerfamily.org.uk\n"},{"id":"8778","messageId":"20050918145958.GB22391@pasky.or.cz","threadId":"1839","inReplyTo":"200509171309.46893.alan@chandlerfamily.org.uk","subject":"Re: Newbie falls at first hurdle","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-09-18T14:59:58Z","receivedAt":"2005-09-18T14:59:58Z","isPatch":false,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sat, Sep 17, 2005 at 02:09:46PM CEST, I got a letter\nwhere Alan Chandler <alan@chandlerfamily.org.uk> told me that...\n> I have been lurking on this mailing list since the beginning, but have just \n> got to the point where I want to use git to manage something I am doing.\n> \n> I have already got a working directory (or rather a directory hierarchy) of an \n> application with files (combination of html and java), and I need to start \n> applying some control to it.  The Tutorial unfortunately does not cover this \n> case.  Nevertheless I have proceeded.\n> \n> So at the top-level I have done 'git-init-db'\n> \n> but I now assume I have to add all the files to the cache\n> \n> So 'git-update-cache --add *' would seem to be the next step.\n> \n> However this fails with a message \n> \n> error: JavaSource: is a directory\n> fatal: Unable to add JavaSource to database; maybe you want to use --add \n> option?\n> \n> Since I am already using the --add option, I really don't understand what I am \n> doing wrong.\n\nTwo reports about this error message in one day, and I've seen more in\nthe past. Heh. ;-) I'd submit a patch, but I'm still staying at the last\ngit release because of the command renames.\n\nBTW, cg-add should be now (not in the last release yet, though) totally\ndirectory-friendly.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"},{"id":"8789","messageId":"7virwy46uz.fsf@assigned-by-dhcp.cox.net","threadId":"1839","inReplyTo":"20050918145958.GB22391@pasky.or.cz","subject":"Re: Newbie falls at first hurdle","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-09-18T17:35:00Z","receivedAt":"2005-09-18T17:35:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Two reports about this error message in one day, and I've seen more in\n> the past. Heh. ;-) I'd submit a patch, but I'm still staying at the last\n> git release because of the command renames.\n\nThat should not be a reason to stay at the last release; the old\ncommand names should be supported as well in the current\n\"master\" branch -- unless something is broken (missing backward\ncompatible old-name symlinks, for example), which I hope is not\nthe case.\n"},{"id":"8801","messageId":"20050918190922.GC22391@pasky.or.cz","threadId":"1839","inReplyTo":"7virwy46uz.fsf@assigned-by-dhcp.cox.net","subject":"[PATCH] Improve git-update-index error reporting","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-09-18T19:09:22Z","receivedAt":"2005-09-18T19:09:22Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Sun, Sep 18, 2005 at 07:35:00PM CEST, I got a letter\nwhere Junio C Hamano <junkio@cox.net> told me that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > Two reports about this error message in one day, and I've seen more in\n> > the past. Heh. ;-) I'd submit a patch, but I'm still staying at the last\n> > git release because of the command renames.\n> \n> That should not be a reason to stay at the last release; the old\n> command names should be supported as well in the current\n> \"master\" branch -- unless something is broken (missing backward\n> compatible old-name symlinks, for example), which I hope is not\n> the case.\n\nYou are obviously right. I don't make install, but running\n./cmd-rename.sh manually seemed to work fine.\n\n--\n\nThis makes git-update-index error reporting much less confusing. The\nuser will know what went wrong with better precision, and will be given\na hopefully less confusing advice.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n\n---\ncommit c758513532d4077630977fd0ee86ad1ba37c250a\ntree db9476c44cb74ea98ebec31cf7431cd012d5db94\nparent 7f4b3d9fef3f1855005e243de43776d8015ca737\nauthor Petr Baudis <pasky@suse.cz> Sun, 18 Sep 2005 21:08:35 +0200\ncommitter Petr Baudis <xpasky@machine.(none)> Sun, 18 Sep 2005 21:08:35 +0200\n\n update-index.c |   36 +++++++++++++++++++++++++-----------\n 1 files changed, 25 insertions(+), 11 deletions(-)\n\ndiff --git a/update-index.c b/update-index.c\n--- a/update-index.c\n+++ b/update-index.c\n@@ -50,11 +50,20 @@ static int add_file_to_cache(char *path)\n \t\t * case just fine without --force-remove.\n \t\t */\n \t\tif (status == 0 || (errno == ENOENT || errno == ENOTDIR)) {\n-\t\t\tif (allow_remove)\n-\t\t\t\treturn remove_file_from_cache(path);\n+\t\t\tif (allow_remove) {\n+\t\t\t\tif (remove_file_from_cache(path))\n+\t\t\t\t\treturn error(\"%s: cannot remove from the index\",\n+\t\t\t\t\t             path);\n+\t\t\t\telse\n+\t\t\t\t\treturn 0;\n+\t\t\t} else if (status < 0) {\n+\t\t\t\treturn error(\"%s: does not exist and --remove not passed\",\n+\t\t\t\t             path);\n+\t\t\t}\n \t\t}\n \t\tif (0 == status)\n-\t\t\treturn error(\"%s: is a directory\", path);\n+\t\t\treturn error(\"%s: is a directory - add files inside instead\",\n+\t\t\t             path);\n \t\telse\n \t\t\treturn error(\"lstat(\\\"%s\\\"): %s\", path,\n \t\t\t\t     strerror(errno));\n@@ -71,15 +80,17 @@ static int add_file_to_cache(char *path)\n \tcase S_IFREG:\n \t\tfd = open(path, O_RDONLY);\n \t\tif (fd < 0)\n-\t\t\treturn -1;\n+\t\t\treturn error(\"open(\\\"%s\\\"): %s\", path, strerror(errno));\n \t\tif (index_fd(ce->sha1, fd, &st, !info_only, NULL) < 0)\n-\t\t\treturn -1;\n+\t\t\treturn error(\"%s: failed to insert into database\", path);\n \t\tbreak;\n \tcase S_IFLNK:\n \t\ttarget = xmalloc(st.st_size+1);\n \t\tif (readlink(path, target, st.st_size+1) != st.st_size) {\n+\t\t\tchar *errstr = strerror(errno);\n \t\t\tfree(target);\n-\t\t\treturn -1;\n+\t\t\treturn error(\"readlink(\\\"%s\\\"): %s\", path,\n+\t\t\t             errstr);\n \t\t}\n \t\tif (info_only) {\n \t\t\tunsigned char hdr[50];\n@@ -87,15 +98,18 @@ static int add_file_to_cache(char *path)\n \t\t\twrite_sha1_file_prepare(target, st.st_size, \"blob\",\n \t\t\t\t\t\tce->sha1, hdr, &hdrlen);\n \t\t} else if (write_sha1_file(target, st.st_size, \"blob\", ce->sha1))\n-\t\t\treturn -1;\n+\t\t\treturn error(\"%s: failed to insert into database\", path);\n \t\tfree(target);\n \t\tbreak;\n \tdefault:\n-\t\treturn -1;\n+\t\treturn error(\"%s: unsupported file type\", path);\n \t}\n \toption = allow_add ? ADD_CACHE_OK_TO_ADD : 0;\n \toption |= allow_replace ? ADD_CACHE_OK_TO_REPLACE : 0;\n-\treturn add_cache_entry(ce, option);\n+\tif (add_cache_entry(ce, option))\n+\t\treturn error(\"%s: cannot add to the index - missing --add option?\",\n+\t\t\t     path);\n+\treturn 0;\n }\n \n static int compare_data(struct cache_entry *ce, struct stat *st)\n@@ -393,11 +407,11 @@ int main(int argc, char **argv)\n \t\t}\n \t\tif (force_remove) {\n \t\t\tif (remove_file_from_cache(path))\n-\t\t\t\tdie(\"git-update-index: --force-remove cannot remove %s\", path);\n+\t\t\t\tdie(\"git-update-index: unable to remove %s\", path);\n \t\t\tcontinue;\n \t\t}\n \t\tif (add_file_to_cache(path))\n-\t\t\tdie(\"Unable to add %s to database; maybe you want to use --add option?\", path);\n+\t\t\tdie(\"Unable to process file %s\", path);\n \t}\n \tif (write_cache(newfd, active_cache, active_nr) ||\n \t    commit_index_file(&cache_file))\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nIf you want the holes in your knowledge showing up try teaching\nsomeone.  -- Alan Cox\n"}]}