sort by:
Revision Author Date Message Commit Date
9c6be8b Merge branch 'ss/contrib-subtree-contacts' * ss/contrib-subtree-contacts: contacts: add a Makefile to generate docs and install subtree: add an install-html target 20 October 2014, 19:25:16 UTC
b946576 Merge branch 'jn/parse-config-slot' Code cleanup. * jn/parse-config-slot: color_parse: do not mention variable name in error message pass config slots as pointers instead of offsets 20 October 2014, 19:23:48 UTC
b67588d Merge branch 'rs/receive-pack-argv-leak-fix' * rs/receive-pack-argv-leak-fix: receive-pack: plug minor memory leak in unpack() 20 October 2014, 19:23:45 UTC
713ee7f Merge branch 'ta/config-set' * ta/config-set: t1308: fix broken here document in test script 20 October 2014, 19:23:43 UTC
f9a2fd3 Merge branch 'jk/test-shell-trace' Test scripts were taught to notice "-x" option to show shell trace, as if the tests were run under "sh -x". * jk/test-shell-trace: test-lib.sh: support -x option for shell-tracing t5304: use helper to report failure of "test foo = bar" t5304: use test_path_is_* instead of "test -f" 20 October 2014, 19:23:40 UTC
6459cf8 Merge branch 'bc/asciidoc' Formatting nitpicks to help a (pickier) reimplementation of AsciiDoc to grok our documentation. * bc/asciidoc: Documentation: fix mismatched delimiters in git-imap-send Documentation: adjust document title underlining 20 October 2014, 19:23:30 UTC
15c6ef7 Revert "archive: honor tar.umask even for pax headers" This reverts commit 10f343ea814f5c18a0913997904ee11cd9b7da24, whose output is no longer bit-for-bit equivalent from the older versions of Git, which the infrastructure to (pretend to) upload tarballs kernel.org uses depends on. 20 October 2014, 19:04:46 UTC
98349e5 Merge branch 'jc/completion-no-chdir' * jc/completion-no-chdir: completion: use "git -C $there" instead of (cd $there && git ...) 16 October 2014, 21:16:49 UTC
c11dc64 Merge branch 'bw/trace-no-inline-getnanotime' No file-scope static variables in an inlined function, please. * bw/trace-no-inline-getnanotime: trace.c: do not mark getnanotime() as "inline" 16 October 2014, 21:16:45 UTC
1cb3324 Merge branch 'po/everyday-doc' "git help everyday" to show the Everyday Git document. * po/everyday-doc: doc: add 'everyday' to 'git help' doc: Makefile regularise OBSOLETE_HTML list building doc: modernise everyday.txt wording and format in man page style 16 October 2014, 21:16:42 UTC
2ea40f0 contacts: add a Makefile to generate docs and install Also add a gitignore file for generated files. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 15 October 2014, 22:18:27 UTC
4d24d52 subtree: add an install-html target Also adjust ignore rules accordingly. Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 15 October 2014, 22:17:08 UTC
f6c5a29 color_parse: do not mention variable name in error message Originally the color-parsing function was used only for config variables. It made sense to pass the variable name so that the die() message could be something like: $ git -c color.branch.plain=bogus branch fatal: bad color value 'bogus' for variable 'color.branch.plain' These days we call it in other contexts, and the resulting error messages are a little confusing: $ git log --pretty='%C(bogus)' fatal: bad color value 'bogus' for variable '--pretty format' $ git config --get-color foo.bar bogus fatal: bad color value 'bogus' for variable 'command line' This patch teaches color_parse to complain only about the value, and then return an error code. Config callers can then propagate that up to the config parser, which mentions the variable name. Other callers can provide a custom message. After this patch these three cases now look like: $ git -c color.branch.plain=bogus branch error: invalid color value: bogus fatal: unable to parse 'color.branch.plain' from command-line config $ git log --pretty='%C(bogus)' error: invalid color value: bogus fatal: unable to parse --pretty format $ git config --get-color foo.bar bogus error: invalid color value: bogus fatal: unable to parse default color value Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 14 October 2014, 18:01:21 UTC
8852117 pass config slots as pointers instead of offsets Many config-parsing helpers, like parse_branch_color_slot, take the name of a config variable and an offset to the "slot" name (e.g., "color.branch.plain" is passed along with "13" to effectively pass "plain"). This is leftover from the time that these functions would die() on error, and would want the full variable name for error reporting. These days they do not use the full variable name at all. Passing a single pointer to the slot name is more natural, and lets us more easily adjust the callers to use skip_prefix to avoid manually writing offset numbers. This is effectively a continuation of 9e1a5eb, which did the same for parse_diff_color_slot. This patch covers all of the remaining similar constructs. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 14 October 2014, 18:01:05 UTC
670a3c1 Update draft release notes to 2.2 Signed-off-by: Junio C Hamano <gitster@pobox.com> 14 October 2014, 17:59:04 UTC
337233c Merge branch 'bc/asciidoc-pretty-formats-fix' * bc/asciidoc-pretty-formats-fix: Documentation: fix misrender of pretty-formats in Asciidoctor 14 October 2014, 17:50:21 UTC
0189df3 Merge branch 'rs/plug-leak-in-bundle' * rs/plug-leak-in-bundle: bundle: plug minor memory leak in is_tag_in_date_range() 14 October 2014, 17:50:10 UTC
145c590 Merge branch 'rs/more-uses-of-skip-prefix' * rs/more-uses-of-skip-prefix: use skip_prefix() to avoid more magic numbers 14 October 2014, 17:50:07 UTC
63434da Merge branch 'rs/mailsplit' * rs/mailsplit: mailsplit: remove unnecessary unlink(2) call 14 October 2014, 17:50:02 UTC
40e2d8d Merge branch 'rs/sha1-array-test' * rs/sha1-array-test: sha1-lookup: handle duplicates in sha1_pos() sha1-array: add test-sha1-array and basic tests 14 October 2014, 17:49:56 UTC
11cb313 Merge branch 'mh/lockfile-stdio' * mh/lockfile-stdio: commit_packed_refs(): reimplement using fdopen_lock_file() dump_marks(): reimplement using fdopen_lock_file() fdopen_lock_file(): access a lockfile using stdio 14 October 2014, 17:49:52 UTC
bd107e1 Merge branch 'mh/lockfile' The lockfile API and its users have been cleaned up. * mh/lockfile: (38 commits) lockfile.h: extract new header file for the functions in lockfile.c hold_locked_index(): move from lockfile.c to read-cache.c hold_lock_file_for_append(): restore errno before returning get_locked_file_path(): new function lockfile.c: rename static functions lockfile: rename LOCK_NODEREF to LOCK_NO_DEREF commit_lock_file_to(): refactor a helper out of commit_lock_file() trim_last_path_component(): replace last_path_elm() resolve_symlink(): take a strbuf parameter resolve_symlink(): use a strbuf for internal scratch space lockfile: change lock_file::filename into a strbuf commit_lock_file(): use a strbuf to manage temporary space try_merge_strategy(): use a statically-allocated lock_file object try_merge_strategy(): remove redundant lock_file allocation struct lock_file: declare some fields volatile lockfile: avoid transitory invalid states git_config_set_multivar_in_file(): avoid call to rollback_lock_file() dump_marks(): remove a redundant call to rollback_lock_file() api-lockfile: document edge cases commit_lock_file(): rollback lock file on failure to rename ... 14 October 2014, 17:49:45 UTC
7543dea Merge branch 'sk/tag-contains-wo-recursion' * sk/tag-contains-wo-recursion: t7004: give the test a bit more stack space 14 October 2014, 17:49:41 UTC
cc7b2f8 Merge branch 'da/completion-show-signature' * da/completion-show-signature: completion: add --show-signature for log and show 14 October 2014, 17:49:36 UTC
dc11fc2 Merge branch 'rs/daemon-fixes' "git daemon" (with NO_IPV6 build configuration) used to incorrectly use the hostname even when gethostbyname() reported that the given hostname is not found. * rs/daemon-fixes: daemon: remove write-only variable maxfd daemon: fix error message after bind() daemon: handle gethostbyname() error 14 October 2014, 17:49:23 UTC
e2ebb5c Merge branch 'dt/cache-tree-repair' This fixes a topic that has graduated to 'master'. * dt/cache-tree-repair: t0090: avoid passing empty string to printf %d 14 October 2014, 17:49:12 UTC
792a572 Merge branch 'so/rebase-doc-fork-point' * so/rebase-doc-fork-point: Documentation/git-rebase.txt: document when --fork-point is auto-enabled 14 October 2014, 17:49:07 UTC
211836f Merge branch 'da/include-compat-util-first-in-c' Code clean-up. * da/include-compat-util-first-in-c: cleanups: ensure that git-compat-util.h is included first 14 October 2014, 17:49:01 UTC
a136f6d test-lib.sh: support -x option for shell-tracing Usually running a test under "-v" makes it clear which command is failing. However, sometimes it can be useful to also see a complete trace of the shell commands being run in the test. You can do so without any support from the test suite by running "sh -x tXXXX-foo.sh". However, this produces quite a large bit of output, as we see a trace of the entire test suite. This patch instead introduces a "-x" option to the test scripts (i.e., "./tXXXX-foo.sh -x"). When enabled, this turns on "set -x" only for the tests themselves. This can still be a bit verbose, but should keep things to a more manageable level. You can even use "--verbose-only" to see the trace only for a specific test. The implementation is a little invasive. We turn on the "set -x" inside the "eval" of the test code. This lets the eval itself avoid being reported in the trace (which would be long, and redundant with the verbose listing we already showed). And then after the eval runs, we do some trickery with stderr to avoid showing the "set +x" to the user. We also show traces for test_cleanup functions (since they can impact the test outcome, too). However, we do avoid running the noop ":" cleanup (the default if the test does not use test_cleanup at all), as it creates unnecessary noise in the "set -x" output. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 22:39:57 UTC
dc05179 t1308: fix broken here document in test script Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 22:25:42 UTC
f8a48af Documentation: fix mismatched delimiters in git-imap-send The documentation for git-imap-send uses block delimiters with mismatched lengths, which Asciidoctor doesn't support. As a result, the page is misrendered. Adjust the delimiters so that they are of the same length. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 20:35:37 UTC
c9a5172 Documentation: adjust document title underlining AsciiDoc specification states that in two-line titles, the title underline has to be the same length as the title text, plus or minus two characters. Asciidoctor, however, requires that this must be plus or minus one character. Adjust the underlines to be the same length as the title text to improve compatibility. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 20:35:18 UTC
64a7e92 receive-pack: plug minor memory leak in unpack() The argv_array used in unpack() is never freed. Instead of adding explicit calls to argv_array_clear() use the args member of struct child_process and let run_command() and friends clean up for us. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 18:50:20 UTC
8ad1652 t5304: use helper to report failure of "test foo = bar" For small outputs, we sometimes use: test "$(some_cmd)" = "something we expect" instead of a full test_cmp. The downside of this is that when it fails, there is no output at all from the script. Let's introduce a small helper to make tests easier to debug. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 18:27:40 UTC
f1dd90b t5304: use test_path_is_* instead of "test -f" This is slightly more robust (checking "! test -f" would not notice a directory of the same name, though that is not likely to happen here). It also makes debugging easier, as the test script will output a message on failure. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 13 October 2014, 18:27:07 UTC
673151a doc: add 'everyday' to 'git help' The "Everyday GIT With 20 Commands Or So" is not accessible via the Git help system. Move everyday.txt to giteveryday.txt so that "git help everyday" works, and create a new placeholder file everyday.html to refer people who follow existing URLs to the updated location. giteveryday.txt now formats well with AsciiDoc as a man page and refreshed content to a more command modern style. Add 'everyday' to the help --guides list and update git(1) and 5 other links to giteveryday. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> 10 October 2014, 23:02:26 UTC
5a568ea doc: Makefile regularise OBSOLETE_HTML list building Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> 10 October 2014, 22:59:41 UTC
992cb20 doc: modernise everyday.txt wording and format in man page style Refresh the contents of everyday.txt contents to a more modern command style. Also update the mark-up so that it can be formatted as a man page with AsciiDoc ready for transfer to the Git guides. The transfer is in subsequent commits. Guidance on modernising the command style provided by Junio at [1], [2] and [3]. [1] Individual Developer, both Standalone and Participant http://article.gmane.org/gmane.comp.version-control.git/254269 [2] Integrator http://article.gmane.org/gmane.comp.version-control.git/254502 [3] Administrator http://article.gmane.org/gmane.comp.version-control.git/254824 Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com> 10 October 2014, 22:59:40 UTC
fca416a completion: use "git -C $there" instead of (cd $there && git ...) We have had "git -C $there" to first go to a different directory and run a Git command without changing the arguments for quite some time. Use it instead of (cd $there && git ...) in the completion script. This allows us to lose the work-around for misfeatures of modern interactive-minded shells that make "cd" unusable in scripts (e.g. end users' $CDPATH taking us to unexpected places in any POSIX shell, and chpwd functions spewing unwanted output in zsh). Based on Øystein Walle's idea, which was raised during the discussion on the solution by Brandon Turner for a problem zsh users had with RVM which mucks with chpwd_functions in users' environments (https://github.com/wayneeseguin/rvm/issues/3076). As $root variable, which is used to direct where to chdir to, is set to "." based on if $2 to __git_index_files is set (not if it is empty), the only caller of the function is fixed not to pass the optional $2 when it does not want us to switch to a different directory. Otherwise we would end up doing "git -C '' command...", which would not work. Maybe we would want "git -C '' command..." to mean "do not chdir anywhere", but that is a spearate topic. Signed-off-by: Junio C Hamano <gitster@pobox.com> 09 October 2014, 22:06:08 UTC
c30c43c Documentation: fix misrender of pretty-formats in Asciidoctor Neither the AsciiDoc nor the Asciidoctor documentation specify whether the same number of delimiter characters must be used to end a block as to begin it, although both sets of documentation show exactly matching pairs. AsciiDoc allows mismatches, but AsciiDoctor apparently does not. Adjust the pretty formats documentation to use matching pairs to prevent a misrendering where the remainder of the document was rendered as a listing block. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 08 October 2014, 20:51:46 UTC
63a4513 Update draft release notes to 2.2 Signed-off-by: Junio C Hamano <gitster@pobox.com> 08 October 2014, 20:08:55 UTC
f0d8900 Merge branch 'sp/stream-clean-filter' When running a required clean filter, we do not have to mmap the original before feeding the filter. Instead, stream the file contents directly to the filter and process its output. * sp/stream-clean-filter: sha1_file: don't convert off_t to size_t too early to avoid potential die() convert: stream from fd to required clean filter to reduce used address space copy_fd(): do not close the input file descriptor mmap_limit: introduce GIT_MMAP_LIMIT to allow testing expected mmap size memory_limit: use git_env_ulong() to parse GIT_ALLOC_LIMIT config.c: add git_env_ulong() to parse environment variable convert: drop arguments other than 'path' from would_convert_to_git() 08 October 2014, 20:05:32 UTC
9342f49 Merge branch 'bw/use-write-script-in-tests' * bw/use-write-script-in-tests: t/lib-credential: use write_script 08 October 2014, 20:05:29 UTC
b2c45f5 Merge branch 'nd/archive-pathspec' "git archive" learned to filter what gets archived with pathspec. * nd/archive-pathspec: archive: support filtering paths with glob 08 October 2014, 20:05:26 UTC
fb06b52 Merge branch 'jc/push-cert' Allow "git push" request to be signed, so that it can be verified and audited, using the GPG signature of the person who pushed, that the tips of branches at a public repository really point the commits the pusher wanted to, without having to "trust" the server. * jc/push-cert: (24 commits) receive-pack::hmac_sha1(): copy the entire SHA-1 hash out signed push: allow stale nonce in stateless mode signed push: teach smart-HTTP to pass "git push --signed" around signed push: fortify against replay attacks signed push: add "pushee" header to push certificate signed push: remove duplicated protocol info send-pack: send feature request on push-cert packet receive-pack: GPG-validate push certificates push: the beginning of "git push --signed" pack-protocol doc: typofix for PKT-LINE gpg-interface: move parse_signature() to where it should be gpg-interface: move parse_gpg_output() to where it should be send-pack: clarify that cmds_sent is a boolean send-pack: refactor inspecting and resetting status and sending commands send-pack: rename "new_refs" to "need_pack_data" receive-pack: factor out capability string generation send-pack: factor out capability string generation send-pack: always send capabilities send-pack: refactor decision to send update per ref send-pack: move REF_STATUS_REJECT_NODELETE logic a bit higher ... 08 October 2014, 20:05:25 UTC
325602c Sync with maint * maint: git-tag.txt: Add a missing hyphen to `-s` 07 October 2014, 20:41:03 UTC
3c2dc76 Merge branch 'maint-2.0' into maint * maint-2.0: git-tag.txt: Add a missing hyphen to `-s` 07 October 2014, 20:40:51 UTC
76f8611 Merge branch 'maint-1.9' into maint-2.0 * maint-1.9: git-tag.txt: Add a missing hyphen to `-s` 07 October 2014, 20:40:39 UTC
9181365 Merge branch 'maint-1.8.5' into maint-1.9 * maint-1.8.5: git-tag.txt: Add a missing hyphen to `-s` 07 October 2014, 20:40:19 UTC
b6e8269 Merge branch 'jk/mbox-from-line' into maint Some MUAs mangled a line in a message that begins with "From " to ">From " when writing to a mailbox file and feeding such an input to "git am" used to lose such a line. * jk/mbox-from-line: mailinfo: work around -Wstring-plus-int warning mailinfo: make ">From" in-body header check more robust 07 October 2014, 20:39:27 UTC
2ca0b19 completion: add --show-signature for log and show Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 07 October 2014, 19:00:48 UTC
e3f1da9 use skip_prefix() to avoid more magic numbers Continue where ae021d87 (use skip_prefix to avoid magic numbers) left off and use skip_prefix() in more places for determining the lengths of prefix strings to avoid using dependent constants and other indirect methods. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> 07 October 2014, 18:09:16 UTC
eeff891 git-tag.txt: Add a missing hyphen to `-s` Signed-off-by: Wieland Hoffmann <themineo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 07 October 2014, 18:08:06 UTC
db78794 mailsplit: remove unnecessary unlink(2) call The output file hasn't been created at this point, yet, so there is no need to delete it when exiting early. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Rene Scharfe <l.s.r@web.de> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 07 October 2014, 17:49:57 UTC
6404594 bundle: plug minor memory leak in is_tag_in_date_range() Free the buffer returned by read_sha1_file() even if no valid tagger line is found. Signed-off-by: Rene Scharfe <l.s.r@web.de> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 07 October 2014, 17:48:09 UTC
6e578a3 commit_packed_refs(): reimplement using fdopen_lock_file() Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 21:20:25 UTC
f70f056 dump_marks(): reimplement using fdopen_lock_file() Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 21:20:22 UTC
013870c fdopen_lock_file(): access a lockfile using stdio Add a new function, fdopen_lock_file(), which returns a FILE pointer open to the lockfile. If a stream is open on a lock_file object, it is closed using fclose() on commit, rollback, or close_lock_file(). This change will allow callers to use stdio to write to a lockfile without having to muck around in the internal representation of the lock_file object (callers will be rewritten in upcoming commits). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 21:08:10 UTC
697cc8e lockfile.h: extract new header file for the functions in lockfile.c Move the interface declaration for the functions in lockfile.c from cache.h to a new file, lockfile.h. Add #includes where necessary (and remove some redundant includes of cache.h by files that already include builtin.h). Move the documentation of the lock_file state diagram from lockfile.c to the new header file. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:56:14 UTC
216aab1 hold_locked_index(): move from lockfile.c to read-cache.c lockfile.c contains the general API for locking any file. Code specifically about the index file doesn't belong here. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:54:31 UTC
4d423a3 hold_lock_file_for_append(): restore errno before returning Callers who don't pass LOCK_DIE_ON_ERROR might want to examine errno to see what went wrong, so restore errno before returning. In fact this function only has one caller, add_to_alternates_file(), and it *does* use LOCK_DIE_ON_ERROR, but, you know, think of future generations. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:53:54 UTC
ec38b4e get_locked_file_path(): new function Add a function to return the path of the file that is locked by a lock_file object. This reduces the knowledge that callers have to have about the lock_file layout. Suggested-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:53:54 UTC
316683b lockfile.c: rename static functions * remove_lock_file() -> remove_lock_files() * remove_lock_file_on_signal() -> remove_lock_files_on_signal() Suggested-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:53:53 UTC
47ba466 lockfile: rename LOCK_NODEREF to LOCK_NO_DEREF This makes it harder to misread the name as LOCK_NODE_REF. Suggested-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:53:28 UTC
751bace commit_lock_file_to(): refactor a helper out of commit_lock_file() commit_locked_index(), when writing to an alternate index file, duplicates (poorly) the code in commit_lock_file(). And anyway, it shouldn't have to know so much about the internal workings of lockfile objects. So extract a new function commit_lock_file_to() that does the work common to the two functions, and call it from both commit_lock_file() and commit_locked_index(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:52:06 UTC
0c0d6e8 trim_last_path_component(): replace last_path_elm() Rewrite last_path_elm() to take a strbuf parameter and to trim off the last path name element in place rather than returning a pointer to the beginning of the last path name element. This simplifies the function a bit and makes it integrate better with its caller, which is now also strbuf-based. Rename the function accordingly and a bit less tersely. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:51:30 UTC
6cad805 resolve_symlink(): take a strbuf parameter Change resolve_symlink() to take a strbuf rather than a string as parameter. This simplifies the code and removes an arbitrary pathname length restriction. It also means that lock_file's filename field no longer needs to be initialized to a large size. Helped-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:51:29 UTC
5025d84 resolve_symlink(): use a strbuf for internal scratch space Aside from shortening and simplifying the code, this removes another place where the path name length is arbitrarily limited. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:51:29 UTC
cf6950d lockfile: change lock_file::filename into a strbuf For now, we still make sure to allocate at least PATH_MAX characters for the strbuf because resolve_symlink() doesn't know how to expand the space for its return value. (That will be fixed in a moment.) Another alternative would be to just use a strbuf as scratch space in lock_file() but then store a pointer to the naked string in struct lock_file. But lock_file objects are often reused. By reusing the same strbuf, we can avoid having to reallocate the string most times when a lock_file object is reused. Helped-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:50:01 UTC
3e88e8f commit_lock_file(): use a strbuf to manage temporary space Avoid relying on the filename length restrictions that are currently checked by lock_file(). Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:49:01 UTC
daccee3 try_merge_strategy(): use a statically-allocated lock_file object Even the one lockfile object needn't be allocated each time the function is called. Instead, define one statically-allocated lock_file object and reuse it for every call. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:49:01 UTC
1fef4b5 try_merge_strategy(): remove redundant lock_file allocation By the time the "if" block is entered, the lock_file instance from the main function block is no longer in use, so re-use that one instead of allocating a second one. Note that the "lock" variable in the "if" block shadowed the "lock" variable at function scope, so the only change needed is to remove the inner definition. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:49:00 UTC
2091c50 struct lock_file: declare some fields volatile The function remove_lock_file_on_signal() is used as a signal handler. It is not realistic to make the signal handler conform strictly to the C standard, which is very restrictive about what a signal handler is allowed to do. But let's increase the likelihood that it will work: The lock_file_list global variable and several fields from struct lock_file are used by the signal handler. Declare those values "volatile" to (1) force the main process to write the values to RAM promptly, and (2) prevent updates to these fields from being reordered in a way that leaves an opportunity for a jump to the signal handler while the object is in an inconsistent state. We don't mark the filename field volatile because that would prevent the use of strcpy(), and it is anyway unlikely that a compiler re-orders a strcpy() call across other expressions. So in practice it should be possible to get away without "volatile" in the "filename" case. Suggested-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:49:00 UTC
707103f lockfile: avoid transitory invalid states Because remove_lock_file() can be called any time by the signal handler, it is important that any lock_file objects that are in the lock_file_list are always in a valid state. And since lock_file objects are often reused (but are never removed from lock_file_list), that means we have to be careful whenever mutating a lock_file object to always keep it in a well-defined state. This was formerly not the case, because part of the state was encoded by setting lk->filename to the empty string vs. a valid filename. It is wrong to assume that this string can be updated atomically; for example, even strcpy(lk->filename, value) is unsafe. But the old code was even more reckless; for example, strcpy(lk->filename, path); if (!(flags & LOCK_NODEREF)) resolve_symlink(lk->filename, max_path_len); strcat(lk->filename, ".lock"); During the call to resolve_symlink(), lk->filename contained the name of the file that was being locked, not the name of the lockfile. If a signal were raised during that interval, then the signal handler would have deleted the valuable file! We could probably continue to use the filename field to encode the state by being careful to write characters 1..N-1 of the filename first, and then overwrite the NUL at filename[0] with the first character of the filename, but that would be awkward and error-prone. So, instead of using the filename field to determine whether the lock_file object is active, add a new field "lock_file::active" for this purpose. Be careful to set this field only when filename really contains the name of a file that should be deleted on cleanup. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:48:59 UTC
e831855 git_config_set_multivar_in_file(): avoid call to rollback_lock_file() After commit_lock_file() is called, then the lock_file object is necessarily either committed or rolled back. So there is no need to call rollback_lock_file() again in either of these cases. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:48:59 UTC
32c3ec2 dump_marks(): remove a redundant call to rollback_lock_file() When commit_lock_file() fails, it now always calls rollback_lock_file() internally, so there is no need to call that function here. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:48:59 UTC
d75145a api-lockfile: document edge cases * Document the behavior of commit_lock_file() when it fails, namely that it rolls back the lock_file object and sets errno appropriately. * Document the behavior of rollback_lock_file() when called for a lock_file object that has already been committed or rolled back, namely that it is a NOOP. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:14 UTC
1b1648f commit_lock_file(): rollback lock file on failure to rename If rename() fails, call rollback_lock_file() to delete the lock file (in case it is still present) and reset the filename field to the empty string so that the lockfile object is left in a valid state. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:14 UTC
8e86c15 close_lock_file(): if close fails, roll back If closing an open lockfile fails, then we cannot be sure of the contents of the lockfile, so there is nothing sensible to do but delete it. This change also insures that the lock_file object is left in a defined state in this error path (namely, unlocked). The only caller that is ultimately affected by this change is try_merge_strategy() -> write_locked_index(), which can call close_lock_file() via various execution paths. This caller uses a static lock_file object which previously could have been reused after a failed close_lock_file() even though it was still in locked state. This change causes the lock_file object to be unlocked on failure, thus fixing this error-handling path. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:13 UTC
8a1c753 commit_lock_file(): die() if called for unlocked lockfile object It was previously a bug to call commit_lock_file() with a lock_file object that was not active (an illegal access would happen within the function). It was presumably never done, but this would be an easy programming error to overlook. So before continuing, do a consistency check that the lock_file object really is locked. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:13 UTC
4f4713d commit_lock_file(): inline temporary variable Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:13 UTC
a1754bc remove_lock_file(): call rollback_lock_file() It does just what we need. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:12 UTC
e31e949 lock_file(): exit early if lockfile cannot be opened This is a bit easier to read than the old version, which nested part of the non-error code in an "if" block. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:12 UTC
35ff08b prepare_index(): declare return value to be (const char *) Declare the return value to be const to make it clear that we aren't giving callers permission to write over the string that it points at. (The return value is the filename field of a struct lock_file, which can be used by a signal handler at any time and therefore shouldn't be tampered with.) Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:12 UTC
91f1f19 delete_ref_loose(): don't muck around in the lock_file's filename It's bad manners. Especially since there could be a signal during the call to unlink_or_warn(), in which case the signal handler will see the wrong filename and delete the reference file, leaving the lockfile behind. So make our own copy to work with. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:11 UTC
7108ad2 cache.h: define constants LOCK_SUFFIX and LOCK_SUFFIX_LEN There are a few places that use these values, so define constants for them. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:11 UTC
0a06f14 lockfile.c: document the various states of lock_file objects Document the valid states of lock_file objects, how they get into each state, and how the state is encoded in the object's fields. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:45:11 UTC
04e57d4 lock_file(): always initialize and register lock_file object The purpose of this change is to make the state diagram for lock_file objects simpler and deterministic. If locking fails, lock_file() sometimes leaves the lock_file object partly initialized, but sometimes not. It sometimes registers the object in lock_file_list, but sometimes not. This makes the state diagram for lock_file objects effectively indeterministic and hard to reason about. A future patch will also change the filename field into a strbuf, which needs more involved initialization, so it will become even more important that the state of a lock_file object is well-defined after a failed attempt to lock. The ambiguity doesn't currently have any ill effects, because lock_file objects cannot be removed from the lock_file_list anyway. But to make it easier to document and reason about the code, make this behavior consistent: *always* initialize the lock_file object and *always* register it in lock_file_list the first time it is used, regardless of whether an error occurs. While we're at it, make sure that all of the lock_file fields are initialized to values appropriate for an unlocked object; the caller is only responsible for making sure that on_list is set to zero before the first time it is used. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:43:50 UTC
ebb8e38 hold_lock_file_for_append(): release lock on errors If there is an error copying the old contents to the lockfile, roll back the lockfile before exiting so that the lockfile is not held until process cleanup. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:42 UTC
41dd4ff lockfile: unlock file if lockfile permissions cannot be adjusted If the call to adjust_shared_perm() fails, lock_file returns -1, which to the caller looks like any other failure to lock the file. So in this case, roll back the lockfile before returning so that the lock file is deleted immediately and the lockfile object is left in a predictable state (namely, unlocked). Previously, the lockfile was retained until process cleanup in this situation. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:41 UTC
26f5d3b rollback_lock_file(): set fd to -1 When rolling back the lockfile, call close_lock_file() so that the lock_file's fd field gets set back to -1. This keeps the lock_file object in a valid state, which is important because these objects are allowed to be reused. It also makes it unnecessary to check whether the file has already been closed, because close_lock_file() takes care of that. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:41 UTC
9085f8e rollback_lock_file(): exit early if lock is not active Eliminate a layer of nesting. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:40 UTC
5527d53 rollback_lock_file(): do not clear filename redundantly It is only necessary to clear the lock_file's filename field if it was not already clear. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:39 UTC
419f0c0 close_lock_file(): exit (successfully) if file is already closed Suggested-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:39 UTC
a5e4866 api-lockfile: revise and expand the documentation Document a couple more functions and the flags argument as used by hold_lock_file_for_update() and hold_lock_file_for_append(). Reorganize the document to make it more accessible. Helped-by: Jonathan Nieder <jrnieder@gmail.com> Helped-by: Junio Hamano <gitster@pobox.com> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:38 UTC
e197c21 unable_to_lock_die(): rename function from unable_to_lock_index_die() This function is used for other things besides the index, so rename it accordingly. Suggested-by: Jeff King <peff@peff.net> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Reviewed-by: Ronnie Sahlberg <sahlberg@google.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:38:38 UTC
107efbe daemon: remove write-only variable maxfd It became unused when 6573faff (NO_IPV6 support for git daemon) replaced select() with poll(). Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:34:56 UTC
9d1b9aa daemon: fix error message after bind() Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:34:54 UTC
eb6c403 daemon: handle gethostbyname() error If the user-supplied hostname can't be found then we should not use it. We already avoid doing that in the non-NO_IPV6 case by checking if the return value of getaddrinfo() is zero (success). Do the same in the NO_IPV6 case and make sure the return value of gethostbyname() isn't NULL before dereferencing this pointer. Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:34:53 UTC
0eb0fb8 sha1-lookup: handle duplicates in sha1_pos() If the first 18 bytes of the SHA1's of all entries are the same then sha1_pos() dies and reports that the lower and upper limits of the binary search were the same that this wasn't supposed to happen. This is wrong because the remaining two bytes could still differ. Furthermore: It wouldn't be a problem if they actually were the same, i.e. if all entries have the same SHA1. The code already handles duplicates just fine. Simply remove the erroneous check. Signed-off-by: Rene Scharfe <l.s.r@web.de> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> 01 October 2014, 20:32:19 UTC
back to top