git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* ref-format checking regression
@ 2012-04-27 11:50 Jeff King
  2012-04-27 12:57 ` Ævar Arnfjörð Bjarmason
  2012-04-27 15:06 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Jeff King @ 2012-04-27 11:50 UTC (permalink / raw)
  To: Michael Haggerty; +Cc: Junio C Hamano, git

I upgraded git on a machine recently, and it created problems for a repo
with a bogus character in a ref name.  Older versions of git never
complained about it. Newer ones, containing your dce4bab ("add_ref():
verify that the refname is formatted correctly") do. That's fine; it's
bogus and git _should_ complain about it.

However, recovering from the situation is unnecessarily hard, as basic
things like fsck stop working, you can't access the ref via rev-parse,
etc. You can reproduce with something like this (in some repo with
actual commits):

  $ evil=$(printf 'foo\177bar')
  $ git rev-parse HEAD >".git/refs/tags/$evil"

  $ git fsck
  fatal: Reference has invalid format: 'refs/tags/foo^?bar'

  [does not even warn about the real reason for the error]
  $ git rev-parse --verify "$evil"
  fatal: Needed a single revision

  [does not let you find broken refs]
  $ git for-each-ref
  fatal: Reference has invalid format: 'refs/tags/foo^?bar'
  $ git tag -l
  fatal: Reference has invalid format: 'refs/tags/foo^?bar'

  [no way to rename or delete the bogus tag]
  $ git tag fixed "$evil"
  fatal: Failed to resolve 'foo^?bar' as a valid ref.

I seem to recall discussing this format-tightening and trying to be sure
that users were left with a way forward for fixing their repos. But I
can't find the discussion, and I don't recall any conclusion we came to.
So maybe we decided not to worry about it. But I thought I'd mention it
as a data point.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-28  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 11:50 ref-format checking regression Jeff King
2012-04-27 12:57 ` Ævar Arnfjörð Bjarmason
2012-04-27 15:06 ` Junio C Hamano
2012-04-27 15:25   ` Junio C Hamano
2012-04-28  9:24   ` Jeff King

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).