update-index: allow --index-info to add higher stages.

The new merge world order tells the merge strategies to leave
the cache unmerged and store the automerge result in the working
tree if automerge is not clean.  This was done for the resolve
strategy and recursive strategy when no rename is involved, but
recording a conflicting merge in the rename case could not
easily be done by the recursive strategy.

This commit adds a new input format, in addition to the exsting
two, to "update-index --index-info".

    (1) mode         SP sha1          TAB path
    The first format is what "git-apply --index-info"
    reports, and used to reconstruct a partial tree
    that is used for phony merge base tree when falling
    back on 3-way merge.

    (2) mode SP type SP sha1          TAB path
    The second format is to stuff git-ls-tree output
    into the index file.

    (3) mode         SP sha1 SP stage TAB path
    This format is to put higher order stages into the
    index file and matches git-ls-files --stage output.

To place a higher stage entry to the index, the path should
first be removed by feeding a mode=0 entry for the path, and
then feeding necessary input lines in the (3) format.

For example, starting with this index:

$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 0       frotz

$ git update-index --index-info ;# interactive session -- input follows...

0 0000000000000000000000000000000000000000	frotz
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1	frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2	frotz

The first line of the input feeds 0 as the mode to remove the
path; the SHA1 does not matter as long as it is well formatted.
Then the second and third line feeds stage 1 and stage 2 entries
for that path.  After the above, we would end up with this:

$ git ls-files -s
100644 8a1218a1024a212bb3db30becd860315f9f3ac52 1	frotz
100755 8a1218a1024a212bb3db30becd860315f9f3ac52 2	frotz

This completes the groundwork for the new merge world order.

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