Re: git stash apply segfaulting when called in subdir
- From
Jeff King <peff@peff.net>
- Date
- Jul 26, 2007, 05:07 UTC
- Message-ID
- <20070726050726.GC32617@coredump.intra.peff.net>
- In-Reply-To
- <7v1wewdsoz.fsf@assigned-by-dhcp.cox.net>
On Wed, Jul 25, 2007 at 03:28:12PM -0700, Junio C Hamano wrote:
Show 6 quoted lines
> > zeisberg@cassiopeia:/tmp/repo$ cd dir; git stash apply > > error: missing object referenced by '696146c2a44d7fc4d5ae4a71589c4c0d84f59789' > > /home/zeisberg/usr/bin/git-stash: line 111: 13618 Segmentation fault git-merge-recursive $b_tree -- $c_tree $w_tree > > This probably is a merge-recursive bug, but in the meantime, > I think this should fix it.
The merge-recursive bug is simply a failure to check for invalid input. Patch to at least print and die rather than segfault is below. Technically the error could be from a tag dereference, too, so maybe the error message should be more exact?
-- >8 -- merge-recursive: don't segfault on missing input objects
This should generally never happen, but it's nicer to report an error than to segfault.
Signed-off-by: Jeff King <peff@peff.net> --- merge-recursive.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c index c8539ec..2764e61 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1692,6 +1692,8 @@ static struct commit *get_ref(const char *ref) if (get_sha1(ref, sha1)) die("Could not resolve ref '%s'", ref); object = deref_tag(parse_object(sha1), ref, strlen(ref)); + if (!object) + die("Object does not exist: %s", ref); if (object->type == OBJ_TREE) return make_virtual_commit((struct tree*)object, better_branch_name(ref));
-- 1.5.3.rc3.818.gc1dc7-dirty