git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Ben Olive <sionide21@gmail.com>,
	git@vger.kernel.org, Ben Walton <bdwalton@gmail.com>
Subject: Re: Super long branch names corrupt `.git/config`
Date: Thu, 4 Oct 2012 20:29:42 -0400	[thread overview]
Message-ID: <20121005002942.GB17586@sigill.intra.peff.net> (raw)
In-Reply-To: <7v391uyr2w.fsf@alter.siamese.dyndns.org>

On Thu, Oct 04, 2012 at 12:28:39PM -0700, Junio C Hamano wrote:

> Ben Olive <sionide21@gmail.com> writes:
> 
> > My `.git/config` can be corrupted if I try to get a local branch with
> > an extremely long name to track a remote branch.
> >
> > Here is a (contrived) example to reproduce the issue:
> 
> Don't do that, then ;-)
> 
> I think we have a change that is already cooking.
> 
> Ben (Walton), want to add a test for your 0971e99 (Remove the hard
> coded length limit on variable names in config files, 2012-09-30)
> before it hits 'next', perhaps?

I came up with this test earlier today when responding in this thread:

diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index be9672e..a32ecd9 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -454,6 +454,11 @@ test_expect_success \
     'checkout with --track, but without -b, fails with too short tracked name' '
     test_must_fail git checkout --track renamer'
 
+test_expect_success 'checkout tracking with long branch name' '
+	z200=$_z40$_z40$_z40$_z40$_z40
+	git checkout --track -b foo-$z200
+'
+
 setup_conflicting_index () {
 	rm -f .git/index &&
 	O=$(echo original | git hash-object -w --stdin) &&

but it feels a little fake. Why 200? Because that will test the config
limit, but will not overflow the NAME_MAX limit (at least not on
Linux! No clue on other platforms) when we try to create
refs/heads/foo-$z200.

So while this is a nice concrete user-visible impact of Ben's patch, I
think it is a little flaky to be testing. We should probably have a
straight config test in t1303, though.

-Peff

  reply	other threads:[~2012-10-05  0:29 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-04 17:15 Super long branch names corrupt `.git/config` Ben Olive
2012-10-04 18:29 ` Jeff King
2012-10-04 19:28 ` Junio C Hamano
2012-10-05  0:29   ` Jeff King [this message]
2012-10-05  0:36     ` Andrew Ardill
2012-10-05 15:38       ` 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

  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=20121005002942.GB17586@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=bdwalton@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sionide21@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.
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).