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

Re: [PATCH] refs: move REF_LOG_ONLY to refs-internal.h

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 8, 2020, 22:50 UTC
Message-ID
<xmqqo8mfx4qd.fsf@gitster.c.googlers.com>
In-Reply-To
<pull.712.git.1598628333959.gitgitgadget@gmail.com>
"Han-Wen Nienhuys via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 8 quoted lines
> From: Han-Wen Nienhuys <hanwen@google.com>
>
> REF_LOG_ONLY is used in the transaction preparation: if a symref is involved in
> a transaction, the referent of the symref should be updated, and the symref
> itself should only be updated in the reflog.
>
> Other ref backends will need to duplicate this logic too, so move it to a
> central place.

Hmph, I am not necessarily sure about "need to duplicate" [*1*], but I do agree with the patch text---the bit should not belong to a single "files-backend" backend.

[Footnote]
*1* obviously, a better alternative, if possible, would be to let
    the more generic layer do so without forcing the backends to
    duplicate.  But even if such a change were possible and we
    decide to avoid duplication, it does not make sense to have this
    bit specifically defined for the files-backend and nobody else.
Show 59 quoted lines
> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>
> ---
>     refs: move REF_LOG_ONLY to refs-internal.h
>     
>     REF_LOG_ONLY is used in the transaction preparation: if a symref is
>     involved in a transaction, the referent of the symref should be updated,
>     and the symref itself should only be updated in the reflog. 
>     
>     Other ref backends will need to duplicate this logic too, so move it to
>     a central place.
>     
>     Signed-off-by: Han-Wen Nienhuys hanwen@google.com [hanwen@google.com]
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-712%2Fhanwen%2Flog-only-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-712/hanwen/log-only-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/712
>
>  refs/files-backend.c | 7 -------
>  refs/refs-internal.h | 7 +++++++
>  2 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/refs/files-backend.c b/refs/files-backend.c
> index 985631f33e..b1946dc583 100644
> --- a/refs/files-backend.c
> +++ b/refs/files-backend.c
> @@ -38,13 +38,6 @@
>   */
>  #define REF_NEEDS_COMMIT (1 << 6)
>  
> -/*
> - * Used as a flag in ref_update::flags when we want to log a ref
> - * update but not actually perform it.  This is used when a symbolic
> - * ref update is split up.
> - */
> -#define REF_LOG_ONLY (1 << 7)
> -
>  /*
>   * Used as a flag in ref_update::flags when the ref_update was via an
>   * update to HEAD.
> diff --git a/refs/refs-internal.h b/refs/refs-internal.h
> index 357359a0be..1f92861aeb 100644
> --- a/refs/refs-internal.h
> +++ b/refs/refs-internal.h
> @@ -31,6 +31,13 @@ struct ref_transaction;
>   */
>  #define REF_HAVE_OLD (1 << 3)
>  
> +/*
> + * Used as a flag in ref_update::flags when we want to log a ref
> + * update but not actually perform it.  This is used when a symbolic
> + * ref update is split up.
> + */
> +#define REF_LOG_ONLY (1 << 7)
> +
>  /*
>   * Return the length of time to retry acquiring a loose reference lock
>   * before giving up, in milliseconds:
>
> base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9
Previous: Junio C HamanoNext: Han-Wen Nienhuys
Message 4 of 5 in “refs: move REF_LOG_ONLY to refs-internal.h”
  1. refs: move REF_LOG_ONLY to refs-internal.hHan-Wen Nienhuys via GitGitGadget, Aug 28, 2020
  2. Han-Wen NienhuysSep 8, 2020
  3. Junio C HamanoSep 8, 2020
  4. Junio C HamanoSep 8, 2020
  5. Han-Wen NienhuysSep 9, 2020

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.