git-svn authorship (was: Howdy + GIT)

I am surprised noone has

mentioned the one of the biggest

advantages of Git which is proper author attribution for
non-core and drive-by patch contributors.

From what I can make of the git-svn docs, that LLVM committers should

be adding a "From: <email>" field to commit messages instead of "Patch
by <name>". If the original author is already in the git commit, you
can generate the "From: <email>" field in the SVN commit message with:

    git svn --add-author-from --use-log-author dcommit

From the git-svn docs:

--use-log-author

When retrieving svn commits into Git (as part of fetch, rebase, or
dcommit operations), look for the first From: or Signed-off-by: line
in the log message and use that as the author string.

--add-author-from

When committing to svn from Git (as part of commit-diff, set-tree or
dcommit operations), if the existing log message doesn’t already have
a From: or Signed-off-by: line, append a From:line based on the Git
commit’s author string. If you use this, then --use-log-author will
retrieve a valid author string for all commits.

https://www.kernel.org/pub/software/scm/git/docs/git-svn.html

Thanks,
Greg

That is interesting. To be tested!

But as I said in my previous message, I think that would require the
committer has some specific access right on the svn server to override
the name that is normally got from the authentication protocol. This is
to be double-checked. But perhaps putting this kind of burden in the
git-svn syntax on the svn committers would motivate them to move to
git... :slight_smile:

But as I said in my previous message, I think that would require the
committer has some specific access right on the svn server to override
the name that is normally got from the authentication protocol

On the SVN side, it's just a convention in the commit message (From:
<arbitrary_text>). The SVN author is unchanged and becomes what Git
calls "committer". With '--use-log-author', git-svn then recognizes
SVN commits following that convention and uses that From text to set
the Author field in the Git commit.

I've been testing this stuff locally - works great! I sent an email
to llvm-admin to see if we can get '--use-log-author' added to the git
mirror's invocation of "git svn fetch". If that goes to plan, I'll
update "docs/GettingStarted.rst" to describe how to apply patches on
behalf of others, such that you don't git blamed.

-Greg

   > I am surprised noone has mentioned the one of the biggest
   > advantages of Git which is proper author attribution for
   > non-core and drive-by patch contributors.

   > From what I can make of the git-svn docs, that LLVM committers
   > be adding a "From: <email>" field to commit messages instead
   > of "Patch by <name>". If the original author is already in
   > the git commit, you can generate the "From: <email>" field in
   > the SVN commit message with:

   > git svn --add-author-from --use-log-author dcommit

   > From the git-svn docs:

   > --use-log-author

   > When retrieving svn commits into Git (as part of fetch,
   > rebase, or dcommit operations), look for the first From: or
   > Signed-off-by: line in the log message and use that as the
   > author string.

   > --add-author-from

   > When committing to svn from Git (as part of commit-diff,
   > set-tree or dcommit operations), if the existing log message
   > doesn’t already have a From: or Signed-off-by: line, append a
   > From:line based on the Git commit’s author string. If you use
   > this, then --use-log-author will retrieve a valid author
   > string for all commits.

   > git-svn(1)

That is interesting. To be tested!

But as I said in my previous message, I think that would require the
committer has some specific access right on the svn server to override
the name that is normally got from the authentication protocol. This is
to be double-checked.

When you do "git svn dcommit --add-author-from” the git commit is locally changed with the svn commiter as author of the git commit author, and the original author is added in the commit *description*. This is oblivious to svn.
Later when you import this SVN history into git, the --use-log-author tells git to reconstruct the commit author not from the svn author but by looking into the svn commit description, searching for the “From:” line that was added.

So, no need to have any specific access right :slight_smile:

For example, you can test it yourself now. I just committed r226360 this way, and locally before git svn commit I had:

commit 5a5c3976d8a856ba2294ad87c30ef91814092662
Author: Fiona Glaser <fglaser@apple.com>

I did some experimenting with this; I'm able to modify the log as recorded
in the git-svn clone, but not in the SVN repo that it was cloned from.

I'm not sure I see the value in a git-svn log that diverges from the SVN log.
--paulr