Christian Couder <christian.cou...@gmail.com> writes:

> -static int ident_in_untracked(const struct untracked_cache *uc)
> +static int ident_current_location_in_untracked(const struct untracked_cache 
> *uc)
>  {
> -     const char *end = uc->ident.buf + uc->ident.len;
> -     const char *p   = uc->ident.buf;
> +     struct strbuf cur_loc = STRBUF_INIT;
> +     int res = 0;
>  
> -     for (p = uc->ident.buf; p < end; p += strlen(p) + 1)
> -             if (!strcmp(p, get_ident_string()))
> -                     return 1;
> -     return 0;
> +     /*
> +      * Previous git versions may have saved many strings in the
> +      * "ident" field, but it is insane to manage many locations,
> +      * so just take care of the first one.
> +      */
> +
> +     strbuf_addf(&cur_loc, "Location %s, system ", get_git_work_tree());
> +
> +     if (starts_with(uc->ident.buf, cur_loc.buf))
> +             res = 1;
> +
> +     strbuf_release(&cur_loc);
> +
> +     return res;
>  }

The ", system " part looks funny.  I think I know what you are
trying to do, though.

If the path to the working tree has ", system " as a substring,
I wonder if funny things may happen with this starts_with()?
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to