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

Re: [PATCH] Fix incorrect ref namespace check

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Jan 11, 2012, 01:54 UTC
Message-ID
<CACsJy8Af=PjXE4sHqSk1v8qoraivOnT2w495W1c1dVQBW1s-cQ@mail.gmail.com>
In-Reply-To
<7v39bunmno.fsf@alter.siamese.dyndns.org>
Any comments Mike?
2012/1/5 Junio C Hamano <gitster@pobox.com>:
Show 60 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> The reason why the trailing slash is needed is obvious. refs/stash and
>> HEAD are not namespace, but complete refs. Do full string compare on them.
>>
>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
>> ---
>>  I missed prefixcmp(..., "HEAD") right below prefixcmp(..., "refs/stash")
>
> As Michael has been actively showing interest in cleaning up the area, he
> should have been CC'ed, I would think.
>
>>
>>  builtin/fetch.c  |    2 +-
>>  builtin/remote.c |    2 +-
>>  log-tree.c       |    4 ++--
>>  3 files changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/builtin/fetch.c b/builtin/fetch.c
>> index 33ad3aa..daa68d2 100644
>> --- a/builtin/fetch.c
>> +++ b/builtin/fetch.c
>> @@ -573,7 +573,7 @@ static void find_non_local_tags(struct transport *transport,
>>
>>       for_each_ref(add_existing, &existing_refs);
>>       for (ref = transport_get_remote_refs(transport); ref; ref = ref->next) {
>> -             if (prefixcmp(ref->name, "refs/tags"))
>> +             if (prefixcmp(ref->name, "refs/tags/"))
>>                       continue;
>>
>>               /*
>> diff --git a/builtin/remote.c b/builtin/remote.c
>> index 583eec9..f54a89a 100644
>> --- a/builtin/remote.c
>> +++ b/builtin/remote.c
>> @@ -534,7 +534,7 @@ static int add_branch_for_removal(const char *refname,
>>       }
>>
>>       /* don't delete non-remote-tracking refs */
>> -     if (prefixcmp(refname, "refs/remotes")) {
>> +     if (prefixcmp(refname, "refs/remotes/")) {
>>               /* advise user how to delete local branches */
>>               if (!prefixcmp(refname, "refs/heads/"))
>>                       string_list_append(branches->skipped,
>> diff --git a/log-tree.c b/log-tree.c
>> index 319bd31..535b905 100644
>> --- a/log-tree.c
>> +++ b/log-tree.c
>> @@ -119,9 +119,9 @@ static int add_ref_decoration(const char *refname, const unsigned char *sha1, in
>>               type = DECORATION_REF_REMOTE;
>>       else if (!prefixcmp(refname, "refs/tags/"))
>>               type = DECORATION_REF_TAG;
>> -     else if (!prefixcmp(refname, "refs/stash"))
>> +     else if (!strcmp(refname, "refs/stash"))
>>               type = DECORATION_REF_STASH;
>> -     else if (!prefixcmp(refname, "HEAD"))
>> +     else if (!strcmp(refname, "HEAD"))
>>               type = DECORATION_REF_HEAD;
>>
>>       if (!cb_data || *(int *)cb_data == DECORATE_SHORT_REFS)
-- 
Duy
Previous: Junio C HamanoNext: Michael Haggerty
Message 4 of 5 in “Fix incorrect ref namespace check”
  1. Fix incorrect ref namespace checkNguyễn Thái Ngọc Duy, Jan 5, 2012
  2. Fix incorrect ref namespace checkNguyễn Thái Ngọc Duy, Jan 5, 2012
  3. Junio C HamanoJan 5, 2012
  4. Nguyen Thai Ngoc DuyJan 11, 2012
  5. Michael HaggertyJan 11, 2012

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.