{"thread":{"id":"38891","subject":"about Starter project;implementing log --size in the print_commit function.","startedAt":"2015-03-23T15:15:11Z","lastAt":"2015-03-25T16:13:40Z","messageCount":2,"participants":["Shanti Swarup Tunga","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"258365","messageId":"CABJeaiqhL5eNPkaPpheG_Y47Rapj4ys3igHhFH6YuiroECVGDA@mail.gmail.com","threadId":"38891","inReplyTo":null,"subject":"about Starter project;implementing log --size in the print_commit function.","fromName":"Shanti Swarup Tunga","fromEmail":"b112041@iiit-bh.ac.in","sentAt":"2015-03-23T15:15:11Z","receivedAt":"2015-03-23T15:15:11Z","isPatch":false,"sender":{"key":"b112041@iiit-bh.ac.in","avatar":null},"body":"I inserted a size variable of int type and calculated size in each\ncases of print_commit(). The function is\n\nstatic void print_commit(git_commit *commit)\n{\n    char buf[GIT_OID_HEXSZ + 1];\n    int i, count;\n    const git_signature *sig;\n    const char *scan, *eol;\n    int size=0;\n\n    git_oid_tostr(buf, sizeof(buf), git_commit_id(commit));\n    printf(\"commit %s\\n\", buf);\n\n    if ((count = (int)git_commit_parentcount(commit)) > 1) {\n        printf(\"Merge:\");\n        for (i = 0; i < count; ++i) {\n            git_oid_tostr(buf, 8, git_commit_parent_id(commit, i));\n            size=size+strlen(buf);\n            printf(\" %s\", buf);\n        }\n        printf(\"\\n\");\n\n    }\n\n    if ((sig = git_commit_author(commit)) != NULL) {\n        size=size+strlen(sig->name)+strlen(sig->email);\n        printf(\"Author: %s <%s>\\n\", sig->name, sig->email);\n        print_time(&sig->when, \"Date:   \");\n    }\n    printf(\"\\n\");\n\n    for (scan = git_commit_message(commit); scan && *scan; ) {\n        for (eol = scan; *eol && *eol != '\\n'; ++eol) /* find eol */;\n\n        size=size+strlen(scan);\n        printf(\"    %.*s\\n\", (int)(eol - scan), scan);\n        scan = *eol ? eol + 1 : NULL;\n    }\n    printf(\"\\n\");\n    printf(\"%d\",size);\n}\n\n\n\n\nWill that approach is going to work for the following problem.?\n"},{"id":"258503","messageId":"xmqq1tkd3vij.fsf@gitster.dls.corp.google.com","threadId":"38891","inReplyTo":"CABJeaiqhL5eNPkaPpheG_Y47Rapj4ys3igHhFH6YuiroECVGDA@mail.gmail.com","subject":"Re: about Starter project;implementing log --size in the print_commit function.","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-03-25T16:13:40Z","receivedAt":"2015-03-25T16:13:40Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Shanti Swarup Tunga <b112041@iiit-bh.ac.in> writes:\n\n> I inserted a size variable of int type and calculated size in each\n> cases of print_commit(). The function is\n>\n> static void print_commit(git_commit *commit)\n> {\n> ...\n> }\n\nSee Documentation/SubmittingPatches and then also CodingGuidelines\n\nEspecially, explain:\n\n - what does this change try to help and how?\n - why is this patch a good way to achieve that goal?\n - how the users are expected to use the new feature?\n\nin the proposed log message, run existing tests to make sure your\nchange did not break the existing system, add tests to make sure\nyou would notice if somebody else broke the feature you are adding\nin the future, and describe the new feature in the documentation.\n\n> Will that approach is going to work for the following problem.?\n\nWas your message cut short?  We cannot read \"the following\" problem\nhere...\n"}]}