ls-remote: the --exit-code option reports "no matching refs"

The "git ls-remote" uses its exit status to indicate if it successfully
talked with the remote repository. A new option "--exit-code" makes the
command exit with status "2" when there is no refs to be listed, even when
the command successfully talked with the remote repository.

This way, the caller can tell if we failed to contact the remote, or the
remote did not have what we wanted to see. Of course, you can inspect the
output from the command, which has been and will continue to be a valid
way to check the same thing.

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