From: lists@haller-berlin.de (Stefan Haller)
To: gitster@pobox.com (Junio C Hamano), git@vger.kernel.org (git)
Cc: avarab@gmail.com (Ævar Arnfjör? Bjarmason),
peff@peff.net (Jeff King),
matt@mattmccutchen.net (Matt McCutchen),
jacob.keller@gmail.com (Jacob Keller),
rappazzo@gmail.com (Mike Rappazzo),
f@mazzo.li (Francesco Mazzoli)
Subject: Re: [PATCH] push: disable lazy --force-with-lease by default
Date: Fri, 7 Jul 2017 11:24:15 +0200 [thread overview]
Message-ID: <1n8sh3u.1lsabkd1pislrwM%lists@haller-berlin.de> (raw)
In-Reply-To: <xmqq37a9fl8a.fsf_-_@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> wrote:
> It turns out that some people use third-party tools that fetch from
> remote and update the remote-tracking branches behind users' back,
> defeating the safety relying on the stability of the remote-tracking
> branches.
Third-party tools are not the only problem. They may make the problem
more likely to occur, but it can also happen without them. (See below.)
> Let's disable the form that relies on the stability of remote-tracking
> branches by default, and allow users who _know_ their remote-tracking
> branches are stable to enable it with a configuration variable.
I'm wondering if people who claim they know they are safe really do.
Elsewhere in the other thread somebody said "I only ever explicitly
fetch, so I know I'm safe". Are you sure?
Consider this example:
$ git checkout the-branch-i-am-collaborating-on-with-my-collegue
$ git pull # make sure I have their latest work
$ git rebase -i ... # do some history rewriting
# OK, so as we need to force-push anyway, let's take the opportunity and
# rebase onto the latest master:
$ git fetch # get latest master
$ git rebase origin/master
$ git push --force-with-lease
This is a very common thing to do at my workplace. And it's unsafe,
because the git fetch may move the remote-tracking branch of the branch
I'm working on.
To make this safe, I guess you'd have to replace "git fetch" with
something like
$ git fetch refs/heads/master:refs/remotes/origin/master
Personally I have never used this form of fetch myself, and I'd be
surprised if any of my coworkers even know it exists.
So know you could decide that _any_ fetch is unsafe, and never use it;
only use git pull. You are still not safe:
$ git checkout the-branch-i-am-collaborating-on-with-my-collegue
$ git pull
$ git rebase -i
# Now another collegue walks in and asks me to look at the regression
# they just introduced on some other branch, so I do
$ git checkout that-other-branch
$ git pull
$ <try to debug their problem>
$ <can't find it either, giving up, shrug>
# go back to what I was doing:
$ git checkout the-branch-i-am-collaborating-on-with-my-collegue
$ git push --force-with-lease
Again, the git pull may have moved the remote-tracking branch of the
branch that I want to force-push. Again, it could be solved by given an
explicit refspec to git pull, but few people ever do this in my
experience, and I certainly never want to.
What I'm getting at is that there's a lot of things that you have to
remember to not do in order to make --force-with-lease without parameter
a useful tool.
--
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/
next prev parent reply other threads:[~2017-07-07 9:32 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-08 2:15 Tools that do an automatic fetch defeat "git push --force-with-lease" Matt McCutchen
2017-04-08 7:24 ` Stefan Haller
2017-04-08 7:35 ` Ævar Arnfjörð Bjarmason
2017-04-08 9:29 ` Jeff King
2017-04-08 10:10 ` Jakub Narębski
2017-04-08 11:41 ` [PATCH] push: document & test --force-with-lease with multiple remotes Ævar Arnfjörð Bjarmason
2017-04-09 9:55 ` Simon Ruderich
2017-04-09 11:40 ` Ævar Arnfjörð Bjarmason
2017-04-17 3:56 ` Junio C Hamano
2017-04-19 9:22 ` [PATCH v2] " Ævar Arnfjörð Bjarmason
2017-04-08 21:54 ` Tools that do an automatic fetch defeat "git push --force-with-lease" Jacob Keller
2017-04-08 22:13 ` Jeff King
2017-04-08 22:21 ` Jacob Keller
2017-04-09 8:38 ` Stefan Haller
2017-04-09 8:49 ` Jacob Keller
2017-04-09 11:00 ` Stefan Haller
2017-04-10 8:08 ` Jacob Keller
2017-04-10 9:58 ` Ævar Arnfjörð Bjarmason
2017-04-10 23:33 ` Jacob Keller
2017-04-11 8:51 ` Junio C Hamano
2017-04-12 9:11 ` Stefan Haller
2017-07-06 18:56 ` [PATCH] push: disable lazy --force-with-lease by default Junio C Hamano
2017-07-06 19:38 ` Stefan Beller
2017-07-06 22:39 ` Junio C Hamano
2017-07-06 22:42 ` Stefan Beller
2017-07-10 22:32 ` Stefan Beller
2017-07-07 9:24 ` Stefan Haller [this message]
2017-07-07 9:42 ` Jeff King
2017-07-07 9:54 ` Ævar Arnfjörð Bjarmason
2017-07-07 15:15 ` Junio C Hamano
2017-07-15 10:45 ` Ævar Arnfjörð Bjarmason
2017-07-17 17:28 ` Junio C Hamano
2017-07-07 9:39 ` Ævar Arnfjörð Bjarmason
2017-04-11 12:37 ` Tools that do an automatic fetch defeat "git push --force-with-lease" Stefan Haller
2017-04-11 12:37 ` Stefan Haller
2017-04-10 18:31 ` Jeff King
2017-04-11 12:37 ` Stefan Haller
2017-04-11 12:50 ` Jeff King
2017-04-12 9:11 ` Stefan Haller
2017-04-09 8:38 ` Stefan Haller
2017-04-09 8:46 ` Jacob Keller
2017-04-08 8:25 ` Jacob Keller
2017-04-08 9:31 ` Jeff King
2017-04-08 15:03 ` Stefan Haller
2017-04-08 22:03 ` Jeff King
2017-04-08 15:03 ` Stefan Haller
2017-04-08 16:04 ` Ævar Arnfjörð Bjarmason
2017-04-08 17:28 ` Stefan Haller
2017-04-12 9:11 ` Stefan Haller
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1n8sh3u.1lsabkd1pislrwM%lists@haller-berlin.de \
--to=lists@haller-berlin.de \
--cc=avarab@gmail.com \
--cc=f@mazzo.li \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jacob.keller@gmail.com \
--cc=matt@mattmccutchen.net \
--cc=peff@peff.net \
--cc=rappazzo@gmail.com \
/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.
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 NNTP newsgroup(s).