From: Johannes Sixt <j6t@kdbg.org>
To: "Jeff King" <peff@peff.net>, "André Laszlo" <andre@laszlo.nu>
Cc: "brian m. carlson" <sandals@crustytoothpaste.net>,
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: Mon, 6 Mar 2017 07:52:10 +0100 [thread overview]
Message-ID: <6726b36d-6f50-d258-12e3-8b7b56159631@kdbg.org> (raw)
In-Reply-To: <20170306035152.c7bh5jiqrfncyudl@sigill.intra.peff.net>
Am 06.03.2017 um 04:51 schrieb Jeff King:
> 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 &&
We usally indent this like so:
(
cd corrupted &&
echo one >file &&
git add file &&
...
) &&
>>> + 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
Is it "HEAD points to non-existent object" or ".git/HEAD contains junk"?
In both cases there are simpler solutions than to remove an object. For
example, `echo "$_x40" >.git/HEAD` or `echo "this is junk" >.git/HEAD`?
-- Hannes
next prev parent reply other threads:[~2017-03-06 6:57 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
2017-03-06 6:52 ` Johannes Sixt [this message]
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=6726b36d-6f50-d258-12e3-8b7b56159631@kdbg.org \
--to=j6t@kdbg.org \
--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=peff@peff.net \
--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).