git-svn producing "invalid author/committer line"
Hi,
We have an SVN repository with a number of projects in its /trunk. Different people have r/w-access to different subsets of these projects.
When I "git-svn fetch" this repo's trunk there will be some revisions that I don't have access to. In SVN log they show up as empty change-sets with unspecified author.
In the resulting git repo, git-fsck says "error in commit 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112: invalid author/committer line", and - as a consequence I guess - git-gc aborts.
$ git show 92cf6 commit 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112 Author: (no author) <(no author)@xxxx> Date: Thu Jan 1 00:00:00 1970 +0000
I tried to run "git filter-branch --prune-empty -- --all", to simply discard these empty commits, but the problem remains.
After some googling I found a possible work-around, using the --authors-file option of git-svn to map the "no author" into something less invalid, but I suppose that would require the list to contain every other committer as well?
Could I somehow make "git-svn fetch" skip these empty commits, corresponding to revisions that the SVN user doesn't have access to?
Cheers,
Esben
Quoted 12 lines · [email protected] wrote:
Hi,We have an SVN repository with a number of projects in its /trunk. Different people have r/w-access to different subsets of these projects.
When I "git-svn fetch" this repo's trunk there will be some revisions that I don't have access to. In SVN log they show up as empty change-sets with unspecified author.
In the resulting git repo, git-fsck says "error in commit92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112: invalid author/committer line", and - as a consequence I guess - git-gc aborts.
Quoted 4 lines
$ git show 92cf6 commit 92cf6ec3a55fbbfbf5aea7f0937e4b49470b9112 Author: (no author) <(no author)@xxxx> Date: Thu Jan 1 00:00:00 1970 +0000
Actually, it's not the author, but the date == 0 that fsck.c has an issue with. Proposed patch to {fsck,commit}.c coming.
Quoted 10 lines
I tried to run "git filter-branch --prune-empty -- --all", to simply discard these empty commits, but the problem remains.
After some googling I found a possible work-around, using the --authors-file option of git-svn to map the "no author" into something less invalid, but I suppose that would require the list to contain every other committer as well?
Could I somehow make "git-svn fetch" skip these empty commits, corresponding to revisions that the SVN user doesn't have access to?
You can pass '-r<begin>:<end>' in a way similar to "svn log" to skip commits:
git svn fetch -r5:200
Signature · 1 line
Eric Wong
PATCH 1/1 Allow the Unix epoch to be a valid commit date
It is common practice to use the Unix epoch as a fallback date when a suitable date is not available. This is true of git svn and possibly other importing tools that import non-git history into git.
Instead of clobbering established strtoul() error reporting semantics with our own, preserve the strtoul() error value of ULONG_MAX for fsck.c to handle.
--- commit.c | 6 +----- fsck.c | 2 +- 2 files changed, 2 insertions(+), 6 deletions(-)
commit.c +1 -5
@@ -50,7 +50,6 @@ struct commit *lookup_commit(const unsigned char *sha1)static unsigned long parse_commit_date (const char *buf,const char *tail) { -unsigned long date;const char *dateptr;if (buf +6 >= tail)
@@ -73,10 +72,7 @@ static unsigned long parse_commit_date(const char *buf, const char *tail)if (buf >= tail)return 0 ;/* dateptr < buf && buf[-1] == '\n', so strtoul will stop at buf-1 */ - date =strtoul (dateptr,NULL ,10 ); -if (date ==ULONG_MAX ) - date =0 ; -return date; +return strtoul (dateptr,NULL ,10 ); }static struct commit_graft **commit_graft;
fsck.c +1 -1
@@ -229,7 +229,7 @@ static int fsck_commit(struct commit *commit, fsck_error error_func)struct commit_graft *graft;int parents =0 ; -if (!commit->date) +if (commit->date ==ULONG_MAX )return error_func (&commit->object,FSCK_ERROR ,"invalid author/committer line" );if (memcmp (buffer,"tree " ,5 ))
Signature · 1 line
Eric Wong
Re: [PATCH] Allow the Unix epoch to be a valid commit date
Quoted 10 lines · Eric Wong
It is common practice to use the Unix epoch as a fallback date when a suitable date is not available. This is true of git svn and possibly other importing tools that import non-git history into git.
Instead of clobbering established
strtoul()error reporting semantics with our own, preserve thestrtoul()error value ofULONG_MAXforfsck.cto handle.Signed-off-by Eric Wong <[email protected]>
Makes sense. Will queue.
Thanks.