threads / discuss / 13486

git-svn blame change- doc confusion

Subject: git-svn blame change- doc confusion

## tl;dr

2 messages between May 12, 2008 and May 12, 2008.

replies: 1people: 2as markdown or json

Dan McGee· May 12, 2008, 04:05 UTC · lore

Here is the commit snippet. Reading the commit message, I would assume the default format with no options is SVN, and you need to use the --git-format arg to get the GIT format.

Reading the new blame description seems to tell me the same thing.

However, reading the --git-format description tells me something real weird- that using --git-format will give me SVN revision numbers and not git hashes, and something about revision 0?

Can someone clarify this for me and let me know if I'm the crazy one?
-Dan
commit 4be403815321976bc2ee4c6677799abb06b153aa
Author: Steven Grimm <koreth@midwinter.com>
Date:   Sat May 10 22:11:18 2008 -0700
    Add svn-compatible "blame" output format to git-svn
    git-svn blame produced output in the format of git blame; in environments
    where there are scripts that read the output of svn blame, it's useful
    to be able to use them with the output of git-svn. The git-compatible
    format is still available using the new "--git-format" option.
    This also fixes a bug in the initial git-svn blame implementation; it was
    bombing out on uncommitted local changes.
    Signed-off-by: Steven Grimm <koreth@midwinter.com>
    Acked-by: Eric Wong <normalperson@yhbt.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt
index f4ba105..c6b56b4 100644
--- a/Documentation/git-svn.txt
+++ b/Documentation/git-svn.txt
@@ -166,11 +166,18 @@ environment). This command has the same behaviour.
 Any other arguments are passed directly to `git log'

 'blame'::
-       Show what revision and author last modified each line of a file. This is
-       identical to `git blame', but SVN revision numbers are shown
instead of git
-       commit hashes.
+       Show what revision and author last modified each line of a file. The
+       output of this mode is format-compatible with the output of
+       `svn blame' by default. Like the SVN blame command,
+       local uncommitted changes in the working copy are ignored;
+       the version of the file in the HEAD revision is annotated. Unknown
+       arguments are passed directly to git-blame.
 +
-All arguments are passed directly to `git blame'.
+--git-format;;
+       Produce output in the same format as `git blame', but with
+       SVN revision numbers instead of git commit hashes. In this mode,
+       changes that haven't been committed to SVN (including local
+       working-copy edits) are shown as revision 0.

 --
 'find-rev'::
Steven Grimm· May 12, 2008, 06:33 UTC · re: Dan McGee · lore

Re: git-svn blame change- doc confusion

On May 11, 2008, at 9:05 PM, Dan McGee wrote:
> Here is the commit snippet. Reading the commit message, I would assume
> the default format with no options is SVN, and you need to use the
> --git-format arg to get the GIT format.

Yes, that's right. But note that "git format" does not mean "identical to the output of git blame" -- it means "lines are formatted the same way they are in git blame," meaning the revision ID (which in this case is an svn version number or 0 for any lines for which there isn't history in svn) then the committer name and commit timestamp enclosed in parentheses, then the line number with a trailing closing paren, then the contents of the line.

The svn format, by contrast, is the svn commit number, then the committer name, then the contents of the line.

> However, reading the --git-format description tells me something real
> weird- that using --git-format will give me SVN revision numbers and
> not git hashes, and something about revision 0?

Yes, that's also right. If you want git hashes, just run "git blame", which will work exactly the same as in a non-svn-linked git repository -- the whole point of having "git svn blame" is to view changes in terms of svn revisions rather than git hashes.

-Steve

← back to recent threads