1

I have a file with the structure

<parent>
  <child name='abc'>
    <grandchild/>
    <grandchild/>
    <grandchild/>
  </child>
  <child name='xyz'>
    <grandchild/>
    <grandchild/>
    <grandchild/>
  </child>
  ....
<parent>

A while back we decided to reorder the file but the blocks remained intact.

I have tried using

git log -L1994,1996:myfile.xml 

this gave the following output which is close to what I am looking for the problem being I was after in the current commit is on lines 3784-3788

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml

@@ -1336,4 +1903,4 @@
-    <child name="zzxxyy" >
-      <grandChild >...</grandChild>
-      <grandChild >...</grandChild>
+    <child name="aabbcc" >
+      <grandChild attr='...'/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

commit ###
Author: fred

ABC-456 blah blah blah

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml
@@ -283,3 +283,4 @@
     <child name="zzxxyy" >
-      <grandChild attr="..."/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

commit ###
Author: fred

ABC-123 blah blah blah

diff --git a/myFile.xml b/myFile.xml
--- a/myFile.xml
+++ b/myFile.xml
@@ -249,0 +254,3 @@
+    <child name="zzxxyy" >
+      <grandChild attr="..."/>

I was hoping for it to track "aabbcc" back through the log.

e.g.

@@ -338,4 +1903,4 @@
-    <child name="aabbcc" >
-      <grandChild attr='...'/>
-      <grandChild >...</grandChild>
-      <grandChild >...</grandChild>
+    <child name="aabbcc" >
+      <grandChild attr='...'/>
+      <grandChild >...</grandChild>
+      <grandChild >...</grandChild>

But I expect that I am asking too much.

Using git version 2.12.2

BevynQ
  • 8,089
  • 4
  • 25
  • 37
  • Show your expected and actual outputs, and tell us WHY you think the output should be the way you show it. – Jim Garrison May 22 '18 at 03:18
  • Added a sanitised real world example is that enough? as to why questions like https://stackoverflow.com/questions/8435343/retrieve-the-commit-log-for-a-specific-line-in-a-file hint it may be possible. – BevynQ May 22 '18 at 03:57
  • What version of Git are you using? 2.11+? (as in https://stackoverflow.com/a/44400027/6309) – VonC May 22 '18 at 08:51
  • git version 2.12.2 – BevynQ May 22 '18 at 12:45
  • Do you still see the same issue (same git diff) with Git 2.17? – VonC May 22 '18 at 20:58
  • Yes same output. I think i am asking too much here and the reordering has confused log. – BevynQ May 22 '18 at 22:26

0 Answers0