merge-recursive: handle return values indicating errors

We are about to libify the recursive merge machinery, where we only
die() in case of a bug or memory contention. To that end, we must heed
negative return values as indicating errors.

This requires our functions to be careful to pass through error
conditions in call chains, and for quite a few functions this means
that they have to return values to begin with.

The next step will be to convert the places where we currently die() to
return negative values (read: -1) instead.

Note that we ignore errors reported by make_room_for_path(), consistent
with the previous behavior (update_file_flags() used the return value of
make_room_for_path() only to indicate an early return, but not a fatal
error): if the error is really a fatal error, we will notice later; If
not, it was not that serious a problem to begin with. (Witnesses in
favor of this reasoning are t4151-am-abort and t7610-mergetool, which
would start failing if we stopped on errors reported by
make_room_for_path()).

Also note: while this patch makes the code slightly less readable in
update_file_flags() (we introduce a new "goto free_buf;" instead of
an explicit "free(buf); return;"), it is a preparatory change for
the next patch where we will convert all of the die() calls in the same
function to go through the free_buf return path instead.

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

Git - fast, scalable, distributed revision control system

Git is a fast, scalable, distributed revision control system with an unusually rich command set that provides both high-level operations and full access to internals.

Git is an Open Source project covered by the GNU General Public License version 2 (some parts of it are under different licenses, compatible with the GPLv2). It was originally written by Linus Torvalds with help of a group of hackers around the net.

Please read the file INSTALL for installation instructions.

Many Git online resources are accessible from http://git-scm.com/ including full documentation and Git related tools.

See Documentation/gittutorial.txt to get started, then see Documentation/giteveryday.txt for a useful minimum set of commands, and Documentation/git-.txt for documentation of each command. If git has been correctly installed, then the tutorial can also be read with man gittutorial or git help tutorial, and the documentation of each command with man git-<commandname> or git help <commandname>.

CVS users may also want to read Documentation/gitcvs-migration.txt (man gitcvs-migration or git help cvs-migration if git is installed).

The user discussion and development of Git take place on the Git mailing list -- everyone is welcome to post bug reports, feature requests, comments and patches to git@vger.kernel.org (read Documentation/SubmittingPatches for instructions on patch submission). To subscribe to the list, send an email with just “subscribe git” in the body to majordomo@vger.kernel.org. The mailing list archives are available at http://news.gmane.org/gmane.comp.version-control.git/, http://marc.info/?l=git and other archival sites.

The maintainer frequently sends the “What's cooking” reports that list the current status of various development topics to the mailing list. The discussion following them give a good reference for project status, development direction and remaining tasks.

The name “git” was given by Linus Torvalds when he wrote the very first version. He described the tool as “the stupid content tracker” and the name as (depending on your mood):

  • random three-letter combination that is pronounceable, and not actually used by any common UNIX command. The fact that it is a mispronunciation of “get” may or may not be relevant.
  • stupid. contemptible and despicable. simple. Take your pick from the dictionary of slang.
  • “global information tracker”: you're in a good mood, and it actually works for you. Angels sing, and a light suddenly fills the room.
  • “goddamn idiotic truckload of sh*t”: when it breaks