Index: subversion/tests/cmdline/blame_tests.py
===================================================================
--- subversion/tests/cmdline/blame_tests.py	(revision 37651)
+++ subversion/tests/cmdline/blame_tests.py	(working copy)
@@ -546,6 +546,117 @@
                                      'blame', notexisting_url)
 
 
+def blame_output_after_merge(sbox):
+  "blame -g output with inserted lines"
+
+  sbox.build()
+
+  wc_dir = sbox.wc_dir
+  os.chdir(wc_dir)
+
+  # build a trunk and branches tree with at least one file ( using greek at the moment )
+  svntest.actions.run_and_verify_svn(None, ["\n","Committed revision 2.\n"], [],
+                                    'mv', "^/A", "--parents", "^/trunk/A", "-m", "move greek tree to trunk")
+
+  svntest.actions.run_and_verify_update('.', None, None, None)
+
+  # Create a multi line file in trunk
+  mu_path = os.path.join("trunk", "A", "mu")
+  new_content = "This is the file 'mu'.\n" \
+                "2nd line in file 'mu'.\n" \
+                "3rd line in file 'mu'.\n" \
+                "4th line in file 'mu'.\n" \
+                "5th line in file 'mu'.\n" \
+                "6th line in file 'mu'.\n"
+
+  svntest.main.file_write(mu_path,new_content)
+
+  expected_output = svntest.wc.State('.', {
+    'trunk/A/mu' : Item(verb='Sending'),
+    })
+  svntest.actions.run_and_verify_commit('.', expected_output,
+                                         None, None, '.')
+
+  # create branch that just has that one file in it
+  svntest.actions.run_and_verify_svn(None, ["\n","Committed revision 4.\n"], [],
+                                    'copy', "trunk/A", "--parents", "^/branches/A", "-m", "create branch")
+
+  svntest.actions.run_and_verify_update('.',None, None, None )
+
+  # modify single line in the branch
+  branch_mu_path = os.path.join("branches","A","mu")
+  svntest.main.file_write(branch_mu_path,
+                          "This is the file 'mu'.\n" \
+                          "2nd line in file 'mu'.\n" \
+                          "new 3rd line in file 'mu'.\n" \
+                          "4th line in file 'mu'.\n" \
+                          "5th line in file 'mu'.\n" \
+                          "6th line in file 'mu'.\n")
+
+  expected_output = svntest.wc.State('.', {
+    'branches/A/mu' : Item(verb='Sending'),
+    })
+
+  svntest.actions.run_and_verify_commit('.', expected_output,
+                                         None, None, '.')
+
+# Insert a single line in the branch
+  svntest.main.file_write(branch_mu_path,
+                          "This is the file 'mu'.\n" \
+                          "2nd line in file 'mu'.\n" \
+                          "new 3rd line in file 'mu'.\n" \
+                          "add 3.5 line in file 'mu'.\n" \
+                          "4th line in file 'mu'.\n" \
+                          "5th line in file 'mu'.\n" \
+                          "6th line in file 'mu'.\n")
+
+  expected_output = svntest.wc.State('.', {
+    'branches/A/mu' : Item(verb='Sending'),
+    })
+
+  svntest.actions.run_and_verify_commit('.', expected_output,
+                                         None, None, '.')
+
+  # merge the branch back to trunk
+  # the branch modifications at revision 5 & 6 show in the blame -g
+
+  svntest.actions.run_and_verify_svn('.', None, [], 'merge',
+                         '-r', '4:HEAD', '^/branches/A', 'trunk/A')
+
+  expected_output = svntest.wc.State('.', {
+    'trunk/A' : Item(verb='Sending'),
+    'trunk/A/mu' : Item(verb='Sending'),
+    })
+
+  svntest.actions.run_and_verify_commit('.', expected_output,
+                                         None, None, '.')
+
+  # Now test blame, first without the -g option
+
+  expected_output = [ "     3    jrandom This is the file 'mu'.\n",
+                      "     3    jrandom 2nd line in file 'mu'.\n",
+                      "     7    jrandom new 3rd line in file 'mu'.\n",
+                      "     7    jrandom add 3.5 line in file 'mu'.\n",
+                      "     3    jrandom 4th line in file 'mu'.\n",
+                      "     3    jrandom 5th line in file 'mu'.\n",
+                      "     3    jrandom 6th line in file 'mu'.\n"]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                    'blame',  mu_path)
+
+  # Next test with the -g option
+  expected_output = [ "       3    jrandom This is the file 'mu'.\n",
+                      "       3    jrandom 2nd line in file 'mu'.\n",
+                      "G      5    jrandom new 3rd line in file 'mu'.\n",
+                      "G      6    jrandom add 3.5 line in file 'mu'.\n",
+                      "       3    jrandom 4th line in file 'mu'.\n",
+                      "       3    jrandom 5th line in file 'mu'.\n",
+                      "       3    jrandom 6th line in file 'mu'.\n"]
+
+  svntest.actions.run_and_verify_svn(None, expected_output, [],
+                                    'blame', '-g', mu_path)
+
+
 ########################################################################
 # Run the tests
 
@@ -565,6 +676,7 @@
               SkipUnless(blame_merge_out_of_range, server_has_mergeinfo),
               blame_peg_rev_file_not_in_head,
               blame_file_not_in_head,
+              blame_output_after_merge,
              ]
 
 if __name__ == '__main__':
