{"thread":{"id":"54151","subject":"[PATCH] refs: move REF_LOG_ONLY to refs-internal.h","startedAt":"2020-08-28T15:26:21Z","lastAt":"2020-09-09T09:36:02Z","messageCount":5,"participants":["Han-Wen Nienhuys via GitGitGadget","Han-Wen Nienhuys","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"404699","messageId":"pull.712.git.1598628333959.gitgitgadget@gmail.com","threadId":"54151","inReplyTo":null,"subject":"[PATCH] refs: move REF_LOG_ONLY to refs-internal.h","fromName":"Han-Wen Nienhuys via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-08-28T15:25:33Z","receivedAt":"2020-08-28T15:26:21Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"From: Han-Wen Nienhuys <hanwen@google.com>\n\nREF_LOG_ONLY is used in the transaction preparation: if a symref is involved in\na transaction, the referent of the symref should be updated, and the symref\nitself should only be updated in the reflog.\n\nOther ref backends will need to duplicate this logic too, so move it to a\ncentral place.\n\nSigned-off-by: Han-Wen Nienhuys <hanwen@google.com>\n---\n    refs: move REF_LOG_ONLY to refs-internal.h\n    \n    REF_LOG_ONLY is used in the transaction preparation: if a symref is\n    involved in a transaction, the referent of the symref should be updated,\n    and the symref itself should only be updated in the reflog. \n    \n    Other ref backends will need to duplicate this logic too, so move it to\n    a central place.\n    \n    Signed-off-by: Han-Wen Nienhuys hanwen@google.com [hanwen@google.com]\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-712%2Fhanwen%2Flog-only-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-712/hanwen/log-only-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/712\n\n refs/files-backend.c | 7 -------\n refs/refs-internal.h | 7 +++++++\n 2 files changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/refs/files-backend.c b/refs/files-backend.c\nindex 985631f33e..b1946dc583 100644\n--- a/refs/files-backend.c\n+++ b/refs/files-backend.c\n@@ -38,13 +38,6 @@\n  */\n #define REF_NEEDS_COMMIT (1 << 6)\n \n-/*\n- * Used as a flag in ref_update::flags when we want to log a ref\n- * update but not actually perform it.  This is used when a symbolic\n- * ref update is split up.\n- */\n-#define REF_LOG_ONLY (1 << 7)\n-\n /*\n  * Used as a flag in ref_update::flags when the ref_update was via an\n  * update to HEAD.\ndiff --git a/refs/refs-internal.h b/refs/refs-internal.h\nindex 357359a0be..1f92861aeb 100644\n--- a/refs/refs-internal.h\n+++ b/refs/refs-internal.h\n@@ -31,6 +31,13 @@ struct ref_transaction;\n  */\n #define REF_HAVE_OLD (1 << 3)\n \n+/*\n+ * Used as a flag in ref_update::flags when we want to log a ref\n+ * update but not actually perform it.  This is used when a symbolic\n+ * ref update is split up.\n+ */\n+#define REF_LOG_ONLY (1 << 7)\n+\n /*\n  * Return the length of time to retry acquiring a loose reference lock\n  * before giving up, in milliseconds:\n\nbase-commit: 675a4aaf3b226c0089108221b96559e0baae5de9\n-- \ngitgitgadget\n"},{"id":"405169","messageId":"CAFQ2z_MJ8nD3Z3m8P9HS4O6jbs7u3y5h8a6Nvy3Pa=d6s40=9g@mail.gmail.com","threadId":"54151","inReplyTo":"pull.712.git.1598628333959.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: move REF_LOG_ONLY to refs-internal.h","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2020-09-08T18:17:14Z","receivedAt":"2020-09-08T18:26:20Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Fri, Aug 28, 2020 at 5:25 PM Han-Wen Nienhuys via GitGitGadget\n<gitgitgadget@gmail.com> wrote:\n> REF_LOG_ONLY is used in the transaction preparation: if a symref is involved in\n> a transaction, the referent of the symref should be updated, and the symref\n> itself should only be updated in the reflog.\n\nJun, are you waiting for me to do anything with this patch?\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\nRegistergericht und -nummer: Hamburg, HRB 86891\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"},{"id":"405200","messageId":"xmqqimcox9nv.fsf@gitster.c.googlers.com","threadId":"54151","inReplyTo":"CAFQ2z_MJ8nD3Z3m8P9HS4O6jbs7u3y5h8a6Nvy3Pa=d6s40=9g@mail.gmail.com","subject":"Re: [PATCH] refs: move REF_LOG_ONLY to refs-internal.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-09-08T21:04:20Z","receivedAt":"2020-09-08T21:04:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Han-Wen Nienhuys <hanwen@google.com> writes:\n\n> On Fri, Aug 28, 2020 at 5:25 PM Han-Wen Nienhuys via GitGitGadget\n> <gitgitgadget@gmail.com> wrote:\n>> REF_LOG_ONLY is used in the transaction preparation: if a symref is involved in\n>> a transaction, the referent of the symref should be updated, and the symref\n>> itself should only be updated in the reflog.\n>\n> Jun, are you waiting for me to do anything with this patch?\n\nIf I said somthing, perhaps I am, but since I do not remember, it is\nlikely that the list traffic has exceeded my bandwidth and this\nslipped through the cracks, I think.\n\nThanks for pinging to keep the thread refreshed.  It helps.\n\n"},{"id":"405207","messageId":"xmqqo8mfx4qd.fsf@gitster.c.googlers.com","threadId":"54151","inReplyTo":"pull.712.git.1598628333959.gitgitgadget@gmail.com","subject":"Re: [PATCH] refs: move REF_LOG_ONLY to refs-internal.h","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-09-08T22:50:50Z","receivedAt":"2020-09-08T22:50:56Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Han-Wen Nienhuys via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: Han-Wen Nienhuys <hanwen@google.com>\n>\n> REF_LOG_ONLY is used in the transaction preparation: if a symref is involved in\n> a transaction, the referent of the symref should be updated, and the symref\n> itself should only be updated in the reflog.\n>\n> Other ref backends will need to duplicate this logic too, so move it to a\n> central place.\n\nHmph, I am not necessarily sure about \"need to duplicate\" [*1*], but\nI do agree with the patch text---the bit should not belong to a\nsingle \"files-backend\" backend.\n\n[Footnote]\n\n*1* obviously, a better alternative, if possible, would be to let\n    the more generic layer do so without forcing the backends to\n    duplicate.  But even if such a change were possible and we\n    decide to avoid duplication, it does not make sense to have this\n    bit specifically defined for the files-backend and nobody else.\n\n\n> Signed-off-by: Han-Wen Nienhuys <hanwen@google.com>\n> ---\n>     refs: move REF_LOG_ONLY to refs-internal.h\n>     \n>     REF_LOG_ONLY is used in the transaction preparation: if a symref is\n>     involved in a transaction, the referent of the symref should be updated,\n>     and the symref itself should only be updated in the reflog. \n>     \n>     Other ref backends will need to duplicate this logic too, so move it to\n>     a central place.\n>     \n>     Signed-off-by: Han-Wen Nienhuys hanwen@google.com [hanwen@google.com]\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-712%2Fhanwen%2Flog-only-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-712/hanwen/log-only-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/712\n>\n>  refs/files-backend.c | 7 -------\n>  refs/refs-internal.h | 7 +++++++\n>  2 files changed, 7 insertions(+), 7 deletions(-)\n>\n> diff --git a/refs/files-backend.c b/refs/files-backend.c\n> index 985631f33e..b1946dc583 100644\n> --- a/refs/files-backend.c\n> +++ b/refs/files-backend.c\n> @@ -38,13 +38,6 @@\n>   */\n>  #define REF_NEEDS_COMMIT (1 << 6)\n>  \n> -/*\n> - * Used as a flag in ref_update::flags when we want to log a ref\n> - * update but not actually perform it.  This is used when a symbolic\n> - * ref update is split up.\n> - */\n> -#define REF_LOG_ONLY (1 << 7)\n> -\n>  /*\n>   * Used as a flag in ref_update::flags when the ref_update was via an\n>   * update to HEAD.\n> diff --git a/refs/refs-internal.h b/refs/refs-internal.h\n> index 357359a0be..1f92861aeb 100644\n> --- a/refs/refs-internal.h\n> +++ b/refs/refs-internal.h\n> @@ -31,6 +31,13 @@ struct ref_transaction;\n>   */\n>  #define REF_HAVE_OLD (1 << 3)\n>  \n> +/*\n> + * Used as a flag in ref_update::flags when we want to log a ref\n> + * update but not actually perform it.  This is used when a symbolic\n> + * ref update is split up.\n> + */\n> +#define REF_LOG_ONLY (1 << 7)\n> +\n>  /*\n>   * Return the length of time to retry acquiring a loose reference lock\n>   * before giving up, in milliseconds:\n>\n> base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9\n"},{"id":"405236","messageId":"CAFQ2z_OYn6cC5SCgv-49pa9VQ2ZEhbeZ9aGn4e-C7tsnQ=qWow@mail.gmail.com","threadId":"54151","inReplyTo":"xmqqo8mfx4qd.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] refs: move REF_LOG_ONLY to refs-internal.h","fromName":"Han-Wen Nienhuys","fromEmail":"hanwen@google.com","sentAt":"2020-09-09T09:35:34Z","receivedAt":"2020-09-09T09:36:02Z","isPatch":true,"sender":{"key":"hanwen@google.com","avatar":"https://avatars.githubusercontent.com/u/31547?v=4"},"body":"On Wed, Sep 9, 2020 at 12:50 AM Junio C Hamano <gitster@pobox.com> wrote:\n> Hmph, I am not necessarily sure about \"need to duplicate\" [*1*], but\n> I do agree with the patch text---the bit should not belong to a\n> single \"files-backend\" backend.\n>\n> [Footnote]\n>\n> *1* obviously, a better alternative, if possible, would be to let\n>     the more generic layer do so without forcing the backends to\n>     duplicate.  But even if such a change were possible and we\n>     decide to avoid duplication, it does not make sense to have this\n>     bit specifically defined for the files-backend and nobody else.\n\nI'm not sure if it is possible. REFS_LOG_ONLY is used in the\nsplit_head_update() which is called from the middle of the\nfiles_transaction_prepare(). In particular, it can happen after a\nnumber of locks have already been taken. If this moves into the\ngeneric layer, the head split happens before the locks are taken,\nwhich could alter behavior.\n\n-- \nHan-Wen Nienhuys - Google Munich\nI work 80%. Don't expect answers from me on Fridays.\n--\n\nGoogle Germany GmbH, Erika-Mann-Strasse 33, 80636 Munich\n\nRegistergericht und -nummer: Hamburg, HRB 86891\n\nSitz der Gesellschaft: Hamburg\n\nGeschäftsführer: Paul Manicle, Halimah DeLaine Prado\n"}]}