git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Christopher Lindee <christopher.lindee@webpros.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Cc: Christopher Lindee <christopher.lindee@webpros.com>
Subject: [PATCH 0/2] Optionally support push options on up-to-date branches
Date: Tue, 12 Mar 2024 21:55:08 +0000	[thread overview]
Message-ID: <SA1PR14MB4691B63C740F95D7D8A495628D2B2@SA1PR14MB4691.namprd14.prod.outlook.com> (raw)

Some Git servers can take actions on a branch using push options; to do this,
the branch ref must be passed along with the push options.  However, if the
branch is up-to-date, then Git submits push options without any refs, so the
server is not given a branch to act upon and the push options become no-ops.

This means a user who does the following

    $ git commit
    $ git push -o option remote branch  # Performs option

will have a very different experience from a user who does

    $ git commit
    $ git push remote branch
    $ git push -o option remote branch  # No-op

The latter could easily happen when a user forgets to add an appropriate option
on push, but could also happen intentionally when a user wants to back up their
changes to a remote and then later chooses to submit those changes with a push
option (e.g. one that creates a pull request) to the same remote.

To work around this issue, the user needs to re-write history between the two
push commands in some way, either through force pushing a temporary value to
the remote or by amending their commit to change the timestamp.  Either can
impact users who pull from the server, as well as automated systems triggered
by a post-receive hook.  With these potential side-effects, this workaround can
be a bad option in some setups.

This changeset proposes to address this issue by adding an option to `push` and
`send-pack` that, when specified, will send refs where the old-oid and new-oid
are identical - instead of silently skipping these refs.  The first commit
introduces the `--send-up-to-date` option to toggle this behavior, while the
second commit updates the commands to output an `(up-to-date)` notice for each
branch with an identical old-oid and new-oid.

Notably, the `--force` option will not send a ref when the remote is up-to-date.

Chris Lindee (2):
  Teach send-pack & push to --send-up-to-date refs
  Add transport message for up-to-date references

 Documentation/git-push.txt      | 8 +++++++-
 Documentation/git-send-pack.txt | 7 +++++++
 builtin/push.c                  | 1 +
 builtin/send-pack.c             | 4 ++++
 send-pack.c                     | 2 +-
 send-pack.h                     | 3 ++-
 transport-helper.c              | 7 ++++++-
 transport.c                     | 3 +++
 transport.h                     | 1 +
 9 files changed, 32 insertions(+), 4 deletions(-)
        

base-commit: 3c2a3fdc388747b9eaf4a4a4f2035c1c9ddb26d0
-- 
2.38.1

             reply	other threads:[~2024-03-12 21:55 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-12 21:55 Christopher Lindee [this message]
2024-03-13 22:58 ` [PATCH 0/2] Optionally support push options on up-to-date branches Junio C Hamano
2024-03-14 22:55   ` brian m. carlson
2024-03-14 23:29     ` Junio C Hamano
2024-03-15  0:04       ` Chris Torek
2024-03-15  0:57         ` brian m. carlson
2024-03-15  0:19       ` Christopher Lindee
2024-03-15 15:42         ` Junio C Hamano
2024-03-15  0:39       ` brian m. carlson
2024-03-15  8:58         ` Christopher Lindee
2024-03-15 20:29           ` brian m. carlson
2024-03-15  0:11     ` Christopher Lindee
2024-03-14 23:08   ` Christopher Lindee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=SA1PR14MB4691B63C740F95D7D8A495628D2B2@SA1PR14MB4691.namprd14.prod.outlook.com \
    --to=christopher.lindee@webpros.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).