git-mv: fixes for path handling

Moving a directory ending in a slash was not working as the
destination was not calculated correctly.
E.g. in the git repo,

 git-mv t/ Documentation

gave the error

 Error: destination 'Documentation' already exists

To get rid of this problem, strip trailing slashes from all arguments.
The comment in cg-mv made me curious about this issue; Pasky, thanks!
As result, the workaround in cg-mv is not needed any more.

Also, another bug was shown by cg-mv. When moving files outside of
a subdirectory, it typically calls git-mv with something like

 git-mv Documentation/git.txt Documentation/../git-mv.txt

which triggers the following error from git-update-index:

 Ignoring path Documentation/../git-mv.txt

The result is a moved file, removed from git revisioning, but not
added again. To fix this, the paths have to be normalized not have ".."
in the middle. This was already done in git-mv, but only for
a better visual appearance :(

Signed-off-by: Josef Weidendorfer <Josef.Weidendorfer@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
1 file changed
tree: 252aaf76a11eb038821874a30d4292a518ffdb8b
  1. .gitignore
  2. COPYING
  3. Documentation/
  4. GIT-VERSION-GEN
  5. INSTALL
  6. Makefile
  7. README
  8. apply.c
  9. arm/
  10. blob.c
  11. blob.h
  12. cache.h
  13. cat-file.c
  14. check-ref-format.c
  15. checkout-index.c
  16. clone-pack.c
  17. combine-diff.c
  18. commit-tree.c
  19. commit.c
  20. commit.h
  21. compat/
  22. config.c
  23. connect.c
  24. convert-objects.c
  25. copy.c
  26. count-delta.c
  27. count-delta.h
  28. csum-file.c
  29. csum-file.h
  30. ctype.c
  31. daemon.c
  32. date.c
  33. delta.h
  34. describe.c
  35. diff-delta.c
  36. diff-files.c
  37. diff-index.c
  38. diff-stages.c
  39. diff-tree.c
  40. diff.c
  41. diff.h
  42. diffcore-break.c
  43. diffcore-order.c
  44. diffcore-pathspec.c
  45. diffcore-pickaxe.c
  46. diffcore-rename.c
  47. diffcore.h
  48. entry.c
  49. environment.c
  50. epoch.c
  51. epoch.h
  52. exec_cmd.c
  53. exec_cmd.h
  54. fetch-clone.c
  55. fetch-pack.c
  56. fetch.c
  57. fetch.h
  58. fsck-objects.c
  59. get-tar-commit-id.c
  60. git-add.sh
  61. git-am.sh
  62. git-applymbox.sh
  63. git-applypatch.sh
  64. git-archimport.perl
  65. git-bisect.sh
  66. git-branch.sh
  67. git-checkout.sh
  68. git-cherry.sh
  69. git-clone.sh
  70. git-commit.sh
  71. git-compat-util.h
  72. git-count-objects.sh
  73. git-cvsexportcommit.perl
  74. git-cvsimport.perl
  75. git-diff.sh
  76. git-fetch.sh
  77. git-fmt-merge-msg.perl
  78. git-format-patch.sh
  79. git-grep.sh
  80. git-log.sh
  81. git-lost-found.sh
  82. git-ls-remote.sh
  83. git-merge-octopus.sh
  84. git-merge-one-file.sh
  85. git-merge-ours.sh
  86. git-merge-recursive.py
  87. git-merge-resolve.sh
  88. git-merge-stupid.sh
  89. git-merge.sh
  90. git-mv.perl
  91. git-parse-remote.sh
  92. git-prune.sh
  93. git-pull.sh
  94. git-push.sh
  95. git-rebase.sh
  96. git-relink.perl
  97. git-repack.sh
  98. git-request-pull.sh
  99. git-rerere.perl
  100. git-reset.sh
  101. git-resolve.sh
  102. git-revert.sh
  103. git-send-email.perl
  104. git-sh-setup.sh
  105. git-shortlog.perl
  106. git-svnimport.perl
  107. git-tag.sh
  108. git-verify-tag.sh
  109. git-whatchanged.sh
  110. git.c
  111. git.spec.in
  112. gitMergeCommon.py
  113. gitk
  114. hash-object.c
  115. http-fetch.c
  116. http-push.c
  117. http.c
  118. http.h
  119. ident.c
  120. index-pack.c
  121. index.c
  122. init-db.c
  123. local-fetch.c
  124. ls-files.c
  125. ls-tree.c
  126. mailinfo.c
  127. mailsplit.c
  128. merge-base.c
  129. merge-index.c
  130. mktag.c
  131. mozilla-sha1/
  132. name-rev.c
  133. object.c
  134. object.h
  135. pack-check.c
  136. pack-objects.c
  137. pack-redundant.c
  138. pack.h
  139. patch-delta.c
  140. patch-id.c
  141. path.c
  142. peek-remote.c
  143. pkt-line.c
  144. pkt-line.h
  145. ppc/
  146. prune-packed.c
  147. quote.c
  148. quote.h
  149. read-cache.c
  150. read-tree.c
  151. receive-pack.c
  152. refs.c
  153. refs.h
  154. repo-config.c
  155. rev-list.c
  156. rev-parse.c
  157. rsh.c
  158. rsh.h
  159. run-command.c
  160. run-command.h
  161. send-pack.c
  162. server-info.c
  163. setup.c
  164. sha1_file.c
  165. sha1_name.c
  166. shell.c
  167. show-branch.c
  168. show-index.c
  169. ssh-fetch.c
  170. ssh-pull.c
  171. ssh-push.c
  172. ssh-upload.c
  173. strbuf.c
  174. strbuf.h
  175. stripspace.c
  176. symbolic-ref.c
  177. t/
  178. tag.c
  179. tag.h
  180. tar-tree.c
  181. templates/
  182. test-date.c
  183. test-delta.c
  184. tree-diff.c
  185. tree.c
  186. tree.h
  187. unpack-file.c
  188. unpack-objects.c
  189. update-index.c
  190. update-ref.c
  191. update-server-info.c
  192. upload-pack.c
  193. usage.c
  194. var.c
  195. verify-pack.c
  196. write-tree.c