From: Nguyễn Thái Ngọc Duy Date: Fri, 25 Jul 2014 10:43:55 GMT Subject: [PATCH 0/4] Consolidate ref parsing code Message-ID: <1406285039-22469-1-git-send-email-pclouds@gmail.com> On Thu, Jul 24, 2014 at 4:16 AM, Junio C Hamano wrote: > - .... three places now knows what a > textual symref looks like (i.e. begins with "ref:", zero or more > whitespaces, the target ref and then zero or more trailing > whitespaces). Perhaps we need to consolidate the code further, > so that this knowledge does not leak out of refs.c? I started on top of nd/multiple-work-trees but it conflicts badly with rs/ref-transaction-0 because this is basically code move. So I think we should make it a separate topic instead, based on latest 'master'. Junio, you still hit conflicts when merging this with nd/multiple-work-trees, but that's simpler to resolve (git_snpath -> strbuf_git_path). I promise to replace the "ref:" code in checkout.c later when both topics graduate. So.. first cut. The end result looks nice. Nguyễn Thái Ngọc Duy (4): strbuf.c: keep errno in strbuf_read_file() refs.c: refactor resolve_ref_unsafe() to use strbuf internally refs.c: move ref parsing code out of resolve_ref() refs.c: rewrite resolve_gitlink_ref() to use parse_ref() cache.h | 12 +++ refs.c | 332 ++++++++++++++++++++++++++++++++------------------------------- strbuf.c | 7 +- 3 files changed, 188 insertions(+), 163 deletions(-) -- 1.9.1.346.ga2b5940