{"thread":{"id":"20000","subject":"git-svn producing \"invalid author/committer line\"","startedAt":"2009-07-02T09:09:00Z","lastAt":"2009-07-05T19:27:47Z","messageCount":4,"participants":["esskov@oncable.dk","Eric Wong","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"117350","messageId":"sbqo45dgejpcnt58cam2tfkeon4is2v4ur@4ax.com","threadId":"20000","inReplyTo":null,"subject":"git-svn producing \"invalid author/committer line\"","fromName":"","fromEmail":"esskov@oncable.dk","sentAt":"2009-07-02T09:09:00Z","receivedAt":"2009-07-02T09:09:00Z","isPatch":false,"sender":{"key":"esskov@oncable.dk","avatar":null},"body":"\tHi,\n\nWe have an SVN repository with a number of projects in its /trunk.\nDifferent people have r/w-access to different subsets of these projects. \n\nWhen I \"git-svn fetch\" this repo's trunk there will be some revisions that\nI don't have access to. In SVN log they show up as empty change-sets with\nunspecified author. \nIn the resulting git repo, git-fsck says \"error in commit\n92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112: invalid author/committer line\",\nand - as a consequence I guess - git-gc aborts.\n\n$ git show 92cf6\ncommit 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112\nAuthor: (no author) <(no author)@xxxx>\nDate:   Thu Jan 1 00:00:00 1970 +0000\n\nI tried to run \"git filter-branch --prune-empty -- --all\", to simply\ndiscard these empty commits, but the problem remains. \n\nAfter some googling I found a possible work-around, using the\n--authors-file option of git-svn to map the \"no author\" into something\nless invalid, but I suppose that would require the list to contain every\nother committer as well?\n\nCould I somehow make \"git-svn fetch\" skip these empty commits,\ncorresponding to revisions that the SVN user doesn't have access to?\n\n\nCheers,\n\n\tEsben\n"},{"id":"117397","messageId":"20090703042846.GA14767@dcvr.yhbt.net","threadId":"20000","inReplyTo":"sbqo45dgejpcnt58cam2tfkeon4is2v4ur@4ax.com","subject":"Re: git-svn producing \"invalid author/committer line\"","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-07-03T04:28:46Z","receivedAt":"2009-07-03T04:28:46Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"esskov@oncable.dk wrote:\n> \tHi,\n> \n> We have an SVN repository with a number of projects in its /trunk.\n> Different people have r/w-access to different subsets of these projects. \n> \n> When I \"git-svn fetch\" this repo's trunk there will be some revisions that\n> I don't have access to. In SVN log they show up as empty change-sets with\n> unspecified author. \n> In the resulting git repo, git-fsck says \"error in commit\n> 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112: invalid author/committer line\",\n> and - as a consequence I guess - git-gc aborts.\n> \n> $ git show 92cf6\n> commit 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112\n> Author: (no author) <(no author)@xxxx>\n> Date:   Thu Jan 1 00:00:00 1970 +0000\n\nActually, it's not the author, but the date == 0 that fsck.c\nhas an issue with.  Proposed patch to {fsck,commit}.c coming.\n\n> I tried to run \"git filter-branch --prune-empty -- --all\", to simply\n> discard these empty commits, but the problem remains. \n> \n> After some googling I found a possible work-around, using the\n> --authors-file option of git-svn to map the \"no author\" into something\n> less invalid, but I suppose that would require the list to contain every\n> other committer as well?\n> \n> Could I somehow make \"git-svn fetch\" skip these empty commits,\n> corresponding to revisions that the SVN user doesn't have access to?\n\nYou can pass '-r<begin>:<end>' in a way similar to \"svn log\"\nto skip commits:\n\n  git svn fetch -r5:200\n\n-- \nEric Wong\n"},{"id":"117398","messageId":"20090703043454.GA20080@dcvr.yhbt.net","threadId":"20000","inReplyTo":"20090703042846.GA14767@dcvr.yhbt.net","subject":"[PATCH] Allow the Unix epoch to be a valid commit date","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2009-07-03T04:34:54Z","receivedAt":"2009-07-03T04:34:54Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"It is common practice to use the Unix epoch as a fallback date\nwhen a suitable date is not available.  This is true of git svn\nand possibly other importing tools that import non-git history\ninto git.\n\nInstead of clobbering established strtoul() error reporting\nsemantics with our own, preserve the strtoul() error value\nof ULONG_MAX for fsck.c to handle.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n commit.c |    6 +-----\n fsck.c   |    2 +-\n 2 files changed, 2 insertions(+), 6 deletions(-)\n\ndiff --git a/commit.c b/commit.c\nindex aa3b35b..a47fb4d 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -50,7 +50,6 @@ struct commit *lookup_commit(const unsigned char *sha1)\n \n static unsigned long parse_commit_date(const char *buf, const char *tail)\n {\n-\tunsigned long date;\n \tconst char *dateptr;\n \n \tif (buf + 6 >= tail)\n@@ -73,10 +72,7 @@ static unsigned long parse_commit_date(const char *buf, const char *tail)\n \tif (buf >= tail)\n \t\treturn 0;\n \t/* dateptr < buf && buf[-1] == '\\n', so strtoul will stop at buf-1 */\n-\tdate = strtoul(dateptr, NULL, 10);\n-\tif (date == ULONG_MAX)\n-\t\tdate = 0;\n-\treturn date;\n+\treturn strtoul(dateptr, NULL, 10);\n }\n \n static struct commit_graft **commit_graft;\ndiff --git a/fsck.c b/fsck.c\nindex 511b82c..89278c1 100644\n--- a/fsck.c\n+++ b/fsck.c\n@@ -229,7 +229,7 @@ static int fsck_commit(struct commit *commit, fsck_error error_func)\n \tstruct commit_graft *graft;\n \tint parents = 0;\n \n-\tif (!commit->date)\n+\tif (commit->date == ULONG_MAX)\n \t\treturn error_func(&commit->object, FSCK_ERROR, \"invalid author/committer line\");\n \n \tif (memcmp(buffer, \"tree \", 5))\n-- \nEric Wong\n"},{"id":"117470","messageId":"7vljn3hqvg.fsf@alter.siamese.dyndns.org","threadId":"20000","inReplyTo":"20090703043454.GA20080@dcvr.yhbt.net","subject":"Re: [PATCH] Allow the Unix epoch to be a valid commit date","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-07-05T19:27:47Z","receivedAt":"2009-07-05T19:27:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> It is common practice to use the Unix epoch as a fallback date\n> when a suitable date is not available.  This is true of git svn\n> and possibly other importing tools that import non-git history\n> into git.\n>\n> Instead of clobbering established strtoul() error reporting\n> semantics with our own, preserve the strtoul() error value\n> of ULONG_MAX for fsck.c to handle.\n>\n> Signed-off-by: Eric Wong <normalperson@yhbt.net>\n\nMakes sense.  Will queue.\n\nThanks.\n"}]}