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

Re: [PATCH 3/7] send-pack.c: add --atomic command line argument

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Dec 22, 2014, 22:58 UTC
Message-ID
<CAPig+cQCLWy8rEqMCMxkvz+jAYwOA2tZE1LagkB5vY-60pe1mQ@mail.gmail.com>
In-Reply-To
<1419017941-7090-4-git-send-email-sbeller@google.com>
On Fri, Dec 19, 2014 at 2:38 PM, Stefan Beller <sbeller@google.com> wrote:
Show 39 quoted lines
> From: Ronnie Sahlberg <sahlberg@google.com>
>
> This adds support to send-pack to negotiate and use atomic pushes
> iff the server supports it. Atomic pushes are activated by a new command
> line flag --atomic.
>
> Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> diff --git a/builtin/send-pack.c b/builtin/send-pack.c
> index b564a77..b961e5a 100644
> --- a/builtin/send-pack.c
> +++ b/builtin/send-pack.c
> @@ -282,6 +282,30 @@ free_return:
>         return update_seen;
>  }
>
> +
> +static int atomic_push_failure(struct send_pack_args *args,
> +                              struct ref *remote_refs,
> +                              struct ref *failing_ref)
> +{
> +       struct ref *ref;
> +       /* Mark other refs as failed */
> +       for (ref = remote_refs; ref; ref = ref->next) {
> +               if (!ref->peer_ref && !args->send_mirror)
> +                       continue;
> +
> +               switch (ref->status) {
> +               case REF_STATUS_EXPECTING_REPORT:
> +                       ref->status = REF_STATUS_ATOMIC_PUSH_FAILED;
> +                       continue;
> +               default:
> +                       ; /* do nothing */
> +               }
> +       }
> +       error("atomic push failed for ref %s. status: %d\n",
> +             failing_ref->name, failing_ref->status);
> +       return -1;
Not itself worth a re-send, but if you do re-send for some other reason...
    return error(...);
would be more idiomatic (as mentioned in the previous review).
Show 5 quoted lines
> +}
> +
>  int send_pack(struct send_pack_args *args,
>               int fd[], struct child_process *conn,
>               struct ref *remote_refs,
Previous: Stefan BellerNext: Stefan Beller
Message 9 of 20 in “[PATCHv6 0/7] atomic pushes”
  1. Stefan BellerDec 19, 2014
  2. 1/7 receive-pack.c: add protocol support to negotiate atomic-pushStefan Beller, Dec 19, 2014
  3. Eric SunshineDec 22, 2014
  4. Stefan BellerDec 23, 2014
  5. Michael HaggertyDec 24, 2014
  6. Junio C HamanoDec 30, 2014
  7. 2/7 send-pack: Rename ref_update_to_be_sent to check_to_send_updateStefan Beller, Dec 19, 2014
  8. 3/7 send-pack.c: add --atomic command line argumentStefan Beller, Dec 19, 2014
  9. Eric SunshineDec 22, 2014
  10. 4/7 receive-pack.c: receive-pack.c: use a single ref_transaction for atomic pushesStefan Beller, Dec 19, 2014
  11. Eric SunshineDec 23, 2014
  12. 5/7 receive-pack: move execute_commands_non_atomic before execute_commandsStefan Beller, Dec 19, 2014
  13. Junio C HamanoDec 22, 2014
  14. Stefan BellerDec 24, 2014
  15. 6/7 push.c: add an --atomic argumentStefan Beller, Dec 19, 2014
  16. Michael HaggertyDec 26, 2014
  17. Stefan BellerDec 29, 2014
  18. Junio C HamanoDec 29, 2014
  19. 7/7 t5543-atomic-push.sh: add basic tests for atomic pushesStefan Beller, Dec 19, 2014
  20. Junio C HamanoDec 22, 2014

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.