Re: git-stash segfaults ...
Pierre Habouzit, Mon, Aug 20, 2007 19:44:27 +0200:
Show 12 quoted lines
> When you don't use it from the root of the tree: I was in a subdir of
> my git tree, trying to do:
>
> git stash apply
>
> and I had:
>
> $ git stash apply
> error: missing object referenced by
> '0ca54c1fba7fea7dca8a1cc59bce2b2849f26d20' Segmentation fault
>
> going in the root of the repository (where .git is), all went fine.
Can't reproduce, but... There are places where the result of the function which gives this message (deref_tag from tag.c) is not checked for NULL and used. merge-recursive (used by git-stash) is one of them (and sha1_name is another).
Pierre, could you please try the patch below and see if the crash is replaced with a failure?
BTW, is there something unusual happening to that repo? Like manual object removing, or removal of repo your repo was cloned from, using something like "git clone -l -s", maybe?
diff --git a/merge-recursive.c b/merge-recursive.c
index 16f6a0f..464fc4e 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1701,6 +1701,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("Could not resolve ref '%s' down to object", ref);
if (object->type == OBJ_TREE)
return make_virtual_commit((struct tree*)object,
better_branch_name(ref));