-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
last-note sometimes points to a non existing mark #56
Comments
So I've found the initial issue: Git dies while parsing the marks file that contains the missing Git object, and after that, it truncates the marks file. This patch fixes the issue: --- a/fast-import.c
+++ b/fast-import.c
@@ -1855,8 +1855,10 @@ static void read_marks(void)
e = find_object(sha1);
if (!e) {
enum object_type type = sha1_object_info(sha1, NULL);
- if (type < 0)
- die("object not found: %s", sha1_to_hex(sha1));
+ if (type < 0) {
+ warning("object not found: %s", sha1_to_hex(sha1));
+ continue;
+ }
e = insert_object(sha1);
e->type = type;
e->pack_id = MAX_PACK_ID; |
Another issue is that my I've also updated it to detect missing Git objects. So in theory if you always run marks-check before doing a
|
I've sent the initial patch upstream. However, that's not going to be enough. |
Here's a hack that can be applied directly in --- a/git-remote-hg
+++ b/git-remote-hg
@@ -164,6 +164,16 @@ class Marks:
'last-note': self.last_note }
def store(self):
+ found = False
+ path = os.path.join(dirname, 'marks-git')
+ with open(path, "r") as f:
+ for line in f:
+ if line.startswith(':%u ' % self.last_note):
+ found = True
+ break
+ if not found:
+ warn("Last note note found")
+ self.last_note = None
json.dump(self.dict(), open(self.path, 'w'))
def __str__(self): |
Thanks for looking into this. Are you going to apply the above patch to git-remote-hg in case upstream takes a while to apply your fix? |
Probably not. I'm focusing on updating my own fork of Git, where everything should work fine. After that I will write test cases that exploit the corner cases we have found, and some of the checks of |
Sounds good. I'll patch my local copy of git-remote-hg for the time being, then. Thanks! |
Proposed by @felipec in felipec#56 (comment) to prevent a `git fast-import` crash from crashing git-remote-hg.
Ouch. This "fix" sets last_note to None, which is a sure fire way to reproduce issue #58 (wiping out the current notes hierarchy upon a subsequent fetch). The commits fixing that issue avoid the need for last_note altogether (and make git-remote-hg more independent of what may or may not be a problem in Git). |
Well there was one fix actually applied in Git v2.9. At least the test above doesn't fail for me any more. |
This is a continuation from issue #4.
Here's a script that reproduces the issue:
The text was updated successfully, but these errors were encountered: