reflog-walk: always make HEAD@{0} show indexed selectors

When we are showing reflog selectors during a walk, we infer
from context whether the user wanted to see the index in
each selector, or the reflog date. The current rules are:

  1. if the user asked for an explicit date format in the
     output, show the date

  2. if the user asked for ref@{now}, show the date

  3. if neither is true, show the index

However,  if we see "ref@{0}", that should be a strong clue
that the user wants to see the counted version. In fact, it
should be much stronger than the date format in (1). The
user may have been setting the date format to use in another
part of the output (e.g., in --format="%gd (%ad)", they may
have wanted to influence the author date).

This patch flips the rules to:

  1. if the user asked for ref@{0}, always show the index

  2. if the user asked for ref@{now}, always show the date

  3. otherwise, we have just "ref"; show them counted by
     default, but respect the presence of "--date" as a clue
     that the user wanted them date-based

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2 files changed
tree: 37a4fb7019e2fad502b9b4d283809d440eea2365
  1. block-sha1/
  2. builtin/
  3. compat/
  4. contrib/
  5. Documentation/
  6. git-gui/
  7. git_remote_helpers/
  8. gitk-git/
  9. gitweb/
  10. mergetools/
  11. perl/
  12. po/
  13. ppc/
  14. t/
  15. templates/
  16. vcs-svn/
  17. xdiff/
  18. .gitattributes
  19. .gitignore
  20. .mailmap
  21. abspath.c
  22. aclocal.m4
  23. advice.c
  24. advice.h
  25. alias.c
  26. alloc.c
  27. archive-tar.c
  28. archive-zip.c
  29. archive.c
  30. archive.h
  31. argv-array.c
  32. argv-array.h
  33. attr.c
  34. attr.h
  35. base85.c
  36. bisect.c
  37. bisect.h
  38. blob.c
  39. blob.h
  40. branch.c
  41. branch.h
  42. builtin.h
  43. bundle.c
  44. bundle.h
  45. cache-tree.c
  46. cache-tree.h
  47. cache.h
  48. check-builtins.sh
  49. check-racy.c
  50. check_bindir
  51. color.c
  52. color.h
  53. combine-diff.c
  54. command-list.txt
  55. commit.c
  56. commit.h
  57. config.c
  58. config.mak.in
  59. configure.ac
  60. connect.c
  61. convert.c
  62. convert.h
  63. copy.c
  64. COPYING
  65. csum-file.c
  66. csum-file.h
  67. ctype.c
  68. daemon.c
  69. date.c
  70. decorate.c
  71. decorate.h
  72. delta.h
  73. diff-delta.c
  74. diff-lib.c
  75. diff-no-index.c
  76. diff.c
  77. diff.h
  78. diffcore-break.c
  79. diffcore-delta.c
  80. diffcore-order.c
  81. diffcore-pickaxe.c
  82. diffcore-rename.c
  83. diffcore.h
  84. dir.c
  85. dir.h
  86. editor.c
  87. entry.c
  88. environment.c
  89. exec_cmd.c
  90. exec_cmd.h
  91. fast-import.c
  92. fetch-pack.h
  93. fixup-builtins
  94. fsck.c
  95. fsck.h
  96. generate-cmdlist.sh
  97. gettext.c
  98. gettext.h
  99. git-add--interactive.perl
  100. git-am.sh
  101. git-archimport.perl
  102. git-bisect.sh
  103. git-compat-util.h
  104. git-cvsexportcommit.perl
  105. git-cvsimport.perl
  106. git-cvsserver.perl
  107. git-difftool--helper.sh
  108. git-difftool.perl
  109. git-filter-branch.sh
  110. git-instaweb.sh
  111. git-lost-found.sh
  112. git-merge-octopus.sh
  113. git-merge-one-file.sh
  114. git-merge-resolve.sh
  115. git-mergetool--lib.sh
  116. git-mergetool.sh
  117. git-parse-remote.sh
  118. git-pull.sh
  119. git-quiltimport.sh
  120. git-rebase--am.sh
  121. git-rebase--interactive.sh
  122. git-rebase--merge.sh
  123. git-rebase.sh
  124. git-relink.perl
  125. git-remote-testgit.py
  126. git-repack.sh
  127. git-request-pull.sh
  128. git-send-email.perl
  129. git-sh-i18n.sh
  130. git-sh-setup.sh
  131. git-stash.sh
  132. git-submodule.sh
  133. git-svn.perl
  134. GIT-VERSION-GEN
  135. git-web--browse.sh
  136. git.c
  137. git.spec.in
  138. graph.c
  139. graph.h
  140. grep.c
  141. grep.h
  142. hash.c
  143. hash.h
  144. help.c
  145. help.h
  146. hex.c
  147. http-backend.c
  148. http-fetch.c
  149. http-push.c
  150. http-walker.c
  151. http.c
  152. http.h
  153. ident.c
  154. imap-send.c
  155. INSTALL
  156. kwset.c
  157. kwset.h
  158. levenshtein.c
  159. levenshtein.h
  160. LGPL-2.1
  161. list-objects.c
  162. list-objects.h
  163. ll-merge.c
  164. ll-merge.h
  165. lockfile.c
  166. log-tree.c
  167. log-tree.h
  168. mailmap.c
  169. mailmap.h
  170. Makefile
  171. match-trees.c
  172. merge-file.c
  173. merge-file.h
  174. merge-recursive.c
  175. merge-recursive.h
  176. name-hash.c
  177. notes-cache.c
  178. notes-cache.h
  179. notes-merge.c
  180. notes-merge.h
  181. notes.c
  182. notes.h
  183. object.c
  184. object.h
  185. pack-check.c
  186. pack-refs.c
  187. pack-refs.h
  188. pack-revindex.c
  189. pack-revindex.h
  190. pack-write.c
  191. pack.h
  192. pager.c
  193. parse-options-cb.c
  194. parse-options.c
  195. parse-options.h
  196. patch-delta.c
  197. patch-ids.c
  198. patch-ids.h
  199. path.c
  200. pkt-line.c
  201. pkt-line.h
  202. preload-index.c
  203. pretty.c
  204. progress.c
  205. progress.h
  206. quote.c
  207. quote.h
  208. reachable.c
  209. reachable.h
  210. read-cache.c
  211. README
  212. reflog-walk.c
  213. reflog-walk.h
  214. refs.c
  215. refs.h
  216. remote-curl.c
  217. remote.c
  218. remote.h
  219. replace_object.c
  220. rerere.c
  221. rerere.h
  222. resolve-undo.c
  223. resolve-undo.h
  224. revision.c
  225. revision.h
  226. run-command.c
  227. run-command.h
  228. send-pack.h
  229. server-info.c
  230. setup.c
  231. sh-i18n--envsubst.c
  232. sha1-array.c
  233. sha1-array.h
  234. sha1-lookup.c
  235. sha1-lookup.h
  236. sha1_file.c
  237. sha1_name.c
  238. shallow.c
  239. shell.c
  240. shortlog.h
  241. show-index.c
  242. sideband.c
  243. sideband.h
  244. sigchain.c
  245. sigchain.h
  246. strbuf.c
  247. strbuf.h
  248. streaming.c
  249. streaming.h
  250. string-list.c
  251. string-list.h
  252. submodule.c
  253. submodule.h
  254. symlinks.c
  255. tag.c
  256. tag.h
  257. tar.h
  258. test-chmtime.c
  259. test-ctype.c
  260. test-date.c
  261. test-delta.c
  262. test-dump-cache-tree.c
  263. test-genrandom.c
  264. test-index-version.c
  265. test-line-buffer.c
  266. test-match-trees.c
  267. test-mktemp.c
  268. test-obj-pool.c
  269. test-parse-options.c
  270. test-path-utils.c
  271. test-run-command.c
  272. test-sha1.c
  273. test-sha1.sh
  274. test-sigchain.c
  275. test-string-pool.c
  276. test-subprocess.c
  277. test-svn-fe.c
  278. test-treap.c
  279. thread-utils.c
  280. thread-utils.h
  281. trace.c
  282. transport-helper.c
  283. transport.c
  284. transport.h
  285. tree-diff.c
  286. tree-walk.c
  287. tree-walk.h
  288. tree.c
  289. tree.h
  290. unimplemented.sh
  291. unpack-trees.c
  292. unpack-trees.h
  293. upload-pack.c
  294. url.c
  295. url.h
  296. usage.c
  297. userdiff.c
  298. userdiff.h
  299. utf8.c
  300. utf8.h
  301. walker.c
  302. walker.h
  303. wrap-for-bin.sh
  304. wrapper.c
  305. write_or_die.c
  306. ws.c
  307. wt-status.c
  308. wt-status.h
  309. xdiff-interface.c
  310. xdiff-interface.h
  311. zlib.c