git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] symbolic ref: refuse non-ref targets in HEAD
Date: Wed, 28 Jan 2009 23:53:20 -0800	[thread overview]
Message-ID: <7vljsuh7kf.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090129045205.GA31183@coredump.intra.peff.net> (Jeff King's message of "Wed, 28 Jan 2009 23:52:05 -0500")

Jeff King <peff@peff.net> writes:

> I know that using symbolic-ref manually is rare, but both I and the
> original poster have been bitten by this (and figuring out what is going
> on and fixing it is quite painful). But most importantly, I don't think
> this can possibly hurt anyone trying to use this legitimately, since the
> exact thing it is protecting against corrupts your repo. :)

I generally do not like adding artificial limitation to plumbing like this
patch does, because the end user making silly mistake using plumbing is a
sign that there was something lacking in the Porcelain.

But for this particular case, I do not think any future usage of
symbolic-ref plubming will get inconvenienced with the change.  I would
even suggest making the check tighter to insist on refs/heads/ (not just
refs/) and tighten validate_headref() in path.c to match.

> Please beware that running the test script on the current "master" will
> actually hose your git repo (test 3 kills the trash directory's
> .git/HEAD, which means test 4 thinks your parent .git/ is its current
> repo). Maybe it makes sense to do a precautionary reset in between.

In addition, perhaps it may make sense to use test_create_repo to go one
level deeper before starting to play around, so that trash directory's
repository will prevent you from going any further up.

  reply	other threads:[~2009-01-29  7:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-29  4:52 [PATCH] symbolic ref: refuse non-ref targets in HEAD Jeff King
2009-01-29  7:53 ` Junio C Hamano [this message]
2009-01-29  8:01   ` Jeff King
2009-01-29  8:30     ` [PATCH 1/2] validate_headref: tighten ref-matching to just branches Jeff King
2009-01-29  8:33     ` [PATCH 2/2] symbolic ref: refuse non-ref targets in HEAD Jeff King
2009-01-29  8:34     ` [PATCH] " Jeff King

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=7vljsuh7kf.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --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).