Hi

So my motivation is to move an entire code block from one file to another. 
After reading up on it online I realized that versioning happens on file 
level only.

So I can rename a file using *git mv *so that the git versioning system 
realizes that only the *file-name/-location* has changed, but the contents 
haven't.
Wouldn't it be great if I could manually *label code blocks* inside a file 
and move them from one file to another file, so that the versioning system 
realizes that just the *code block location* has changed?

If I am not mistaken most files that are added to versioning systems 
contain programming-language specific code. 
That means the majority of versioned files could have *language-specific 
comments *added in order to depict the *begin & end of such code block 
labels*, right?

In essence the versioning system would not compare the whole content of 
files. Instead it would compare the location of code blocks relative to the 
location of other code blocks, identify added/removed code blocks and 
finally compare the contents of code blocks with the same label. Files 
could look like this (the tags represent begin/end of code blocks):
L0 <Root>
L1 <function a>
L2 </ function a>
L3 <function b>
L4 </ function b>
L5 </ Root>

L0 <Root>
L1 <function a>
L2 Some text
L3 </ function a>
L4 <function b>
L5 </ function b>
L6 </ Root>

The difference between first and second file would be identified as the 
difference between the code blocks with label "function a". As the relative 
line offset between end of "function a" and beginning of "function b" 
remains the same, the versioning system does not mark a change there.


So I am wondering if there were attempts to implement this or if there were 
implementation specific limitations or other stuff that I haven't 
considered yet.

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to