- printf("reset %s\nfrom :%d\n\n", name,
- get_object_mark(&commit->object));
+
+ mark = get_object_mark(&commit->object);
+ if (!mark) {
+ /*
+ * Getting here means we have a commit which
+ * was excluded by a negative refspec (e.g.
+ * fast-export ^master master). If the user
+ * wants the branch exported but every commit
+ * in its history to be deleted, that sounds
+ * like a ref deletion to me.
+ */
+ printf("reset %s\nfrom %s\n\n",
+ name, oid_to_hex(&null_oid));
+ continue;
+ }
+
+ printf("reset %s\nfrom :%d\n\n", name, mark
+ );