git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [GSOC][RFC] Heed core.bare from template config file when no command line override given, as a microproject.

From
Christian Couder <christian.couder@gmail.com>
Date
Jan 4, 2024, 10:24 UTC
Message-ID
<CAP8UFD1wMJMY6G4SaPTPwq6b9HbeXG1kB97-RRrL-KGN1wE0rg@mail.gmail.com>
In-Reply-To
<85d4e83c-b6c4-4308-ac8c-a65c911c8a95@gmail.com>

On Tue, Jan 2, 2024 at 11:17 PM Ghanshyam Thakkar <shyamthakkar001@gmail.com> wrote:

Show 11 quoted lines
>
> Hello,
>
> I'm currently an undergrad beginning my journey of contributing to the
> Git project. I am seeking feedback on doing "Heed core.bare from
> template config file when no command line override given" described
> here
> https://lore.kernel.org/git/5b39c530f2a0edf3b1492fa13a1132d622a0678e.1684218850.git.gitgitgadget@gmail.com/
> by Elijah Newren, as a microproject. I would like to know from the
> community, if the complexity and scope of the project is appropriate
> for a microproject.
Thanks for your interest in the next GSoC!

My opinion is that it's too complex for a micro-project. Now maybe if Elijah or others are willing to help you on it, perhaps it will work out. I think it's safer to look at simpler micro-projects though.

Show 6 quoted lines
> e.g. in builtin/init-db.c :
>
> static int template_bare_config(const char *var, const char *value,
>                      const struct config_context *ctx, void *cb)
> {
>        if(!strcmp(var,"core.bare")) {
We like to have a space character between "if" and "(" as well as after a ","
Show 10 quoted lines
>              is_bare_repository_cfg = git_config_bool(var, value);
>        }
>        return 0;
> }
>
> int cmd_init_db(int argc, const char **argv, const char *prefix)
> {
> ...
> ...
>        if(is_bare_repository_cfg==-1) {

We like to have a space character both before and after "==" as well as between "if" and "(".

Show 27 quoted lines
>              if(!template_dir)
>                    git_config_get_pathname("init.templateDir",
>                                            &template_dir);
>
>              if(template_dir) {
>                    const char* template_config_path
>                                 = xstrfmt("%s/config",
>                    struct stat st;
>
>                    if(!stat(template_config_path, &st) &&
>                      !S_ISDIR(st.st_mode)) {
>                          git_config_from_file(template_bare_cfg,
>                                         template_config_path, NULL);
>                    }
>              }
> ...
> ...
>        return init_db(git_dir, real_git_dir, template_dir, hash_algo,
>                       initial_branch, init_shared_repository, flags);
> }
>
> I also wanted to know if the global config files should have an effect
> in deciding if the repo is bare or not.
>
> Curious to know your thoughts on, if this is the right approach or
> does it require doing refactoring to bring all the logic in setup.c.
> Based on your feedback, I can quickly send a patch.

I don't know this area of the code well, so I don't think I can help you much on this.

Best, Christian.

Previous: Ghanshyam ThakkarNext: Ghanshyam Thakkar
Message 2 of 15 in “[GSOC][RFC] Heed core.bare from template config file when no command line override given, as a microproject.”
  1. Ghanshyam ThakkarJan 2, 2024
  2. Christian CouderJan 4, 2024
  3. Ghanshyam ThakkarJan 4, 2024
  4. Elijah NewrenJan 5, 2024
  5. Junio C HamanoJan 5, 2024
  6. Ghanshyam ThakkarJan 6, 2024
  7. Junio C HamanoJan 8, 2024
  8. Elijah NewrenJan 19, 2024
  9. setup: clarify TODO comment about ignoring core.bareGhanshyam Thakkar, Feb 29, 2024
  10. Junio C HamanoFeb 29, 2024
  11. Ghanshyam ThakkarFeb 29, 2024
  12. setup: remove unnecessary variableGhanshyam Thakkar, Mar 4, 2024
  13. Junio C HamanoMar 4, 2024
  14. Ghanshyam ThakkarMar 4, 2024
  15. Junio C HamanoMar 4, 2024

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.