From: Jeff King <peff@peff.net>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
"André Laszlo" <andre@laszlo.nu>,
git@vger.kernel.org, "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>,
"René Scharfe" <l.s.r@web.de>,
"Johannes Schindelin" <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] pull: do not segfault when HEAD refers to missing object file
Date: Sun, 5 Mar 2017 22:51:52 -0500 [thread overview]
Message-ID: <20170306035152.c7bh5jiqrfncyudl@sigill.intra.peff.net> (raw)
In-Reply-To: <20170305235222.vxia7jw2n5uj2h2e@genre.crustytoothpaste.net>
On Sun, Mar 05, 2017 at 11:52:22PM +0000, brian m. carlson wrote:
> On Mon, Mar 06, 2017 at 12:42:22AM +0100, André Laszlo wrote:
> > +test_expect_success 'git pull --rebase with corrupt HEAD does not segfault' '
> > + mkdir corrupted &&
> > + (cd corrupted &&
> > + git init &&
> > + echo one >file && git add file &&
> > + git commit -m one &&
> > + REV=$(git rev-parse HEAD) &&
> > + rm -f .git/objects/${REV:0:2}/${REV:2} &&
>
> I think this is a bashism. On dash, I get the following:
>
> genre ok % dash -c 'foo=abcdefg; echo ${foo:0:2}; echo ${foo:2}'
> dash: 1: Bad substitution
Yeah, it is. You can do it easily with 'sed', of course, but if you want
to avoid the extra process and do it in pure shell, it's more like:
last38=${REV#??}
first2=${REV%$last38}
rm -f .git/objects/$first2/$last38
-Peff
next prev parent reply other threads:[~2017-03-06 3:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-05 23:42 [PATCH] pull: do not segfault when HEAD refers to missing object file André Laszlo
2017-03-05 23:52 ` brian m. carlson
2017-03-06 3:51 ` Jeff King [this message]
2017-03-06 6:52 ` Johannes Sixt
2017-03-06 7:33 ` Jeff King
2017-03-06 3:46 ` 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=20170306035152.c7bh5jiqrfncyudl@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=andre@laszlo.nu \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=l.s.r@web.de \
--cc=pclouds@gmail.com \
--cc=sandals@crustytoothpaste.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.
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).