git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com>
Cc: git@vger.kernel.org,  ben.knoble@gmail.com
Subject: Re: [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config
Date: Sun, 23 Mar 2025 21:46:01 -0700	[thread overview]
Message-ID: <xmqq34f3qbna.fsf@gitster.g> (raw)
In-Reply-To: <CA+rGoLfALoTvQuAzQPx7rqd-Zy+wMiyEbF5Y8_-2Yi-yE-2qpA@mail.gmail.com> (JAYATHEERTH K.'s message of "Mon, 24 Mar 2025 07:12:09 +0530")

JAYATHEERTH K <jayatheerthkulkarni2005@gmail.com> writes:

>> > +#include "builtin.h"
>> > +#include "gettext.h"
>> > +#include "config.h"
>> > +#include "repository.h"  // Required for repo_config_get_string_tmp()
>>
>> I do not think we updated Coding Guidelines to allow // comments.
>>
> Since this was a tutorial I thought this was helpful, anyways I will
> remove the comments, because I get that this would be bad practice for
> newbies.

I meant that I think our guidelines frowns upon

	#include "foo.h" // for bar()

I didn't mean a comment is necessarily bad.  IOW,

	#include "foo.h" /* for bar() */

may be OK.

But real programs will evolve and API elements that are used from a
header file will change over time, so it may not be a good idea to
single out a function like that in the comment.  It would be much
better to explain _why_ each change is made in the text that
precedes the sample code.  E.g.

    Add `#include "config.h"` because you want to use X and Y,
    and `#include "repository.h"` because you want to use Z.

    Then, add the following bits to the function body:

     ----
    #include "builtin.h"
    #include "gettext.h"
    #include "config.h"
    #include "repository.h"
    ...
    int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo)
    {
        const char *cfg_name;

        printf(Q_("Your args (there is %d):\n",




  reply	other threads:[~2025-03-24  4:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-15 18:15 [GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites K Jayatheerth
2025-03-15 18:15 ` [GSOC][PATCH 2/3] Update function signature and UNUSED to include struct repository and modify builtin.h accordingly K Jayatheerth
2025-03-15 18:15 ` [GSOC][PATCH 3/3] Replace git_config(...) with repo_config(...) for modern Git compatibility K Jayatheerth
2025-03-15 18:21   ` JAYATHEERTH K
2025-03-17 21:57 ` [GSOC][PATCH 1/3] Remove outdated mentoring mailing list reference and clarify tutorial prerequisites Junio C Hamano
2025-03-19 17:02   ` [GSOC][PATCH v2] Remove outdated mentoring mailing list reference K Jayatheerth
2025-03-21 10:36     ` Junio C Hamano
2025-03-21 14:30       ` [[GSOC][PATCH v3] 1/3] docs: drop inactive mentoring list, add C prereq K Jayatheerth
2025-03-21 14:30         ` [[GSOC][PATCH v3] 2/3] docs: update function signature, add UNUSED macro K Jayatheerth
2025-03-23 22:08           ` Junio C Hamano
2025-03-21 14:30         ` [[GSOC][PATCH v3] 3/3] docs: replace git_config with repo_config K Jayatheerth
2025-03-23 22:08           ` Junio C Hamano
2025-03-24  1:42             ` JAYATHEERTH K
2025-03-24  4:46               ` Junio C Hamano [this message]
2025-03-24 13:03                 ` [[GSOC][PATCH v4] 2/3] docs: update function signature, add UNUSED macro K Jayatheerth
2025-03-24 13:03                   ` [[GSOC][PATCH v4] 3/3] docs: replace git_config with repo_config K Jayatheerth
2025-03-24 13:10                 ` [[GSOC][PATCH v3] " JAYATHEERTH K
2025-03-26  2:37                   ` Junio C Hamano
2025-03-26  3:15                     ` JAYATHEERTH K
2025-03-29 17:42                       ` JAYATHEERTH K
2025-03-21 14:32       ` [GSOC][PATCH v2] Remove outdated mentoring mailing list reference JAYATHEERTH K

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq34f3qbna.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jayatheerthkulkarni2005@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).