git-sh-setup: move the repository check to a core program.

Any core commands that use setup_git_directory() now check if
given GIT_DIR is really a valid repository, so the same check in
git-sh-setup can use it without reimplementing it in shell.
This commit changes git-sh-setup to use git-var command for
that, although any other commands would do.

Note that we export GIT_DIR explicitly when calling git-var;
without it, the caller of this script would use GIT_DIR that we
return (which is to assume ./.git unless the caller has it
elsewhere) while git-var would go up to find a .git directory in
our parent directories, which would be checking a different
directory from what our callers will be using.

Signed-off-by: Junio C Hamano <junkio@cox.net>
1 file changed
tree: 31b3c7eeb719c61a19922f3e8bf5abd46b49b5bb
  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-count-objects.sh
  69. git-cvsexportcommit.perl
  70. git-cvsimport.perl
  71. git-diff.sh
  72. git-fetch.sh
  73. git-fmt-merge-msg.perl
  74. git-format-patch.sh
  75. git-grep.sh
  76. git-log.sh
  77. git-lost-found.sh
  78. git-ls-remote.sh
  79. git-merge-octopus.sh
  80. git-merge-one-file.sh
  81. git-merge-ours.sh
  82. git-merge-recursive.py
  83. git-merge-resolve.sh
  84. git-merge-stupid.sh
  85. git-merge.sh
  86. git-mv.perl
  87. git-octopus.sh
  88. git-parse-remote.sh
  89. git-prune.sh
  90. git-pull.sh
  91. git-push.sh
  92. git-rebase.sh
  93. git-relink.perl
  94. git-repack.sh
  95. git-request-pull.sh
  96. git-reset.sh
  97. git-resolve.sh
  98. git-revert.sh
  99. git-send-email.perl
  100. git-sh-setup.sh
  101. git-shortlog.perl
  102. git-status.sh
  103. git-svnimport.perl
  104. git-tag.sh
  105. git-verify-tag.sh
  106. git-whatchanged.sh
  107. git.c
  108. git.spec.in
  109. gitk
  110. gitMergeCommon.py
  111. hash-object.c
  112. http-fetch.c
  113. http-push.c
  114. http.c
  115. http.h
  116. ident.c
  117. index-pack.c
  118. index.c
  119. init-db.c
  120. INSTALL
  121. local-fetch.c
  122. ls-files.c
  123. ls-tree.c
  124. mailinfo.c
  125. mailsplit.c
  126. Makefile
  127. merge-base.c
  128. merge-index.c
  129. mktag.c
  130. name-rev.c
  131. object.c
  132. object.h
  133. pack-check.c
  134. pack-objects.c
  135. pack-redundant.c
  136. pack.h
  137. patch-delta.c
  138. patch-id.c
  139. path.c
  140. peek-remote.c
  141. pkt-line.c
  142. pkt-line.h
  143. prune-packed.c
  144. quote.c
  145. quote.h
  146. read-cache.c
  147. read-tree.c
  148. README
  149. receive-pack.c
  150. refs.c
  151. refs.h
  152. repo-config.c
  153. rev-list.c
  154. rev-parse.c
  155. rsh.c
  156. rsh.h
  157. run-command.c
  158. run-command.h
  159. send-pack.c
  160. server-info.c
  161. setup.c
  162. sha1_file.c
  163. sha1_name.c
  164. shell.c
  165. show-branch.c
  166. show-index.c
  167. ssh-fetch.c
  168. ssh-pull.c
  169. ssh-push.c
  170. ssh-upload.c
  171. strbuf.c
  172. strbuf.h
  173. stripspace.c
  174. symbolic-ref.c
  175. tag.c
  176. tag.h
  177. tar-tree.c
  178. test-date.c
  179. test-delta.c
  180. tree-diff.c
  181. tree.c
  182. tree.h
  183. unpack-file.c
  184. unpack-objects.c
  185. update-index.c
  186. update-ref.c
  187. update-server-info.c
  188. upload-pack.c
  189. usage.c
  190. var.c
  191. verify-pack.c
  192. write-tree.c