{"thread":{"id":"55763","subject":"[GSoC] Git Blog 1","startedAt":"2021-05-23T10:53:38Z","lastAt":"2021-05-26T09:22:38Z","messageCount":3,"participants":["ZheNing Hu","Christian Couder"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"425376","messageId":"CAOLTT8Tu1Xvc6sJ79n6f9B6TiuKp3akTQcQcuzEe7sG-kVOXAA@mail.gmail.com","threadId":"55763","inReplyTo":null,"subject":"[GSoC] Git Blog 1","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2021-05-23T10:53:18Z","receivedAt":"2021-05-23T10:53:38Z","isPatch":false,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"My first week blog finished:\nThe web version is here:\nhttps://adlternative.github.io/GSOC-Git-Blog-1/\n\n-----\n\n## Week1: Git Adventure Begin\n\nUse Git to submit Git patches to the Git community.\nDoes it sound magical? I fell very lucky to be selected\nby the Git community this year and start my Git Adventure\nin GSoC.\n\nI am no stranger to Git usage, and before the start of GSoC,\nI have learned some Git source code content, but I only saw\nthe tip of the iceberg of Git source code, there are still many\nthings that I need to explore.\n\n### What happened this week\n- In [[GSoC] Hello\nGit](https://lore.kernel.org/git/CAOLTT8SHE-ok3D+oLNSWFi7KPU==VQnTMDmC4YxUyNBJKmBD8A@mail.gmail.com/),\nChristian and JiangXin interacted with me.\n- I checked Olga's patch at Christian's prompt and learned a way\nto make `cat-file --batch` use `ref-filter` logic: Use `format_ref_array_item()`\nin `batch_object_write()`, this is indeed a good entry point. But\nbefore implementing this function, we must make `ref-filter`\nsupport the function of printing the original data of the object\n(as `cat-file --batch` does). I decided to reuse the atom\n`%(content:raw)` in ref-filter to implement this function.\n\n### The difficulties I met\nIn [[PATCH] [GSOC] ref-filter: add contents:raw\natom](https://lore.kernel.org/git/pull.958.git.1621500593126.gitgitgadget@gmail.com/),\nI submitted a patch, which support atom `%(content:raw)`\nfor `ref-filter`.\n\nUnfortunately, this patch has a big problem:\nI ignored the breakage on the test. This led me to\ndiscover a bigger problem:\n\nIf our references points to a blob or a tree, and  these objects may\nbe binary files, this means that we cannot use functions related\nto `strcmp()`,`strlen()` or `strbuf_addstr()`. The possible '\\0' will\ncause the output to be truncated. We have to think of a way to make\n`ref-filter` can accept the output of these binary content.\n\nSo I searched for all the codes in `ref-filter.c` that buffer might be\ntruncated by '\\0' and use the appropriate method to replace them.\n\nJust like replacing `strcmp()` with `memcmp()`, We can use `strbuf_add()`\ninstead of `strbuf_addstr()`,\nAt the same time I also wrote the equivalent `*._quote_buf_with_size()`\nto replace `*._quote_buf()`.\n\nI just submit it to the mailing list right now:\n[[GSOC][RFC] ref-filter: add contents:raw atom]\n(https://lore.kernel.org/git/pull.959.git.1621763612.gitgitgadget@gmail.com/)\n\nI don’t know if this is the right approach at the moment, let\nus slowly wait for the suggestions of mentors and reviewers... ;-)\n\nThanks!\n--\nZheNing Hu\n"},{"id":"425459","messageId":"CAP8UFD0sG9La8zpns+9Vzz1FA3XG+OF0+gRTDLU1s16aVY1-Yg@mail.gmail.com","threadId":"55763","inReplyTo":"CAOLTT8Tu1Xvc6sJ79n6f9B6TiuKp3akTQcQcuzEe7sG-kVOXAA@mail.gmail.com","subject":"Re: [GSoC] Git Blog 1","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2021-05-24T20:47:22Z","receivedAt":"2021-05-24T20:47:37Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, May 23, 2021 at 12:53 PM ZheNing Hu <adlternative@gmail.com> wrote:\n>\n> My first week blog finished:\n> The web version is here:\n> https://adlternative.github.io/GSOC-Git-Blog-1/\n\nGreat!\n\nSee some comments below, but you don't need to update your blog post\nfor each comment. Some are just remarks that might help you.\n\n> -----\n>\n> ## Week1: Git Adventure Begin\n>\n> Use Git to submit Git patches to the Git community.\n> Does it sound magical? I fell very lucky to be selected\n\ns/fell/feel/\n\n> by the Git community this year and start my Git Adventure\n> in GSoC.\n>\n> I am no stranger to Git usage, and before the start of GSoC,\n> I have learned some Git source code content, but I only saw\n> the tip of the iceberg of Git source code, there are still many\n> things that I need to explore.\n>\n> ### What happened this week\n> - In [[GSoC] Hello\n> Git](https://lore.kernel.org/git/CAOLTT8SHE-ok3D+oLNSWFi7KPU==VQnTMDmC4YxUyNBJKmBD8A@mail.gmail.com/),\n> Christian and JiangXin interacted with me.\n> - I checked Olga's patch at Christian's prompt and learned a way\n> to make `cat-file --batch` use `ref-filter` logic: Use `format_ref_array_item()`\n> in `batch_object_write()`, this is indeed a good entry point. But\n> before implementing this function, we must make `ref-filter`\n> support the function of printing the original data of the object\n> (as `cat-file --batch` does). I decided to reuse the atom\n\nIn your blog post it looks like a space is missing after \"object\" as\nwe see \"object(as\".\n\n> `%(content:raw)` in ref-filter to implement this function.\n\nThe above could be understood as saying that `%(content:raw)` already\nexists, which is not really true. Maybe you could say something like\n\"I decided to add the \":raw\" option to the existing `%(content)` atom\nin ref-filter.c to implement this function.\"\n\n> ### The difficulties I met\n> In [[PATCH] [GSOC] ref-filter: add contents:raw\n> atom](https://lore.kernel.org/git/pull.958.git.1621500593126.gitgitgadget@gmail.com/),\n> I submitted a patch, which support atom `%(content:raw)`\n\ns/support/supports/\n\nor\n\ns/support/adds support for/\n\n> for `ref-filter`.\n>\n> Unfortunately, this patch has a big problem:\n> I ignored the breakage on the test. This led me to\n\nMaybe: s/the breakage on the test/a test breakage/\n\n> discover a bigger problem:\n>\n> If our references points to a blob or a tree, and  these objects may\n> be binary files,\n\nThe raw content of a tree indeed contains the binary contents of the\nhashes it references, while other objects like commit and tags contain\nhashes in the hexadecimal format.\n\n> this means that we cannot use functions related\n> to `strcmp()`,`strlen()` or `strbuf_addstr()`. The possible '\\0' will\n> cause the output to be truncated. We have to think of a way to make\n> `ref-filter` can accept the output of these binary content.\n\nThe strbuf API has functions to deal with binary content.\n\n> So I searched for all the codes in `ref-filter.c` that buffer might be\n> truncated by '\\0' and use the appropriate method to replace them.\n>\n> Just like replacing `strcmp()` with `memcmp()`, We can use `strbuf_add()`\n> instead of `strbuf_addstr()`,\n> At the same time I also wrote the equivalent `*._quote_buf_with_size()`\n> to replace `*._quote_buf()`.\n\nNice!\n\n> I just submit it to the mailing list right now:\n> [[GSOC][RFC] ref-filter: add contents:raw atom]\n> (https://lore.kernel.org/git/pull.959.git.1621763612.gitgitgadget@gmail.com/)\n\nBy the way a better title for your patch might be \"[GSOC][RFC]\nref-filter: add ':raw' option to %(contents) atom\"\n\n> I don’t know if this is the right approach at the moment, let\n> us slowly wait for the suggestions of mentors and reviewers... ;-)\n\nThanks,\nChristian.\n"},{"id":"425555","messageId":"CAOLTT8R1j5m7XHHGrf9SoAEBR85yaT+tNJGzS+Pg1pcSm0csdA@mail.gmail.com","threadId":"55763","inReplyTo":"CAP8UFD0sG9La8zpns+9Vzz1FA3XG+OF0+gRTDLU1s16aVY1-Yg@mail.gmail.com","subject":"Re: [GSoC] Git Blog 1","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2021-05-26T09:22:21Z","receivedAt":"2021-05-26T09:22:38Z","isPatch":false,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Christian Couder <christian.couder@gmail.com> 于2021年5月25日周二 上午4:47写道：\n>\n> On Sun, May 23, 2021 at 12:53 PM ZheNing Hu <adlternative@gmail.com> wrote:\n> >\n> > My first week blog finished:\n> > The web version is here:\n> > https://adlternative.github.io/GSOC-Git-Blog-1/\n>\n> Great!\n>\n> See some comments below, but you don't need to update your blog post\n> for each comment. Some are just remarks that might help you.\n>\n> > -----\n> >\n> > ## Week1: Git Adventure Begin\n> >\n> > Use Git to submit Git patches to the Git community.\n> > Does it sound magical? I fell very lucky to be selected\n>\n> s/fell/feel/\n>\n> > by the Git community this year and start my Git Adventure\n> > in GSoC.\n> >\n> > I am no stranger to Git usage, and before the start of GSoC,\n> > I have learned some Git source code content, but I only saw\n> > the tip of the iceberg of Git source code, there are still many\n> > things that I need to explore.\n> >\n> > ### What happened this week\n> > - In [[GSoC] Hello\n> > Git](https://lore.kernel.org/git/CAOLTT8SHE-ok3D+oLNSWFi7KPU==VQnTMDmC4YxUyNBJKmBD8A@mail.gmail.com/),\n> > Christian and JiangXin interacted with me.\n> > - I checked Olga's patch at Christian's prompt and learned a way\n> > to make `cat-file --batch` use `ref-filter` logic: Use `format_ref_array_item()`\n> > in `batch_object_write()`, this is indeed a good entry point. But\n> > before implementing this function, we must make `ref-filter`\n> > support the function of printing the original data of the object\n> > (as `cat-file --batch` does). I decided to reuse the atom\n>\n> In your blog post it looks like a space is missing after \"object\" as\n> we see \"object(as\".\n>\n> > `%(content:raw)` in ref-filter to implement this function.\n>\n> The above could be understood as saying that `%(content:raw)` already\n> exists, which is not really true. Maybe you could say something like\n> \"I decided to add the \":raw\" option to the existing `%(content)` atom\n> in ref-filter.c to implement this function.\"\n>\n> > ### The difficulties I met\n> > In [[PATCH] [GSOC] ref-filter: add contents:raw\n> > atom](https://lore.kernel.org/git/pull.958.git.1621500593126.gitgitgadget@gmail.com/),\n> > I submitted a patch, which support atom `%(content:raw)`\n>\n> s/support/supports/\n>\n> or\n>\n> s/support/adds support for/\n>\n> > for `ref-filter`.\n> >\n> > Unfortunately, this patch has a big problem:\n> > I ignored the breakage on the test. This led me to\n>\n> Maybe: s/the breakage on the test/a test breakage/\n>\n\nThanks for these grammatical corrections. I will apply them\nto my blog (very easy)\n\n> > discover a bigger problem:\n> >\n> > If our references points to a blob or a tree, and  these objects may\n> > be binary files,\n>\n> The raw content of a tree indeed contains the binary contents of the\n> hashes it references, while other objects like commit and tags contain\n> hashes in the hexadecimal format.\n>\n> > this means that we cannot use functions related\n> > to `strcmp()`,`strlen()` or `strbuf_addstr()`. The possible '\\0' will\n> > cause the output to be truncated. We have to think of a way to make\n> > `ref-filter` can accept the output of these binary content.\n>\n> The strbuf API has functions to deal with binary content.\n>\n\nYes it is.\n\n> > So I searched for all the codes in `ref-filter.c` that buffer might be\n> > truncated by '\\0' and use the appropriate method to replace them.\n> >\n> > Just like replacing `strcmp()` with `memcmp()`, We can use `strbuf_add()`\n> > instead of `strbuf_addstr()`,\n> > At the same time I also wrote the equivalent `*._quote_buf_with_size()`\n> > to replace `*._quote_buf()`.\n>\n> Nice!\n>\n> > I just submit it to the mailing list right now:\n> > [[GSOC][RFC] ref-filter: add contents:raw atom]\n> > (https://lore.kernel.org/git/pull.959.git.1621763612.gitgitgadget@gmail.com/)\n>\n> By the way a better title for your patch might be \"[GSOC][RFC]\n> ref-filter: add ':raw' option to %(contents) atom\"\n>\n\nGood suggestion.\n\n> > I don’t know if this is the right approach at the moment, let\n> > us slowly wait for the suggestions of mentors and reviewers... ;-)\n>\n> Thanks,\n> Christian.\n\nThanks.\n--\nZheNing Hu\n"}]}