Re: [PATCH] submodule: prevent overwriting .gitmodules entry on path reuse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> +++ b/builtin/submodule--helper.c
> @@ -32,6 +32,8 @@
>  #include "advice.h"
>  #include "branch.h"
>  #include "list-objects-filter-options.h"
> +#include "wildmatch.h"
> +
>
>  #define OPT_QUIET (1 << 0)
>  #define OPT_CACHED (1 << 1)
> @@ -3323,6 +3325,23 @@ static int config_submodule_in_gitmodules(const char *name, const char *var, con
>         return ret;
>  }
>
> +static int submodule_active_matches_path(const char *path)
> +{
> +       const struct string_list *values;
> +       size_t i;
> +
> +       if (git_config_get_string_multi("submodule.active", &values))
> +               return 0;
> +
> +       for (i = 0; i < values->nr; i++) {
> +               const char *pat = values->items[i].string;
> +               if (!wildmatch(pat, path, 0))
> +                       return 1;
> +       }
> +
> +       return 0;
> +}
> +
>


I added this change in the same patch because
t7413 was throwing errors at these specific lines of code
I don't really have full understanding of these files yet
but after this t7413 perfectly passed all the tests

I tried these changed because there was a comment about this in the file

/*
* NEEDSWORK: In a multi-working-tree world this needs to be
* set in the per-worktree config.
*/
/*
* NEEDSWORK: In the longer run, we need to get rid of this
* pattern of querying "submodule.active" before calling
* is_submodule_active(), since that function needs to find
* out the value of "submodule.active" again anyway.
*/


I can separate it into different patches if there is a requirement.
Or change based on the feedback.

-Jayatheerth




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux