Skip to contentSkip to conversation

git svn --use-log-author misbehavior?

DISCUSSION Mircea Bardac 3 participants 6 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hi,

According to the documentation, this parameter (--use-log-author) should
use the author from the From/Signed-off-by line. Unfortunately, I
found this to be working only on the first git svn clone. Later rebasing made the commits use the old username@uuid format.

I am assuming the option is not being preserved in the Git repository metadata and it is only used on cloning/init. Is this the intended behavior?

Many thanks.

Signature · 2 lines
Mircea
http://mircea.bardac.net
#1 lore raw
Quoted 10 lines · Mircea Bardac

Hi,

According to the documentation, this parameter (--use-log-author) should
use the author from the From/Signed-off-by line. Unfortunately, I
found this to be working only on the first git svn clone. Later rebasing made the commits use the old username@uuid format.

I am assuming the option is not being preserved in the Git repository metadata and it is only used on cloning/init. Is this the intended behavior?

Doesn't look like it. When you're using --add-author-from on dcommit, git-svn doesn't seem to know that it should look after "From:" in the commit, thus not setting the author correctly. The following oneliner should solve the case. Please let me know if it works as well for you as it did for me.

---
 git-svn.perl |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
git-svn.perl +3 -0
index a54979d..8f77b91 100755
@@ -432,6 +432,9 @@ sub cmd_dcommit {
 		     "without --no-rebase may be required."
 	}
 	while (1) {
+		if ($Git::SVN::_add_author_from) {
+			$Git::SVN::_use_log_author = 1;
+		}
 		my $d = shift @$linear_refs or last;
 		unless (defined $last_rev) {
 			(undef, $last_rev, undef) = cmt_metadata("$d~1");
Signature · 5 lines
1.5.6.6.gd3e97

-- 
Regards,
Fredrik Skolmli
#2 lore raw
Quoted 7 lines · Fredrik Skolmli
Quoted 6 lines · Mircea Bardac

Hi,

According to the documentation, this parameter (--use-log-author) should
use the author from the From/Signed-off-by line. Unfortunately, I
found this to be working only on the first git svn clone. Later rebasing made the commits use the old username@uuid format.

Quoted 6 lines
Quoted 1 line

I am assuming the option is not being preserved in the Git repository metadata and it is only used on cloning/init. Is this the intended behavior?

Doesn't look like it. When you're using --add-author-from on dcommit, git-svn doesn't seem to know that it should look after "From:" in the commit, thus not setting the author correctly. The following oneliner should solve the case. Please let me know if it works as well for you as it did for me.

I haven't tested this yet but I have a feeling this is not my case, or I might not be fully understanding the implications of "--add-author-from" on the functionality of "--use-log-author". Technically, they should be independent and the options should not depend on each other:
* --use-log-author only applies to getting info from the commits
* --add-author-from only applies to putting info in the commits

From the documentation, these 2 options can only be used with git svn init/clone so they should somehow be saved for future use. Maybe this doesn't happen.

My Git commits (not dcommits) already have "Signed-off-by:" at the end, added with "git commit -s". When I do a "git svn dcommit" they get pushed to SVN and the entire commit is rewritten. I have --add-author-from added on git clone, but nothing else is being added to the commit except the git-svn-id - from my point of view, according to the documentation, this is the correct behavior (since there already is a Signed-off-by line)

The problem is that, after the dcommit, when *viewing* the latest commits in the git-svn repository, even though they have "Signed-off-by:" in them, I see them not respecting the --use-log-author option, showing up as username@uuid. What I assume is that, after a dcommit (and everything being done on dcommit) the --use-log-author option is ignored.

Looking over the code, I see that make_log_entry (which is responsible for getting the correct format for the user/e-mail out of the commit message) is only being called in do_fetch and find_parent_branch. I am not sure if these are somehow called by cmd_dcommit.

Many thanks.

--
Mircea
http://mircea.bardac.net

#3 lore raw
Quoted 6 lines · Mircea Bardac

I haven't tested this yet but I have a feeling this is not my case, or I might not be fully understanding the implications of "--add-author-from" on the functionality of "--use-log-author". Technically, they should be independent and the options should not depend on each other:
* --use-log-author only applies to getting info from the commits
* --add-author-from only applies to putting info in the commits

They are independent.

Quoted 3 lines

From the documentation, these 2 options can only be used with git svn init/clone so they should somehow be saved for future use. Maybe this doesn't happen.

At least --use-log-author can be used on git svn fetch (and possibly other subcommands) as well.
And no, it currently is not being saved.

Signature · 4 lines
Sincerely,
           Stephen R. van den Berg.

Confidence is that feeling you have before you understand the situation.
#4 lore raw
In reply to Mircea Bardac
Quoted 11 lines · Mircea Bardac

I haven't tested this yet but I have a feeling this is not my case, or I might not be fully understanding the implications of "--add-author-from" on the functionality of "--use-log-author". Technically, they should be independent and the options should not depend on each other:
* --use-log-author only applies to getting info from the commits
* --add-author-from only applies to putting info in the commits

From the documentation, these 2 options can only be used with git svn init/clone so they should somehow be saved for future use. Maybe this doesn't happen.

Quoted 7 lines

My Git commits (not dcommits) already have "Signed-off-by:" at the end, added with "git commit -s". When I do a "git svn dcommit" they get pushed to SVN and the entire commit is rewritten. I have --add-author-from added on git clone, but nothing else is being added to the commit except the git-svn-id - from my point of view, according to the documentation, this is the correct behavior (since there already is a Signed-off-by line)

Did you mean "git svn clone" here, not "git clone"? And if --use-log-author is to be used to get retrieve info from the commits, it should be used instead of --add-author-from when doing a clone. (Which as far as I can see behaves correctly.)

However, looks like I might have misunderstood your problem, and possibly found a bug in the process. I'll look closer into it. :-)

Signature · 2 lines
Regards,
Fredrik Skolmli
#5 lore raw
Quoted 6 lines · Fredrik Skolmli
Quoted 3 lines · Mircea Bardac

My Git commits (not dcommits) already have "Signed-off-by:" at the end, added with "git commit -s". When I do a "git svn dcommit" they get pushed to SVN and the entire commit is rewritten. I have --add-author-from added on git clone, but nothing else is being added to
the commit except the git-svn-id - from my point of view, according to the documentation, this is the correct behavior (since there already is a Signed-off-by line)

Did you mean "git svn clone" here, not "git clone"?

Yes, I meant "git svn clone".

Quoted 4 lines

And if --use-log-author
is to be used to get retrieve info from the commits, it should be used instead of --add-author-from when doing a clone. (Which as far as I can see behaves correctly.)

That is right. I am using them like this, but according to Stephen's reply the --use-log-author option is not being saved. I assumed they were saved as an option of the git svn clone so that they would affect all future dcommits.

--
Mircea
http://mircea.bardac.net