git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Junio C Hamano <gitster@pobox.com>
Cc: Jeff King <peff@peff.net>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Jonathan Watt <jwatt@jwatt.org>, Elijah Newren <newren@gmail.com>,
	git@vger.kernel.org
Subject: Auto detaching head options (update) (Re: Working copy revision and push pain)
Date: Sat, 29 Mar 2008 09:27:57 +0100	[thread overview]
Message-ID: <20080329082757.GA4920@efreet.light.src> (raw)
In-Reply-To: <7v3aqde2wn.fsf@gitster.siamese.dyndns.org>

Hello All,

Since the original proposal is not quoted here, I should repeat it:
On Tue, Mar 25, Jan Hudec wrote:
>     Also I believe that it would be very useful to have a ref defined "the
>     revision your work tree is derived from", be it HEAD or not. It would:
>      - make the behaviour of push to non-bare repository defined.
>      - make additional work trees for a repository (created by
>        contrib/workdir/git-new-workdir) safe (the mechanizm could than be an
>        option for submodules).

First of all, I should apologise for proposing to introduce something that
already exists. It's been resting in the reflog all the time.

Excluding push to non-bare repository and extra work trees, the local
branches are only ever updated through the HEAD. And as long as they are
updated with update-ref, it writes the value to the reflog, so HEAD^{0}
should always equal HEAD.

Therefore the option to prevent users shooting themselves in the foot when
using multiple worktrees for the same repository (the more useful case) or
pushing to a non-bare repo (which is usually just shooting oneselves in the
feet because of lack of knowledge) would be to introduce an option to commit
to verify, that rev-parse HEAD and rev-parse HEAD^{0} give the same revision.

That would have only one casuality -- currently to create a new parentless
commit in non-new repository, one has to modify the HEAD manually. But that
just needs a command-line override to disable the check for cases when one
knows what he's doing.

On Wed, Mar 26, 2008 at 11:49:44 -0700, Junio C Hamano wrote:
> Jeff King <peff@peff.net> writes:
> > FWIW, I also initially thought this was only a "HEAD" problem, but I
> > think Junio's recent argument makes a lot of sense: the problem is not
> > one of working tree and HEAD sync, nor even of detached versus ref HEAD.
> > The problem is that somebody is using the non-bare repository to do
> > stuff (why else would it be non-bare), and you are changing the state
> > behind their back.
> 
> For people who are overwhelmed by the volume of the list traffic, the
> relevant thread is:
> 
>   http://thread.gmane.org/gmane.comp.version-control.git/77955/focus=78062

Thanks for the pointer.

There are actually two use-cases for this. One is this pushing to non-bare
repo, which is indeed just shooting oneself in the foot out of lack of
knowledge most of the time. Though it would still be nice to ask user "do you
really want to shoot yourself in the foot?" if we can find out.

But the other usecase is using additional work trees
(contrib/workdir/git-new-workdir), which is rather useful for many people.
There it again does not make sense to commit to the same branch from two
work-trees, but it may easily happen by accident. Being able to check and
prevent such accidents would improve support for extra work-trees a lot,
maybe even to a point it could be made official.

> > Isn't this essentially the 'base' index extension that Junio did a
> > while back? It was eventually reverted (or perhaps never merged, I don't
> > recall).
> 
> It was in 'next' for a while but was reverted before it hit 'master':
> 
>   http://thread.gmane.org/gmane.comp.version-control.git/44360/focus=44508

Again, thanks for the pointer.

> > But maybe you are referencing it here:
> >
> >>    It would really be similar to the revision number in index proposal,
> >>    except less invasive and I actually believe there is a case (some form of
> >>    checkout or reset), where we want to read-tree, but not change this ref.
> >
> > I don't recall the reasons the base extension was not accepted, but I
> > think it would make sense to frame your argument as "this is like X;
> > people didn't like X for reason Y, but my proposal fixes this by..."
> 
> But if you take the position "work tree belongs to the repository owner
> and nobody has any business pushing into it sideways; push into acceptance
> branch and let the work tree owner merge it when able", the history of the
> failed index base experiment becomes irrelevant.

Ok. This proposal is indeed similar to the base-in-index one, but has some
significant differences. See below.

Besides whith the update above, I no longer propose to keep any new
information -- just to add a safety-check.

On 2007-04-15 19:56:55 GMT, Junio C Hamano wrote:
> [...]
> This is primarily because updating the branch tip is not tied
> closely to writing out a commit, and writing out a commit is not
> tied closely to writing out a tree (to be contained in that
> commit) out of the index.
> [...]

This is a big difference between the base-in-index and
base-somewhere-separately. The reflog is indeed tied to updating of the
branch tip, which is what we need here. It also does not add any new logic to
the low-level plumbing (read-tree, write-tree), that the base-in-index
proposal did.

For the BASE ref proposal, it would be equally tied to update of the branch
tip, except that all porcelain that does it would have to be changed, while
the reflog it already updates.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

  reply	other threads:[~2008-03-29  8:29 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-23 12:39 Working copy revision and push pain Jonathan Watt
2008-03-23 13:02 ` Johannes Schindelin
2008-03-23 13:19   ` Jonathan Watt
2008-03-23 13:45     ` Elijah Newren
2008-03-23 13:54       ` Jonathan Watt
2008-03-23 14:06         ` Elijah Newren
2008-03-23 14:22           ` Johannes Schindelin
2008-03-23 14:48             ` Jonathan Watt
2008-03-23 14:56               ` Johannes Schindelin
2008-03-23 15:25                 ` Jonathan Watt
2008-03-23 16:00                   ` Johannes Schindelin
2008-03-25 19:25                     ` Auto detaching head options (Re: Working copy revision and push pain) Jan Hudec
2008-03-25 19:58                       ` Johannes Schindelin
2008-03-25 23:24                       ` Jeff King
2008-03-26 18:49                         ` Junio C Hamano
2008-03-29  8:27                           ` Jan Hudec [this message]
2008-03-29  8:47                             ` Auto detaching head options (update) " Jeff King
2008-03-31  1:53                               ` Junio C Hamano
2008-03-31  1:59                                 ` Jeff King
2008-03-31  2:09                                   ` Jeff King
2008-03-23 19:48             ` Working copy revision and push pain Elijah Newren
2008-03-23 14:27           ` Jonathan Watt
2008-03-23 14:34             ` Johannes Schindelin
2008-03-23 16:20               ` Johan Herland
2008-03-23 17:24                 ` Jonathan Watt
2008-03-23 18:21                   ` Junio C Hamano
2008-03-23 19:42                     ` Junio C Hamano
2008-03-23 18:23                   ` Johannes Schindelin
2008-03-24 15:22                 ` Johannes Schindelin
2008-03-24 18:00                   ` Johan Herland
2008-03-23 14:11     ` Johannes Schindelin
2008-03-23 14:35       ` Jonathan Watt

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=20080329082757.GA4920@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jwatt@jwatt.org \
    --cc=newren@gmail.com \
    --cc=peff@peff.net \
    /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).