{"thread":{"id":"32904","subject":"[PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB","startedAt":"2013-02-14T13:34:03Z","lastAt":"2013-02-19T18:59:47Z","messageCount":4,"participants":["Nguyễn Thái Ngọc Duy","Thomas Ackermann","Duy Nguyen","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"209515","messageId":"1360848843-12092-1-git-send-email-pclouds@gmail.com","threadId":"32904","inReplyTo":null,"subject":"[PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2013-02-14T13:34:03Z","receivedAt":"2013-02-14T13:34:03Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"I just realized that many of my big repos are still on index v2 while\nv4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6\nand 25M -> 14M for webkit, for example). I wanted to propose index v4\nas the new default version, because I guess that not many people\noutside git@vger are aware of it, but perhaps this approach is less\ndrastic. It only suggest index v4 when the index size after clone hits\n512K limit.\n\nI have 170 git repositories (most of them Gnome projects) and only big\nones exceed the limit: webkit, linux-2.6, libreoffice-core, wine\n(530K), gentoo-x86. Gimp and banshee are close (510K and 321K). The\nrest barely hits 256K. So this hint won't show up often. On second\nthought, maybe we should lower it down to 300K to show more often and\nraise awareness on index v4 :)\n\nSomething I should have done in this patch too, is state that index v4\nis only supported since vXXX, that git clients older than that will\nnot work. But maybe just put that in update-index man page and refer\nthere.\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/clone.c | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex e0aaf13..7cd1b60 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -543,6 +543,7 @@ static int checkout(void)\n \tstruct tree *tree;\n \tstruct tree_desc t;\n \tint err = 0, fd;\n+\tstruct stat st;\n \n \tif (option_no_checkout)\n \t\treturn 0;\n@@ -591,6 +592,15 @@ static int checkout(void)\n \tif (!err && option_recursive)\n \t\terr = run_command_v_opt(argv_submodule, RUN_GIT_CMD);\n \n+\tif (!err &&\n+\t    !stat(git_path(\"index\"), &st) &&\n+\t    st.st_size > 512 * 1024)\n+\t\tadvise(_(\"Your index is quite large (%d KiB).\\n\"\n+\t\t\t \"You may want to update to index version 4 to reduce its size,\\n\"\n+\t\t\t\"as large index files may affect performance, using the command:\\n\"\n+\t\t\t \"  git update-index --index-version 4\"),\n+\t\t       st.st_size / 1024);\n+\n \treturn err;\n }\n \n-- \n1.8.1.2.536.gf441e6d\n"},{"id":"209805","messageId":"loom.20130219T113730-546@post.gmane.org","threadId":"32904","inReplyTo":"1360848843-12092-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB","fromName":"Thomas Ackermann","fromEmail":"th.acker@arcor.de","sentAt":"2013-02-19T10:45:04Z","receivedAt":"2013-02-19T10:45:04Z","isPatch":true,"sender":{"key":"th.acker@arcor.de","avatar":"https://avatars.githubusercontent.com/u/1358536?v=4"},"body":"Nguyễn Thái Ngọc Duy <pclouds <at> gmail.com> writes:\n\n> \n> I just realized that many of my big repos are still on index v2 while\n> v4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6\n> and 25M -> 14M for webkit, for example). I wanted to propose index v4\n> as the new default version, because I guess that not many people\n> outside git <at> vger are aware of it, but perhaps this approach is less\n> drastic. It only suggest index v4 when the index size after clone hits\n> 512K limit.\n> \n\nIs V4 really recommended for general use?\nDefault seems to be V3 and all I found in the docs is\nthe coresponding release not describing V4 as \"experimental\".\n(I have repos with index files > 40MiB (!) which will shrink to\napprox. 20MiB with V4 so using V4 would be an interessting option for me.)\n\n---\nThomas\n"},{"id":"209806","messageId":"CACsJy8CA8N1Hiz4JAXx++5BGEyYa6JnP3bhh++vtxb+6-ah-vA@mail.gmail.com","threadId":"32904","inReplyTo":"loom.20130219T113730-546@post.gmane.org","subject":"Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2013-02-19T10:54:55Z","receivedAt":"2013-02-19T10:54:55Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Tue, Feb 19, 2013 at 5:45 PM, Thomas Ackermann <th.acker@arcor.de> wrote:\n> Nguyễn Thái Ngọc Duy <pclouds <at> gmail.com> writes:\n>\n>>\n>> I just realized that many of my big repos are still on index v2 while\n>> v4 should reduce its size significantly (3.8M -> 2.9M for linux-2.6\n>> and 25M -> 14M for webkit, for example). I wanted to propose index v4\n>> as the new default version, because I guess that not many people\n>> outside git <at> vger are aware of it, but perhaps this approach is less\n>> drastic. It only suggest index v4 when the index size after clone hits\n>> 512K limit.\n>>\n>\n> Is V4 really recommended for general use?\n> Default seems to be V3 and all I found in the docs is\n> the coresponding release not describing V4 as \"experimental\".\n> (I have repos with index files > 40MiB (!) which will shrink to\n> approx. 20MiB with V4 so using V4 would be an interessting option for me.)\n\nThe default could be either v2 or v3, depending on whether you use\nsome extra features. v4 is basically v3 with pathname compression.\nYes, I think it's ok for general use.\n-- \nDuy\n"},{"id":"209851","messageId":"7vobfg5duk.fsf@alter.siamese.dyndns.org","threadId":"32904","inReplyTo":"loom.20130219T113730-546@post.gmane.org","subject":"Re: [PATCH/RFC] clone: suggest index version 4 when the index is bigger than 512 KiB","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2013-02-19T18:59:47Z","receivedAt":"2013-02-19T18:59:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thomas Ackermann <th.acker@arcor.de> writes:\n\n> Is V4 really recommended for general use?\n\nIf you stick to C-git, I do not think there is any reason to avoid\nit.  It is already a mature technology, the difference between 2 and\n4 are so trivial that it is very unlikely for a latent bug to be\nhiding in corner cases.\n\nIt is a different matter if various reimplementations already\nsupport the format.  You can try it out, and if you find that other\ntools based on reimplementations of Git you use do not understand\nthe format, you can safely go back with\n\n\tgit update-index --index-version 2\n\nafter you upgraded to version 4.\n"}]}