[PATCH 0/7] Diff rename, manual correction, round 2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Git is amazing. It can detect file renames without you telling it. But
even the best fails sometimes. And when it fails, we have no way to
correct it. Not so amazing..

Round 1 was three years ago. The idea back then [1] was to let the
user say "rename this path to this path". Jeff quickly pointed out it
didn't help merge. And it should help merge to reduce merge conflicts.
For merge to take advantage of rename correction, the user needs to
spell out "rename this blob to this blob" instead. Then I went away
doing something and dropped it.

Round 2. I still want to keep "rename path to path", at least on the
user interface level. For git-merge, I do exactly what Jeff wrote back
then, traversing the whole notes tree to collect rename hints. But now
I cache the result, so while traversing is expensive, we don't have to
pay often.

The first two patches are preparation. Patch 3 adds --rename-file
where you can tell Git to "rename this path to that path" by writing a
file with lines like this

    this path => that path

I will need to support quoting, but that can come later. Patch 5 is
similar.

Patch 4 adds --rename-notes, where you can now store the above file in
a notes tree. The note will be used when its associate commit A is
diff'ed against A^.

Patch 6 introduces a new syntax to that file, "blob SHA-1 => SHA-1".
This is the basis for patch 7, where we traverse the whole notes tree,
convert all non-blob lines into blob ones. Then we simply tell
git-merge to use that as a rename instruction file.

Expect round 3 in 2019 (hopefully not)

[1] http://thread.gmane.org/gmane.comp.version-control.git/202654

Nguyễn Thái Ngọc Duy (7):
  diff-no-index: do not take a redundant prefix argument
  diff.c: take "prefix" argument in diff_opt_parse()
  diff: add --rename-file
  log: add --rename-notes to correct renames per commit
  merge: add --rename-file
  diffcore-rename: allow to say "rename this blob to that blob"
  merge: add --rename-notes

 Documentation/diff-options.txt   |   7 +++
 Documentation/pretty-options.txt |   5 ++
 builtin/am.c                     |   2 +-
 builtin/diff.c                   |   2 +-
 builtin/merge.c                  | 123 +++++++++++++++++++++++++++++++++++++++
 diff-no-index.c                  |   7 ++-
 diff.c                           |  13 ++++-
 diff.h                           |   5 +-
 diffcore-rename.c                | 104 ++++++++++++++++++++++++++++++++-
 log-tree.c                       |  32 ++++++++++
 merge-recursive.c                |   1 +
 merge-recursive.h                |   1 +
 revision.c                       |  12 +++-
 revision.h                       |   1 +
 t/t4001-diff-rename.sh           |  82 ++++++++++++++++++++++++++
 15 files changed, 386 insertions(+), 11 deletions(-)

-- 
2.7.0.125.g9eec362

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]