{"thread":{"id":"23675","subject":"What's cooking in git.git (May 2010, #01; Sun, 2)","startedAt":"2010-05-02T16:12:12Z","lastAt":"2010-05-08T16:43:19Z","messageCount":16,"participants":["Junio C Hamano","Johannes Sixt","Jakub Narebski","Will Palmer","Jonathan Nieder","Clemens Buchacher"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"140784","messageId":"7v7hnmuvtv.fsf@alter.siamese.dyndns.org","threadId":"23675","inReplyTo":null,"subject":"What's cooking in git.git (May 2010, #01; Sun, 2)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-05-02T16:12:12Z","receivedAt":"2010-05-02T16:12:12Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Here are the topics that have been cooking.  Commits prefixed with '-' are\nonly in 'pu' while commits prefixed with '+' are in 'next'.  The ones\nmarked with '.' do not appear in any of the integration branches, but I am\nstill holding onto them.\n\nThe latest release 1.7.1 has been out for a week and I will soon rewind\n'next' and switch 'maint' for 1.7.1.X series.  It appears that no grave\nregression has been reported, which is a good sign.\n\n--------------------------------------------------\n[New Topics]\n\n* cb/maint-stash-orphaned-file (2010-04-18) 2 commits\n  (merged to 'next' on 2010-04-22 at f9de16c)\n + stash tests: stash can lose data in a file removed from the index\n + stash: Don't overwrite files that have gone from the index\n\n* jn/maint-bundle (2010-04-19) 2 commits\n  (merged to 'next' on 2010-04-22 at b2668a6)\n + fix \"bundle --stdin\" segfault\n + t5704 (bundle): add tests for bundle --stdin\n\n* pb/patch-id-plus (2010-04-19) 2 commits\n  (merged to 'next' on 2010-04-22 at 5177f8b)\n + patch-id: Add support for mbox format\n + patch-id: extract parsing one diff out of generate_id_list\n\n* rr/doc-submitting (2010-04-19) 1 commit\n  (merged to 'next' on 2010-04-22 at b557474)\n + SubmittingPatches: Add new section about what to base work on\n\n* st/remote-tags-no-tags (2010-04-20) 2 commits\n - remote add: add a --[no-]tags option\n - Honor \"tagopt = --tags\" configuration option\n\n* jc/rev-list-ancestry-path (2010-04-20) 1 commit\n - revision: --ancestry-path\n\nJust an illustration patch.  merge simplification logic used when\npathspecs are in effect interacts with this rather badly.\n\n* cb/assume-unchanged-fix (2010-05-01) 2 commits\n - Documentation: git-add does not update files marked \"assume unchanged\"\n - do not overwrite files marked \"assume unchanged\"\n\n* jn/fsck-ident (2010-04-24) 1 commit\n - fsck: check ident lines in commit objects\n\n* jn/gitweb-caching-prep (2010-04-24) 5 commits\n - gitweb: Move generating page title to separate subroutine\n - gitweb: Add custom error handler using die_error\n - gitweb: Use nonlocal jump instead of 'exit' in die_error\n - gitweb: href(..., -path_info => 0|1)\n - Export more test-related variables when running external tests\n\n* jn/gitweb-install (2010-05-01) 2 commits\n - gitweb: Create install target for gitweb in Makefile\n - gitweb: Improve installation instructions in gitweb/INSTALL\n\n* jn/gitweb-our-squelch (2010-04-30) 1 commit\n - gitweb: Silence 'Variable VAR may be unavailable' warnings\n\n* jn/maint-request-pull (2010-04-24) 2 commits\n - request-pull: protect against OPTIONS_KEEPDASHDASH from environment\n - tests for request-pull\n (this branch is used by jn/request-pull.)\n\n* jn/request-pull (2010-04-24) 2 commits\n - adapt request-pull tests for new pull request format\n - Merge branch 'jn/maint-request-pull' into jn/request-pull\n (this branch uses jn/maint-request-pull.)\n\n* jn/shortlog (2010-04-26) 4 commits\n . pretty: Respect --abbrev option\n . shortlog: Document and test --format option\n . t4201 (shortlog): Test output format with multiple authors\n . t4201 (shortlog): guard setup with test_expect_success\n\nThis seems to cause intermittent test failure for me especially when run\nunder \"make -j4\".\n\n* wp/pretty-enhancement (2010-04-30) 5 commits\n - pretty: add aliases for pretty formats\n - pretty: add infrastructure to allow format aliases\n - pretty: make it easier to add new formats\n - pretty: make %H/%h/etc respect --abbrev[-commit]\n - pretty: add conditional %C?colorname placeholders\n\n--------------------------------------------------\n[Graduated to \"master\"]\n\n* jc/doc-submit-gmail (2010-04-07) 1 commit\n  (merged to 'next' on 2010-04-10 at cd4e8cf)\n + SubmittingPatches: update GMail section\n\n* jg/auto-initialize-notes-with-percent-n-in-format (2010-04-13) 1 commit\n + pretty: Initialize notes if %N is used\n\n* jk/maint-diffstat-overflow (2010-04-17) 1 commit\n + diff: use large integers for diffstat calculations\n\n* rr/remote-helper-doc (2010-04-07) 3 commits\n + Documentation/remote-helpers: Add invocation section\n + Documentation/urls: Rewrite to accomodate <transport>::<address>\n + Documentation/remote-helpers: Rewrite description\n\n* wp/doc-filter-direction (2010-04-17) 1 commit\n + documentation: clarify direction of core.autocrlf\n\nThese were pushed out as part of 1.7.1\n\n--------------------------------------------------\n[Stalled]\n\n* js/rebase-origin-x (2010-02-05) 1 commit\n - [RFC w/o test and incomplete] rebase: add -x option to record original commit name\n\nI retract my objection against the idea of -x; needs polishing before\nmoving forward.\n\n* js/grep-open (2010-05-01) 3 commits\n - grep: do not ignore return value from chdir()\n - grep -O: allow optional argument specifying the pager (or editor)\n - grep: Add the option '--open-files-in-pager'\n (this branch is used by jp/hold-string-list-sanity.)\n\nProbably needs to support --no-index mode as well.\n\n* jp/hold-string-list-sanity (2010-04-06) 9 commits\n . string_list: Fix argument order for string_list_append\n . Merge branch 'sr/remote-helper-export' into HEAD\n . Merge branch 'js/grep-open' into HEAD\n . Merge branch 'sb/fmt-merge-msg' into HEAD\n . string_list: Fix argument order for string_list_lookup\n . string_list: Fix argument order for string_list_insert_at_index\n . string_list: Fix argument order for string_list_insert\n . string_list: Fix argument order for for_each_string_list\n . string_list: Fix argument order for print_string_list\n (this branch uses js/grep-open and sr/remote-helper-export.)\n\nBuilding this on top of slushy codebase is not a very promising endeavor.\nGood thing to do, but it came at a bad time.\n\n--------------------------------------------------\n[Cooking]\n\n* jn/t7006-fixup (2010-04-14) 1 commit\n  (merged to 'next' on 2010-04-22 at 358ea26)\n + t7006: guard cleanup with test_expect_success\n\n* js/maint-receive-pack-symref-alias (2010-04-19) 3 commits\n  (merged to 'next' on 2010-04-22 at 5d1338f)\n + t5516-fetch-push.sh: style cleanup\n + receive-pack: detect aliased updates which can occur with symrefs\n + receive-pack: switch global variable 'commands' to a parameter\n\n* sp/maint-dumb-http-pack-reidx (2010-04-19) 12 commits\n  (merged to 'next' on 2010-04-22 at c94f19e)\n + http.c::new_http_pack_request: do away with the temp variable filename\n + http-fetch: Use temporary files for pack-*.idx until verified\n + http-fetch: Use index-pack rather than verify-pack to check packs\n + Allow parse_pack_index on temporary files\n + Extract verify_pack_index for reuse from verify_pack\n + Introduce close_pack_index to permit replacement\n + http.c: Remove unnecessary strdup of sha1_to_hex result\n + http.c: Don't store destination name in request structures\n + http.c: Drop useless != NULL test in finish_http_pack_request\n + http.c: Tiny refactoring of finish_http_pack_request\n + t5550-http-fetch: Use subshell for repository operations\n + http.c: Remove bad free of static block\n\n* hg/id-munging (2010-04-06) 2 commits\n - convert: Keep foreign $Id$ on checkout.\n - convert: Safer handling of $Id$ contraction.\n\n* jn/submodule-basic-test (2010-04-10) 3 commits\n  (merged to 'next' on 2010-04-22 at 6d22343)\n + t7400: clarify submodule update tests\n + t7400: clarify 'submodule add' tests\n + t7400: split setup into multiple tests\n\n* np/index-pack-memsave (2010-04-12) 3 commits\n  (merged to 'next' on 2010-04-22 at 4135456)\n + index-pack: smarter memory usage when appending objects\n + index-pack: rationalize unpack_entry_data()\n + index-pack: smarter memory usage when resolving deltas\n\n* jc/am-3-show-corrupted-patch (2010-04-09) 1 commit\n  (merged to 'next' on 2010-04-22 at 49959c8)\n + am -3: recover the diagnostic messages for corrupt patches\n\n* jc/maint-no-reflog-expire-unreach-for-head (2010-04-09) 3 commits\n  (merged to 'next' on 2010-04-22 at bf9c927)\n + reflog --expire-unreachable: special case entries in \"HEAD\" reflog\n + more war on \"sleep\" in tests\n + Document gc.<pattern>.reflogexpire variables\n (this branch uses jc/maint-reflog-expire-unreachable.)\n\nRerolled; instead of ignoring the configuration like the previous round\ndid, this one prunes stale entries that are unreachable from any ref from\nthe reflog of HEAD.\n\n* cw/maint-exec-defpath (2010-04-15) 2 commits\n  (merged to 'next' on 2010-04-22 at e990e5b)\n + autoconf: Check if <paths.h> exists and set HAVE_PATHS_H\n + exec_cmd.c: replace hard-coded path list with one from <paths.h>\n\n* tr/word-diff (2010-04-14) 1 commit\n  (merged to 'next' on 2010-04-22 at a10062e)\n + diff: add --word-diff option that generalizes --color-words\n\nThere are gitk patches that go with this series.\n\n* sp/maint-describe-tiebreak-with-tagger-date (2010-04-12) 5 commits\n  (merged to 'next' on 2010-04-22 at f712ae9)\n + describe: Break annotated tag ties by tagger date\n + tag.c: Parse tagger date (if present)\n + tag.c: Refactor parse_tag_buffer to be saner to program\n + tag.h: Remove unused signature field\n + tag.c: Correct indentation\n\n* bg/apply-blank-trailing-context (2010-04-08) 1 commit\n  (merged to 'next' on 2010-04-14 at a393c0b)\n + apply: Allow blank *trailing* context lines to match beyond EOF\n\n* bg/send-email-smtpdomain (2010-04-10) 4 commits\n  (merged to 'next' on 2010-04-14 at 88fff99)\n + send-email: Cleanup smtp-domain and add config\n + Document send-email --smtp-domain\n + send-email: Don't use FQDNs without a '.'\n + send-email: Cleanup { style\n\n* rc/ls-remote-default (2010-04-09) 1 commit\n  (merged to 'next' on 2010-04-14 at d5081bd)\n + ls-remote: fall-back to default remotes when no remote specified\n\n* rc/maint-curl-helper (2010-04-08) 3 commits\n  (merged to 'next' on 2010-04-14 at 2eb9177)\n + remote-curl: ensure that URLs have a trailing slash\n + http: make end_url_with_slash() public\n + t5541-http-push: add test for URLs with trailing slash\n\n* hg/maint-attr-fix (2010-04-06) 3 commits\n  (merged to 'next' on 2010-04-14 at a27c7d7)\n + attr: Expand macros immediately when encountered.\n + attr: Allow multiple changes to an attribute on the same line.\n + attr: Fixed debug output for macro expansion.\n\n* jc/status-show-ignored (2010-05-01) 6 commits\n  (merged to 'next' on 2010-05-01 at 6845abd)\n + wt-status: fix 'fprintf' compilation warning\n  (merged to 'next' on 2010-04-22 at c6abe03)\n + status: --ignored option shows ignored files\n + wt-status: rename and restructure status-print-untracked\n + wt-status: collect ignored files\n + wt-status: plug memory leak while collecting untracked files\n + wt-status: remove unused workdir_untracked member\n\nI am negative about conflating the JSON output to the mix at this point.\nLet's stabilize \"status\" with the existing --porcelain/-z option first.\n\n* eb/unpretty-b-format (2010-03-24) 1 commit\n  (merged to 'next' on 2010-04-07 at 7f5c112)\n + Add `%B' in format strings for raw commit body in `git log' and friends\n\n* ab/commit-empty-message (2010-04-06) 1 commit\n  (merged to 'next' on 2010-04-07 at 701e863)\n + Add option to git-commit to allow empty log messages\n\n* jc/test-sleepless (2010-04-06) 1 commit\n  (merged to 'next' on 2010-04-07 at 8ccf40a)\n + war on \"sleep\" in tests\n\n* jc/maint-reflog-expire-unreachable (2010-04-07) 1 commit\n  (merged to 'next' on 2010-04-22 at 2a46172)\n + reflog --expire-unreachable: avoid merge-base computation\n (this branch is used by jc/maint-no-reflog-expire-unreach-for-head.)\n\n* np/malloc-threading (2010-04-08) 2 commits\n  (merged to 'next' on 2010-04-10 at e1730fb)\n + Thread-safe xmalloc and xrealloc needs a recursive mutex\n + Make xmalloc and xrealloc thread-safe\n\nThe fix should eventually go to 'maint' and 'master'.  This queues the one\nfrom J6t for Windows compatibility.\n\n* js/async-thread (2010-03-09) 7 commits\n  (merged to 'next' on 2010-04-22 at ee8874e)\n + Enable threaded async procedures whenever pthreads is available\n  (merged to 'next' on 2010-03-20 at 9939243)\n + Dying in an async procedure should only exit the thread, not the process.\n + Reimplement async procedures using pthreads\n + Windows: more pthreads functions\n + Fix signature of fcntl() compatibility dummy\n + Make report() from usage.c public as vreportf() and use it.\n + Modernize t5530-upload-pack-error.\n\nAs the malloc-threading topic has been cooking for a while, the tip one\nmay not be so bad to unleash to 'next' users, especially because we are in\nthe pre-release feature freeze.\n\n* sd/log-decorate (2010-04-08) 6 commits\n  (merged to 'next' on 2010-04-08 at 68fee56)\n + log.decorate: only ignore it under \"log --pretty=raw\"\n + script with rev-list instead of log\n  (merged to 'next' on 2010-04-06 at 992c9ad)\n + log --pretty/--oneline: ignore log.decorate\n  (merged to 'next' on 2010-03-08 at 58a6fba)\n + log.decorate: usability fixes\n + Add `log.decorate' configuration variable.\n + git_config_maybe_bool()\n\n* mh/status-optionally-refresh (2010-04-03) 3 commits\n  (merged to 'next' on 2010-04-05 at 0e64aac)\n + t7508: add a test for \"git status\" in a read-only repository\n + git status: refresh the index if possible\n + t7508: add test for \"git status\" refreshing the index\n\n* cw/ws-indent-with-tab (2010-04-03) 6 commits\n  (merged to 'next' on 2010-04-05 at 5b5e579)\n + whitespace: tests for git-apply --whitespace=fix with tab-in-indent\n + whitespace: add tab-in-indent support for --whitespace=fix\n + whitespace: replumb ws_fix_copy to take a strbuf *dst instead of char *dst\n + whitespace: tests for git-diff --check with tab-in-indent error class\n + whitespace: add tab-in-indent error class\n + whitespace: we cannot \"catch all errors known to git\" anymore\n\n* sr/remote-helper-export (2010-04-12) 9 commits\n  (merged to 'next' on 2010-04-12 at cefbb2f)\n + t5800: testgit helper requires Python support\n  (merged to 'next' on 2010-04-09 at 94f6e3d)\n + Makefile: Simplify handling of python scripts\n  (merged to 'next' on 2010-04-07 at 5651307)\n + remote-helpers: add tests for testgit helper\n + remote-helpers: add testgit helper\n + remote-helpers: add support for an export command\n + remote-helpers: allow requesing the path to the .git directory\n + fast-import: always create marks_file directories\n + clone: also configure url for bare clones\n + clone: pass the remote name to remote_get\n (this branch is used by jp/hold-string-list-sanity.)\n\n* cc/revert-strategy (2010-03-31) 5 commits\n  (merged to 'next' on 2010-04-05 at 50909c1)\n + revert: add \"--strategy\" option to choose merge strategy\n + merge: make function try_merge_command non static\n + merge: refactor code that calls \"git merge-STRATEGY\"\n + revert: refactor merge recursive code into its own function\n + revert: use strbuf to refactor the code that writes the merge message\n\nThis is more about debugging and we are not in a great hurry.\n\n* sc/http-late-auth (2010-04-01) 1 commit\n  (merged to 'next' on 2010-04-02 at c991acf)\n + Prompt for a username when an HTTP request 401s\n\n* jk/cached-textconv (2010-04-01) 5 commits\n  (merged to 'next' on 2010-04-02 at a023e3c)\n + diff: avoid useless filespec population\n + diff: cache textconv output\n + textconv: refactor calls to run_textconv\n + introduce notes-cache interface\n + make commit_tree a library function\n\nThe small leak fixes in the beginning of the series has been merged to\n'master' after a minor fixup.\n\n* ld/discovery-limit-to-fs (2010-04-04) 6 commits\n - write-index: check and warn when worktree crosses a filesystem boundary\n  (merged to 'next' on 2010-04-07 at 11ea09a)\n + Rename ONE_FILESYSTEM to DISCOVERY_ACROSS_FILESYSTEM\n + GIT_ONE_FILESYSTEM: flip the default to stop at filesystem boundaries\n + Add support for GIT_ONE_FILESYSTEM\n + truncate cwd string before printing error message\n + config.c: remove static keyword from git_env_bool()\n\nThe tip one is a bit iffy; the whole series changes behaviour in a corner\ncase, and is not a 1.7.1 material.\n\n* pc/remove-warn (2010-03-26) 4 commits\n  (merged to 'next' on 2010-04-02 at 52fc00d)\n + Remove a redundant errno test in a usage of remove_path\n + Introduce remove_or_warn function\n + Implement the rmdir_or_warn function\n + Generalise the unlink_or_warn function\n\nI cherry-picked only obviously sensible bits.\n\n* em/checkout-orphan (2010-03-21) 1 commit\n  (merged to 'next' on 2010-03-28 at 86b6a4f)\n + git checkout: create unparented branch by --orphan\n\nPerhaps needs a bit of documentation updates, describing the \"going open\nsource\" scenario.\n\n* ar/config-from-command-line (2010-03-26) 2 commits\n  (merged to 'next' on 2010-04-07 at e50fd3a)\n + Use strbufs instead of open-coded string manipulation\n + Allow passing of configuration parameters in the command line\n"},{"id":"140791","messageId":"4BDDDA21.4090304@kdbg.org","threadId":"23675","inReplyTo":"7v7hnmuvtv.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (May 2010, #01; Sun, 2)","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-05-02T20:01:37Z","receivedAt":"2010-05-02T20:01:37Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 02.05.2010 18:12, schrieb Junio C Hamano:\n> * np/malloc-threading (2010-04-08) 2 commits\n>    (merged to 'next' on 2010-04-10 at e1730fb)\n>   + Thread-safe xmalloc and xrealloc needs a recursive mutex\n>   + Make xmalloc and xrealloc thread-safe\n> \n> The fix should eventually go to 'maint' and 'master'.  This queues the one\n> from J6t for Windows compatibility.\n> \n> * js/async-thread (2010-03-09) 7 commits\n>    (merged to 'next' on 2010-04-22 at ee8874e)\n>   + Enable threaded async procedures whenever pthreads is available\n>    (merged to 'next' on 2010-03-20 at 9939243)\n>   + Dying in an async procedure should only exit the thread, not the process.\n>   + Reimplement async procedures using pthreads\n>   + Windows: more pthreads functions\n>   + Fix signature of fcntl() compatibility dummy\n>   + Make report() from usage.c public as vreportf() and use it.\n>   + Modernize t5530-upload-pack-error.\n> \n> As the malloc-threading topic has been cooking for a while, the tip one\n> may not be so bad to unleash to 'next' users, especially because we are in\n> the pre-release feature freeze.\n\nNote that np/malloc-threading does not help the potential xmalloc race\ncondition in js/async-thread topic at all. :-( np/malloc-threading is only\nabout a race that is internal in pack-objects.\n\nNow that you force me to think about the problem, I suggest something along\nthese lines: Disable try_to_free_routine when GIT_TRACE is set, and require\ncallers of set_try_to_free_routine to restore the previous routine.\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 214d7ef..0e81673 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -1529,6 +1529,8 @@ static void try_to_free_from_threads(size_t size)\n \tread_unlock();\n }\n \n+try_to_free_t old_try_to_free_routine;\n+\n /*\n  * The main thread waits on the condition that (at least) one of the workers\n  * has stopped working (which is indicated in the .working member of\n@@ -1563,12 +1565,12 @@ static void init_threaded_search(void)\n \tpthread_mutex_init(&cache_mutex, NULL);\n \tpthread_mutex_init(&progress_mutex, NULL);\n \tpthread_cond_init(&progress_cond, NULL);\n-\tset_try_to_free_routine(try_to_free_from_threads);\n+\told_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads);\n }\n \n static void cleanup_threaded_search(void)\n {\n-\tset_try_to_free_routine(NULL);\n+\tset_try_to_free_routine(old_try_to_free_routine);\n \tpthread_cond_destroy(&progress_cond);\n \tpthread_mutex_destroy(&read_mutex);\n \tpthread_mutex_destroy(&cache_mutex);\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 4a508c1..51d2a01 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -357,7 +357,8 @@ static inline void *gitmempcpy(void *dest, const void *src, size_t n)\n \n extern void release_pack_memory(size_t, int);\n \n-extern void set_try_to_free_routine(void (*routine)(size_t));\n+typedef void (*try_to_free_t)(size_t);\n+extern try_to_free_t set_try_to_free_routine(try_to_free_t);\n \n extern char *xstrdup(const char *str);\n extern void *xmalloc(size_t size);\ndiff --git a/trace.c b/trace.c\nindex 4229ae1..9816a8b 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -72,6 +72,7 @@ void trace_printf(const char *fmt, ...)\n \tif (!fd)\n \t\treturn;\n \n+\tset_try_to_free_routine(NULL);\n \tstrbuf_init(&buf, 64);\n \tva_start(ap, fmt);\n \tlen = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);\n@@ -103,6 +104,7 @@ void trace_argv_printf(const char **argv, const char *fmt, ...)\n \tif (!fd)\n \t\treturn;\n \n+\tset_try_to_free_routine(NULL);\n \tstrbuf_init(&buf, 64);\n \tva_start(ap, fmt);\n \tlen = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);\ndiff --git a/wrapper.c b/wrapper.c\nindex 62edb57..02da613 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -10,9 +10,11 @@ static void try_to_free_builtin(size_t size)\n \n static void (*try_to_free_routine)(size_t size) = try_to_free_builtin;\n \n-void set_try_to_free_routine(void (*routine)(size_t))\n+try_to_free_t set_try_to_free_routine(try_to_free_t routine)\n {\n-\ttry_to_free_routine = (routine) ? routine : try_to_free_builtin;\n+\ttry_to_free_t old = try_to_free_routine;\n+\ttry_to_free_routine = routine;\n+\treturn old;\n }\n \n char *xstrdup(const char *str)\n@@ -33,8 +35,10 @@ void *xmalloc(size_t size)\n \tif (!ret && !size)\n \t\tret = malloc(1);\n \tif (!ret) {\n-\t\ttry_to_free_routine(size);\n-\t\tret = malloc(size);\n+\t\tif (try_to_free_routine) {\n+\t\t\ttry_to_free_routine(size);\n+\t\t\tret = malloc(size);\n+\t\t}\n \t\tif (!ret && !size)\n \t\t\tret = malloc(1);\n \t\tif (!ret)\n"},{"id":"140825","messageId":"m3sk69f8yw.fsf@localhost.localdomain","threadId":"23675","inReplyTo":"7v7hnmuvtv.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (May 2010, #01; Sun, 2)","fromName":"Jakub Narebski","fromEmail":"jnareb@gmail.com","sentAt":"2010-05-03T12:48:08Z","receivedAt":"2010-05-03T12:48:08Z","isPatch":false,"sender":{"key":"jnareb@gmail.com","avatar":"https://avatars.githubusercontent.com/u/2706?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> * jn/gitweb-caching-prep (2010-04-24) 5 commits\n>  - gitweb: Move generating page title to separate subroutine\n>  - gitweb: Add custom error handler using die_error\n>  - gitweb: Use nonlocal jump instead of 'exit' in die_error\n\nI'll try to check whether it is true what I think that using nonlocal\njump instead of 'exit' improves performance of gitweb when run from\nmod_perl.\n\n>  - gitweb: href(..., -path_info => 0|1)\n>  - Export more test-related variables when running external tests\n> \n> * jn/gitweb-install (2010-05-01) 2 commits\n>  - gitweb: Create install target for gitweb in Makefile\n>  - gitweb: Improve installation instructions in gitweb/INSTALL\n\nI think it would be good to have install target for gitweb in Makefile\nbefore gitweb output caching series.\n\n> * jn/gitweb-our-squelch (2010-04-30) 1 commit\n>  - gitweb: Silence 'Variable VAR may be unavailable' warnings\n\nWhat about syntax hightlighting series?\n\n     gitweb: Refactor syntax highlighting support\n     gitweb: Syntax highlighting support\n\n-- \nJakub Narebski\nPoland\nShadeHawk on #git\n"},{"id":"140843","messageId":"1272912875.3537.6.camel@dreddbeard","threadId":"23675","inReplyTo":"7v7hnmuvtv.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (May 2010, #01; Sun, 2)","fromName":"Will Palmer","fromEmail":"wmpalmer@gmail.com","sentAt":"2010-05-03T18:54:35Z","receivedAt":"2010-05-03T18:54:35Z","isPatch":false,"sender":{"key":"wmpalmer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/357044?v=4"},"body":"On Sun, 2010-05-02 at 09:12 -0700, Junio C Hamano wrote:\n> This seems to cause intermittent test failure for me especially when run\n> under \"make -j4\".\n> \n> * wp/pretty-enhancement (2010-04-30) 5 commits\n>  - pretty: add aliases for pretty formats\n>  - pretty: add infrastructure to allow format aliases\n>  - pretty: make it easier to add new formats\n>  - pretty: make %H/%h/etc respect --abbrev[-commit]\n>  - pretty: add conditional %C?colorname placeholders\n\nDoes it still happen with the latest (3-commit) series? I suspect the\nmost-likely to cause test failures would be the --abbrev[-commit]\nchanges, though I suppose \"intermittent\" could point to a memory\nproblem, which is more likely to be from \"make it easier to add new\nformats\" or \"add infrastructure...\"\n\nHaven't been able to reproduce here (just running make -m4 in a\nwhile-loop all night) Any specific tests failing?\n\n-- \n-- Will\n"},{"id":"140869","messageId":"20100504002526.GA7061@progeny.tock","threadId":"23675","inReplyTo":"1272912875.3537.6.camel@dreddbeard","subject":"jn/shortlog (Re: What's cooking in git.git (May 2010, #01; Sun, 2))","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T00:25:38Z","receivedAt":"2010-05-04T00:25:38Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi,\n\nWill Palmer wrote:\n> Junio C Hamano wrote:\n\n>> * jn/shortlog (2010-04-26) 4 commits\n>>  . pretty: Respect --abbrev option\n>>  . shortlog: Document and test --format option\n>>  . t4201 (shortlog): Test output format with multiple authors\n>>  . t4201 (shortlog): guard setup with test_expect_success\n>> \n>> This seems to cause intermittent test failure for me especially when run\n>> under \"make -j4\".\n>> \n>> * wp/pretty-enhancement (2010-04-30) 5 commits\n[...]\n> Does it still happen with the latest (3-commit) series?\n\nI think it was the shortlog tests series[1].\n\n> Haven't been able to reproduce here (just running make -m4 in a\n> while-loop all night) Any specific tests failing?\n\nIn t4201-shortlog.sh:\n\n--- expect.template     2010-05-04 00:17:41.609754167 +0000\n+++ log.predictable     2010-05-04 00:17:41.613754428 +0000\n@@ -1,10 +0,0 @@\n-A U Thor (5):\n-      SUBJECT\n-      SUBJECT\n-      SUBJECT\n-      SUBJECT\n-      SUBJECT\n-\n-Someone else (1):\n-      SUBJECT\n-\n\n* FAIL 2: default output format\n\n\t\tgit shortlog >log &&\n\t\tfuzz log >log.predictable &&\n\t\ttest_cmp expect.template log.predictable\n\n--- expect      2010-05-04 00:17:41.625754445 +0000\n+++ log.predictable     2010-05-04 00:17:41.629754567 +0000\n@@ -1,10 +0,0 @@\n-A U Thor (5):\n-      OBJECT_NAME\n-      OBJECT_NAME\n-      OBJECT_NAME\n-      OBJECT_NAME\n-      OBJECT_NAME\n-\n-Someone else (1):\n-      OBJECT_NAME\n-\n\n* FAIL 3: pretty format\n\n\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n\tgit shortlog --format=\"%h\" --abbrev=5 >log &&\n\tfuzz log >log.predictable &&\n\ttest_cmp expect log.predictable\n\n--- expect      2010-05-04 00:17:41.637754532 +0000\n+++ log.predictable     2010-05-04 00:17:41.645754776 +0000\n@@ -1,10 +0,0 @@\n-A U Thor (5):\n-      OBJID\n-      OBJID\n-      OBJID\n-      OBJID\n-      OBJID\n-\n-Someone else (1):\n-      OBJID\n-\n* FAIL 4: --abbrev\n\n\t\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n\t\tgit shortlog --format=\"%h\" --abbrev=5 >log &&\n\t\tfuzz log >log.predictable &&\n\t\ttest_cmp expect log.predictable\n\n--- expect      2010-05-04 00:17:41.657754653 +0000\n+++ log.predictable     2010-05-04 00:17:41.661754495 +0000\n@@ -1,10 +0,0 @@\n-A U Thor (5):\n-      two lines\n-      two lines\n-      two lines\n-      two lines\n-      two lines\n-\n-Someone else (1):\n-      two lines\n-\n\n* FAIL 5: output from user-defined format is re-wrapped\n        \n\t\tsed \"s/SUBJECT/two lines/\" expect.template >expect &&\n\t\tgit shortlog --format=\"two%nlines\" >log &&\n\t\tfuzz log >log.predictable &&\n\t\ttest_cmp expect log.predictable\n\nJonathan\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/145769/focus=145801\n"},{"id":"140871","messageId":"20100504015635.GA7258@progeny.tock","threadId":"23675","inReplyTo":"20100504002526.GA7061@progeny.tock","subject":"Re: jn/shortlog","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T01:56:35Z","receivedAt":"2010-05-04T01:56:35Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n> Will Palmer wrote:\n\n>> Haven't been able to reproduce here (just running make -m4 in a\n>> while-loop all night) Any specific tests failing?\n>\n> In t4201-shortlog.sh:\n> \n> --- expect.template     2010-05-04 00:17:41.609754167 +0000\n> +++ log.predictable     2010-05-04 00:17:41.613754428 +0000\n> @@ -1,10 +0,0 @@\n[etc]\n\nSo apparently shortlog does not default to HEAD when stdin is not a\ntty.\n\nPossible fixes:\n\n - document the current unfriendly behavior\n - default to HEAD when input is empty\n\nJonathan\n\n-- 8< --\nSubject: t4200 (rerere): guard setup with test_expect_success\n\nEnsure that GIT_SKIP_TESTS='t4200.*' actually suppresses all of t4200.\n\nAlso quote some stray dollar signs and test the result from some\ngit config invocations.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t4200-rerere.sh |  189 ++++++++++++++++++++++++++++++-----------------------\n 1 files changed, 106 insertions(+), 83 deletions(-)\n\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex 70856d0..d9b87c9 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -56,23 +56,27 @@ test_expect_success 'conflicting merge' '\n \tgit reset --hard &&\n \tmkdir .git/rr-cache &&\n \tgit config --unset rerere.enabled &&\n-\ttest_must_fail git merge first\n+\ttest_must_fail git merge first &&\n+\tsha1=$(perl -pe \"s/\t.*//\" .git/MERGE_RR) &&\n+\trr=.git/rr-cache/$sha1\n '\n \n-sha1=$(perl -pe 's/\t.*//' .git/MERGE_RR)\n-rr=.git/rr-cache/$sha1\n-test_expect_success 'recorded preimage' \"grep ^=======$ $rr/preimage\"\n+test_expect_success 'recorded preimage' '\n+\tgrep \"^=======\\$\" \"$rr/preimage\"\n+'\n \n test_expect_success 'rerere.enabled works, too' '\n \trm -rf .git/rr-cache &&\n \tgit config rerere.enabled true &&\n \tgit reset --hard &&\n \ttest_must_fail git merge first &&\n-\tgrep ^=======$ $rr/preimage\n+\tgrep \"^=======\\$\" \"$rr/preimage\"\n '\n \n-test_expect_success 'no postimage or thisimage yet' \\\n-\t\"test ! -f $rr/postimage -a ! -f $rr/thisimage\"\n+test_expect_success 'no postimage or thisimage yet' '\n+\t! test -f \"$rr/postimage\" &&\n+\t! test -f \"$rr/thisimage\"\n+'\n \n test_expect_success 'preimage has right number of lines' '\n \n@@ -81,56 +85,60 @@ test_expect_success 'preimage has right number of lines' '\n \n '\n \n-git show first:a1 > a1\n-\n-cat > expect << EOF\n---- a/a1\n-+++ b/a1\n-@@ -1,4 +1,4 @@\n--Some Title\n-+Some title\n- ==========\n- Whether 'tis nobler in the mind to suffer\n- The slings and arrows of outrageous fortune,\n-@@ -8,21 +8,11 @@\n- The heart-ache and the thousand natural shocks\n- That flesh is heir to, 'tis a consummation\n- Devoutly to be wish'd.\n--<<<<<<<\n--Some Title\n--==========\n--To die! To sleep;\n--=======\n- Some title\n- ==========\n- To die, to sleep;\n-->>>>>>>\n- To sleep: perchance to dream: ay, there's the rub;\n- For in that sleep of death what dreams may come\n- When we have shuffled off this mortal coil,\n- Must give us pause: there's the respect\n- That makes calamity of so long life;\n--<<<<<<<\n--=======\n--* END *\n-->>>>>>>\n-EOF\n-git rerere diff > out\n-\n-test_expect_success 'rerere diff' 'test_cmp expect out'\n-\n-cat > expect << EOF\n-a1\n-EOF\n-\n-git rerere status > out\n-\n-test_expect_success 'rerere status' 'test_cmp expect out'\n+test_expect_success 'rerere diff' \"\n+\tgit show first:a1 >a1 &&\n+\n+\tcat >expect <<-\\EOF\n+\t--- a/a1\n+\t+++ b/a1\n+\t@@ -1,4 +1,4 @@\n+\t-Some Title\n+\t+Some title\n+\t ==========\n+\t Whether 'tis nobler in the mind to suffer\n+\t The slings and arrows of outrageous fortune,\n+\t@@ -8,21 +8,11 @@\n+\t The heart-ache and the thousand natural shocks\n+\t That flesh is heir to, 'tis a consummation\n+\t Devoutly to be wish'd.\n+\t-<<<<<<<\n+\t-Some Title\n+\t-==========\n+\t-To die! To sleep;\n+\t-=======\n+\t Some title\n+\t ==========\n+\t To die, to sleep;\n+\t->>>>>>>\n+\t To sleep: perchance to dream: ay, there's the rub;\n+\t For in that sleep of death what dreams may come\n+\t When we have shuffled off this mortal coil,\n+\t Must give us pause: there's the respect\n+\t That makes calamity of so long life;\n+\t-<<<<<<<\n+\t-=======\n+\t-* END *\n+\t->>>>>>>\n+\tEOF\n+\tgit rerere diff >out &&\n+\ttest_cmp expect out\n+\"\n+\n+test_expect_success 'rerere status' '\n+\tcat >expect <<-\\EOF &&\n+\ta1\n+\tEOF\n+\n+\tgit rerere status >out &&\n+\ttest_cmp expect out\n+'\n \n test_expect_success 'commit succeeds' \\\n \t\"git commit -q -a -m 'prefer first over second'\"\n \n-test_expect_success 'recorded postimage' \"test -f $rr/postimage\"\n+test_expect_success 'recorded postimage' '\n+\ttest -f \"$rr/postimage\"\n+'\n \n test_expect_success 'another conflicting merge' '\n \tgit checkout -b third master &&\n@@ -139,47 +147,62 @@ test_expect_success 'another conflicting merge' '\n \ttest_must_fail git pull . first\n '\n \n-git show first:a1 | sed 's/To die: t/To die! T/' > expect\n-test_expect_success 'rerere kicked in' \"! grep ^=======$ a1\"\n+test_expect_success 'rerere kicked in' '\n+\t! grep \"^=======\\$\" a1\n+'\n \n-test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'\n+test_expect_success 'rerere prefers first change' '\n+\tgit show first:a1 | sed \"s/To die: t/To die! T/\" >expect &&\n+\ttest_cmp a1 expect\n+'\n \n-rm $rr/postimage\n-echo \"$sha1\ta1\" | perl -pe 'y/\\012/\\000/' > .git/MERGE_RR\n+test_expect_success 'cleanup' '\n+\trm $rr/postimage &&\n+\techo \"$sha1\ta1\" |\n+\t\tperl -pe \"y/\\012/\\000/\" >.git/MERGE_RR\n+'\n \n test_expect_success 'rerere clear' 'git rerere clear'\n \n test_expect_success 'clear removed the directory' \"test ! -d $rr\"\n \n-mkdir $rr\n-echo Hello > $rr/preimage\n-echo World > $rr/postimage\n-\n-sha2=4000000000000000000000000000000000000000\n-rr2=.git/rr-cache/$sha2\n-mkdir $rr2\n-echo Hello > $rr2/preimage\n-\n-almost_15_days_ago=$((60-15*86400))\n-just_over_15_days_ago=$((-1-15*86400))\n-almost_60_days_ago=$((60-60*86400))\n-just_over_60_days_ago=$((-1-60*86400))\n+test_expect_success 'gc setup' '\n+\tmkdir \"$rr\" &&\n+\techo Hello >\"$rr/preimage\" &&\n+\techo World >\"$rr/postimage\" &&\n \n-test-chmtime =$almost_60_days_ago $rr/preimage\n-test-chmtime =$almost_15_days_ago $rr2/preimage\n+\tsha2=4000000000000000000000000000000000000000 &&\n+\trr2=.git/rr-cache/$sha2 &&\n+\tmkdir \"$rr2\" &&\n+\techo Hello >\"$rr2/preimage\" &&\n \n-test_expect_success 'garbage collection (part1)' 'git rerere gc'\n+\talmost_15_days_ago=$((60-15*86400)) &&\n+\tjust_over_15_days_ago=$((-1-15*86400)) &&\n+\talmost_60_days_ago=$((60-60*86400)) &&\n+\tjust_over_60_days_ago=$((-1-60*86400))\n+'\n \n-test_expect_success 'young records still live' \\\n-\t\"test -f $rr/preimage && test -f $rr2/preimage\"\n+test_expect_success 'garbage collection (part1)' '\n+\ttest-chmtime \"=$almost_60_days_ago\" \"$rr/preimage\" &&\n+\ttest-chmtime \"=$almost_15_days_ago\" \"$rr2/preimage\" &&\n+\tgit rerere gc\n+'\n \n-test-chmtime =$just_over_60_days_ago $rr/preimage\n-test-chmtime =$just_over_15_days_ago $rr2/preimage\n+test_expect_success 'young records still live' '\n+\ttest -f \"$rr/preimage\" &&\n+\ttest -f \"$rr2/preimage\"\n+'\n \n-test_expect_success 'garbage collection (part2)' 'git rerere gc'\n+test_expect_success 'garbage collection (part2)' '\n+\ttest-chmtime \"=$just_over_60_days_ago\" \"$rr/preimage\" &&\n+\ttest-chmtime \"=$just_over_15_days_ago\" \"$rr2/preimage\" &&\n+\tgit rerere gc\n+'\n \n-test_expect_success 'old records rest in peace' \\\n-\t\"test ! -f $rr/preimage && test ! -f $rr2/preimage\"\n+test_expect_success 'old records rest in peace' '\n+\t! test -f \"$rr/preimage\" &&\n+\t! test -f \"$rr2/preimage\"\n+'\n \n test_expect_success 'file2 added differently in two branches' '\n \tgit reset --hard &&\n@@ -214,7 +237,7 @@ test_expect_success 'resolution was recorded properly' '\n '\n \n test_expect_success 'rerere.autoupdate' '\n-\tgit config rerere.autoupdate true\n+\tgit config rerere.autoupdate true &&\n \tgit reset --hard &&\n \tgit checkout version2 &&\n \ttest_must_fail git merge fifth &&\n@@ -230,7 +253,7 @@ test_expect_success 'merge --rerere-autoupdate' '\n '\n \n test_expect_success 'merge --no-rerere-autoupdate' '\n-\tgit config rerere.autoupdate true\n+\tgit config rerere.autoupdate true &&\n \tgit reset --hard &&\n \tgit checkout version2 &&\n \ttest_must_fail git merge --no-rerere-autoupdate fifth &&\n-- \n1.7.1.5.g8d03f\n"},{"id":"140875","messageId":"20100504025217.GA7322@progeny.tock","threadId":"23675","inReplyTo":"20100504015635.GA7258@progeny.tock","subject":"[PATCH v2 0/5] jn/shortlog","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T02:52:17Z","receivedAt":"2010-05-04T02:52:17Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> apparently shortlog does not default to HEAD when stdin is not a\n> tty.\n> \n> Possible fixes:\n> \n>  - document the current unfriendly behavior\n>  - default to HEAD when input is empty\n\nHere’s the uncontroversial half.\n\nPatch 1 is new: it explains why scripts that mean HEAD need to explicitly\nsay so.  The remaining patches are just like before, except tests pass a\nHEAD arg now.  Sorry about the breakage, and thanks for catching it.\n\nJonathan Nieder (4):\n  Documentation/shortlog: scripted users should not rely on implicit\n    HEAD\n  t4201 (shortlog): guard setup with test_expect_success\n  t4201 (shortlog): Test output format with multiple authors\n  shortlog: Document and test --format option\n\nWill Palmer (1):\n  pretty: Respect --abbrev option\n\n Documentation/git-shortlog.txt |   15 +++++-\n builtin/shortlog.c             |    3 +-\n pretty.c                       |    7 ++-\n shortlog.h                     |    1 +\n t/t4201-shortlog.sh            |  116 +++++++++++++++++++++++++++++++--------\n t/t6006-rev-list-format.sh     |   19 +++++++\n 6 files changed, 132 insertions(+), 29 deletions(-)\n"},{"id":"140876","messageId":"20100504025710.GB7322@progeny.tock","threadId":"23675","inReplyTo":"20100504025217.GA7322@progeny.tock","subject":"[PATCH 1/5] Documentation/shortlog: scripted users should not rely on implicit HEAD","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T02:57:10Z","receivedAt":"2010-05-04T02:57:10Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"When passed no revision arguments, ‘git shortlog’ reads a log from\nstdin if and only if stdin is not a tty.  So scripts that need to\nfunction identically when standard input is a terminal (as when run\ninteractively) and not (as when run through a cron job) should either\nsupply a log themselves or specify the desired revisions explicitly.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Documentation/git-shortlog.txt |    7 ++++++-\n 1 files changed, 6 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex dfd4d0c..f11ea90 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n git log --pretty=short | 'git shortlog' [-h] [-n] [-s] [-e] [-w]\n-'git shortlog' [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] [<committish>...]\n+'git shortlog' [-n|--numbered] [-s|--summary] [-e|--email] [-w[<width>[,<indent1>[,<indent2>]]]] <commit>...\n \n DESCRIPTION\n -----------\n@@ -19,6 +19,11 @@ the first line of the commit message will be shown.\n \n Additionally, \"[PATCH]\" will be stripped from the commit description.\n \n+If no revisions are passed on the command line and either standard input\n+is not a terminal or there is no current branch, 'git shortlog' will\n+output a summary of the log read from standard input, without\n+reference to the current repository.\n+\n OPTIONS\n -------\n \n-- \n1.6.5\n"},{"id":"140877","messageId":"20100504025736.GC7322@progeny.tock","threadId":"23675","inReplyTo":"20100504025217.GA7322@progeny.tock","subject":"[PATCH 2/5] t4201 (shortlog): guard setup with test_expect_success","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T02:57:36Z","receivedAt":"2010-05-04T02:57:36Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Follow the current prevailing style.  This also has the benefit of\ncapturing any stray output and noticing if any of the setup commands\nstart failing.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nAs before.\n\n t/t4201-shortlog.sh |   68 +++++++++++++++++++++++++++++---------------------\n 1 files changed, 39 insertions(+), 29 deletions(-)\n\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex a01e55b..438a826 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -8,30 +8,38 @@ test_description='git shortlog\n \n . ./test-lib.sh\n \n-echo 1 > a1\n-git add a1\n-tree=$(git write-tree)\n-commit=$( (echo \"Test\"; echo) | git commit-tree $tree )\n-git update-ref HEAD $commit\n-\n-echo 2 > a1\n-git commit --quiet -m \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" a1\n-\n-# test if the wrapping is still valid when replacing all i's by treble clefs.\n-echo 3 > a1\n-git commit --quiet -m \"$(echo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" | sed \"s/i/1234/g\" | tr 1234 '\\360\\235\\204\\236')\" a1\n-\n-# now fsck up the utf8\n-git config i18n.commitencoding non-utf-8\n-echo 4 > a1\n-git commit --quiet -m \"$(echo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" | sed \"s/i/1234/g\" | tr 1234 '\\370\\235\\204\\236')\" a1\n-\n-echo 5 > a1\n-git commit --quiet -m \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" a1\n-\n-git shortlog -w HEAD > out\n+test_expect_success 'setup' '\n+\techo 1 >a1 &&\n+\tgit add a1 &&\n+\ttree=$(git write-tree) &&\n+\tcommit=$(printf \"%s\\n\" \"Test\" \"\" | git commit-tree \"$tree\") &&\n+\tgit update-ref HEAD \"$commit\" &&\n+\n+\techo 2 >a1 &&\n+\tgit commit --quiet -m \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" a1 &&\n+\n+\t# test if the wrapping is still valid\n+\t# when replacing all is by treble clefs.\n+\techo 3 >a1 &&\n+\tgit commit --quiet -m \"$(\n+\t\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" |\n+\t\tsed \"s/i/1234/g\" |\n+\t\ttr 1234 \"\\360\\235\\204\\236\")\" a1 &&\n+\n+\t# now fsck up the utf8\n+\tgit config i18n.commitencoding non-utf-8 &&\n+\techo 4 >a1 &&\n+\tgit commit --quiet -m \"$(\n+\t\techo \"This is a very, very long first line for the commit message to see if it is wrapped correctly\" |\n+\t\tsed \"s/i/1234/g\" |\n+\t\ttr 1234 \"\\370\\235\\204\\236\")\" a1 &&\n+\n+\techo 5 >a1 &&\n+\tgit commit --quiet -m \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" a1\n+'\n \n-cat > expect << EOF\n+test_expect_success 'shortlog wrapping' '\n+\tcat >expect <<\\EOF &&\n A U Thor (5):\n       Test\n       This is a very, very long first line for the commit message to see if\n@@ -44,13 +52,15 @@ A U Thor (5):\n          56\t78\n \n EOF\n+\tgit shortlog -w HEAD >out &&\n+\ttest_cmp expect out\n+'\n \n-test_expect_success 'shortlog wrapping' 'test_cmp expect out'\n-\n-git log HEAD > log\n-GIT_DIR=non-existing git shortlog -w < log > out\n-\n-test_expect_success 'shortlog from non-git directory' 'test_cmp expect out'\n+test_expect_success 'shortlog from non-git directory' '\n+\tgit log HEAD >log &&\n+\tGIT_DIR=non-existing git shortlog -w <log >out &&\n+\ttest_cmp expect out\n+'\n \n iconvfromutf8toiso88591() {\n \tprintf \"%s\" \"$*\" | iconv -f UTF-8 -t ISO8859-1\n-- \n1.6.5\n"},{"id":"140878","messageId":"20100504025804.GD7322@progeny.tock","threadId":"23675","inReplyTo":"20100504025217.GA7322@progeny.tock","subject":"[PATCH 3/5] t4201 (shortlog): Test output format with multiple authors","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T02:58:04Z","receivedAt":"2010-05-04T02:58:04Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nAs before.\n\n t/t4201-shortlog.sh |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex 438a826..6bfd0c0 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -36,6 +36,10 @@ test_expect_success 'setup' '\n \n \techo 5 >a1 &&\n \tgit commit --quiet -m \"a\t\t\t\t\t\t\t\t12\t34\t56\t78\" a1\n+\n+\techo 6 >a1 &&\n+\tgit commit --quiet -m \"Commit by someone else\" \\\n+\t\t--author=\"Someone else <not!me>\" a1\n '\n \n test_expect_success 'shortlog wrapping' '\n@@ -51,6 +55,9 @@ A U Thor (5):\n       a\t\t\t\t\t\t\t\t12\t34\n          56\t78\n \n+Someone else (1):\n+      Commit by someone else\n+\n EOF\n \tgit shortlog -w HEAD >out &&\n \ttest_cmp expect out\n-- \n1.6.5\n"},{"id":"140879","messageId":"20100504025954.GE7322@progeny.tock","threadId":"23675","inReplyTo":"20100504025217.GA7322@progeny.tock","subject":"[PATCH 4/5] shortlog: Document and test --format option","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T02:59:55Z","receivedAt":"2010-05-04T02:59:55Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Do not document the --pretty synonym, since it takes too long to\nexplain the name to people.\n\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n - Pass HEAD to shortlog\n - Use {asterisk} helper for manual\n\n Documentation/git-shortlog.txt |    8 ++++++\n t/t4201-shortlog.sh            |   53 +++++++++++++++++++++++++++++++++++++++-\n 2 files changed, 60 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex f11ea90..a820fcb 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -44,6 +44,14 @@ OPTIONS\n --email::\n \tShow the email address of each author.\n \n+--format[='<format>']::\n+\tInstead of the commit subject, use some other information to\n+\tdescribe each commit.  '<format>' can be any string accepted\n+\tby the `--format` option of 'git log', such as '{asterisk} [%h] %s'.\n+\t(See the \"PRETTY FORMATS\" section of linkgit:git-log[1].)\n+\n+\tEach pretty-printed commit will be rewrapped before it is shown.\n+\n -w[<width>[,<indent1>[,<indent2>]]]::\n \tLinewrap the output by wrapping each line at `width`.  The first\n \tline of each entry is indented by `indent1` spaces, and the second\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex 6bfd0c0..13fdeb2 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -39,7 +39,58 @@ test_expect_success 'setup' '\n \n \techo 6 >a1 &&\n \tgit commit --quiet -m \"Commit by someone else\" \\\n-\t\t--author=\"Someone else <not!me>\" a1\n+\t\t--author=\"Someone else <not!me>\" a1 &&\n+\n+\tcat >expect.template <<-\\EOF\n+\tA U Thor (5):\n+\t      SUBJECT\n+\t      SUBJECT\n+\t      SUBJECT\n+\t      SUBJECT\n+\t      SUBJECT\n+\n+\tSomeone else (1):\n+\t      SUBJECT\n+\n+\tEOF\n+'\n+\n+fuzz() {\n+\tfile=$1 &&\n+\tsed \"\n+\t\t\ts/$_x40/OBJECT_NAME/g\n+\t\t\ts/$_x05/OBJID/g\n+\t\t\ts/^ \\{6\\}[CTa].*/      SUBJECT/g\n+\t\t\ts/^ \\{8\\}[^ ].*/        CONTINUATION/g\n+\t\t\" <\"$file\" >\"$file.fuzzy\" &&\n+\tsed \"/CONTINUATION/ d\" <\"$file.fuzzy\"\n+}\n+\n+test_expect_success 'default output format' '\n+\tgit shortlog HEAD >log &&\n+\tfuzz log >log.predictable &&\n+\ttest_cmp expect.template log.predictable\n+'\n+\n+test_expect_success 'pretty format' '\n+\tsed s/SUBJECT/OBJECT_NAME/ expect.template >expect &&\n+\tgit shortlog --format=\"%H\" HEAD >log &&\n+\tfuzz log >log.predictable &&\n+\ttest_cmp expect log.predictable\n+'\n+\n+test_expect_failure '--abbrev' '\n+\tsed s/SUBJECT/OBJID/ expect.template >expect &&\n+\tgit shortlog --format=\"%h\" --abbrev=5 HEAD >log &&\n+\tfuzz log >log.predictable &&\n+\ttest_cmp expect log.predictable\n+'\n+\n+test_expect_success 'output from user-defined format is re-wrapped' '\n+\tsed \"s/SUBJECT/two lines/\" expect.template >expect &&\n+\tgit shortlog --format=\"two%nlines\" HEAD >log &&\n+\tfuzz log >log.predictable &&\n+\ttest_cmp expect log.predictable\n '\n \n test_expect_success 'shortlog wrapping' '\n-- \n1.6.5\n"},{"id":"140880","messageId":"20100504031856.GF7322@progeny.tock","threadId":"23675","inReplyTo":"20100504025217.GA7322@progeny.tock","subject":"[PATCH 5/5] pretty: Respect --abbrev option","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T03:18:57Z","receivedAt":"2010-05-04T03:18:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Prior to this, the output of git log -1 --format=%h was always 7\ncharacters long, without regard to whether --abbrev had been passed.\n\nSigned-off-by: Will Palmer <wmpalmer@gmail.com>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nincorporating some tests by Will Palmer:\nhttp://thread.gmane.org/gmane.comp.version-control.git/146054/focus=146057\n\n builtin/shortlog.c         |    3 ++-\n pretty.c                   |    7 ++++---\n shortlog.h                 |    1 +\n t/t4201-shortlog.sh        |    2 +-\n t/t6006-rev-list-format.sh |   31 +++++++++++++++++++++++++++++++\n 5 files changed, 39 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin/shortlog.c b/builtin/shortlog.c\nindex 06320f5..5089502 100644\n--- a/builtin/shortlog.c\n+++ b/builtin/shortlog.c\n@@ -162,7 +162,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)\n \t\t    sha1_to_hex(commit->object.sha1));\n \tif (log->user_format) {\n \t\tstruct pretty_print_context ctx = {0};\n-\t\tctx.abbrev = DEFAULT_ABBREV;\n+\t\tctx.abbrev = log->abbrev;\n \t\tctx.subject = \"\";\n \t\tctx.after_subject = \"\";\n \t\tctx.date_mode = DATE_NORMAL;\n@@ -290,6 +290,7 @@ parse_done:\n \t}\n \n \tlog.user_format = rev.commit_format == CMIT_FMT_USERFORMAT;\n+\tlog.abbrev = rev.abbrev;\n \n \t/* assume HEAD if from a tty */\n \tif (!nongit && !rev.pending.nr && isatty(0))\ndiff --git a/pretty.c b/pretty.c\nindex 7cb3a2a..1430616 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -716,7 +716,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,\n \t\tif (add_again(sb, &c->abbrev_commit_hash))\n \t\t\treturn 1;\n \t\tstrbuf_addstr(sb, find_unique_abbrev(commit->object.sha1,\n-\t\t                                     DEFAULT_ABBREV));\n+\t\t                                     c->pretty_ctx->abbrev));\n \t\tc->abbrev_commit_hash.len = sb->len - c->abbrev_commit_hash.off;\n \t\treturn 1;\n \tcase 'T':\t\t/* tree hash */\n@@ -726,7 +726,7 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,\n \t\tif (add_again(sb, &c->abbrev_tree_hash))\n \t\t\treturn 1;\n \t\tstrbuf_addstr(sb, find_unique_abbrev(commit->tree->object.sha1,\n-\t\t                                     DEFAULT_ABBREV));\n+\t\t                                     c->pretty_ctx->abbrev));\n \t\tc->abbrev_tree_hash.len = sb->len - c->abbrev_tree_hash.off;\n \t\treturn 1;\n \tcase 'P':\t\t/* parent hashes */\n@@ -743,7 +743,8 @@ static size_t format_commit_one(struct strbuf *sb, const char *placeholder,\n \t\t\tif (p != commit->parents)\n \t\t\t\tstrbuf_addch(sb, ' ');\n \t\t\tstrbuf_addstr(sb, find_unique_abbrev(\n-\t\t\t\t\tp->item->object.sha1, DEFAULT_ABBREV));\n+\t\t\t\t\tp->item->object.sha1,\n+\t\t\t\t\tc->pretty_ctx->abbrev));\n \t\t}\n \t\tc->abbrev_parent_hashes.len = sb->len -\n \t\t                              c->abbrev_parent_hashes.off;\ndiff --git a/shortlog.h b/shortlog.h\nindex bc02cc2..de4f86f 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -12,6 +12,7 @@ struct shortlog {\n \tint in1;\n \tint in2;\n \tint user_format;\n+\tint abbrev;\n \n \tchar *common_repo_prefix;\n \tint email;\ndiff --git a/t/t4201-shortlog.sh b/t/t4201-shortlog.sh\nindex 899ddbe..c49ca98 100755\n--- a/t/t4201-shortlog.sh\n+++ b/t/t4201-shortlog.sh\n@@ -79,7 +79,7 @@ test_expect_success 'pretty format' '\n \ttest_cmp expect log.predictable\n '\n \n-test_expect_failure '--abbrev' '\n+test_expect_success '--abbrev' '\n \tsed s/SUBJECT/OBJID/ expect.template >expect &&\n \tgit shortlog --format=\"%h\" --abbrev=5 >log &&\n \tfuzz log >log.predictable &&\ndiff --git a/t/t6006-rev-list-format.sh b/t/t6006-rev-list-format.sh\nindex a49b7c5..42a77ff 100755\n--- a/t/t6006-rev-list-format.sh\n+++ b/t/t6006-rev-list-format.sh\n@@ -191,6 +191,31 @@ test_expect_success 'add LF before non-empty (2)' '\n \tgrep \"^$\" actual\n '\n \n+test_expect_success '--abbrev' '\n+\techo SHORT SHORT SHORT >expect2 &&\n+\techo LONG LONG LONG >expect3 &&\n+\tgit log -1 --format=\"%h %h %h\" HEAD >actual1 &&\n+\tgit log -1 --abbrev=5 --format=\"%h %h %h\" HEAD >actual2 &&\n+\tgit log -1 --abbrev=5 --format=\"%H %H %H\" HEAD >actual3 &&\n+\tsed -e \"s/$_x40/LONG/g\" -e \"s/$_x05/SHORT/g\" <actual2 >fuzzy2 &&\n+\tsed -e \"s/$_x40/LONG/g\" -e \"s/$_x05/SHORT/g\" <actual3 >fuzzy3 &&\n+\ttest_cmp expect2 fuzzy2 &&\n+\ttest_cmp expect3 fuzzy3 &&\n+\t! test_cmp actual1 actual2\n+'\n+\n+test_expect_success '%H is not affected by --abbrev-commit' '\n+\tgit log -1 --format=%H --abbrev-commit --abbrev=20 HEAD >actual &&\n+\tlen=$(wc -c <actual) &&\n+\ttest $len = 40\n+'\n+\n+test_expect_success '%h is not affected by --abbrev-commit' '\n+\tgit log -1 --format=%h --abbrev-commit --abbrev=20 HEAD >actual &&\n+\tlen=$(wc -c <actual) &&\n+\ttest $len = 20\n+'\n+\n test_expect_success '\"%h %gD: %gs\" is same as git-reflog' '\n \tgit reflog >expect &&\n \tgit log -g --format=\"%h %gD: %gs\" >actual &&\n@@ -203,6 +228,12 @@ test_expect_success '\"%h %gD: %gs\" is same as git-reflog (with date)' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success '\"%h %gD: %gs\" is same as git-reflog (with --abbrev)' '\n+\tgit reflog --abbrev=13 --date=raw >expect &&\n+\tgit log -g --abbrev=13 --format=\"%h %gD: %gs\" --date=raw >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success '%gd shortens ref name' '\n \techo \"master@{0}\" >expect.gd-short &&\n \tgit log -g -1 --format=%gd refs/heads/master >actual.gd-short &&\n-- \n1.7.1\n"},{"id":"140894","messageId":"20100504083421.GA8338@progeny.tock","threadId":"23675","inReplyTo":"20100504031856.GF7322@progeny.tock","subject":"Re: [PATCH 5/5] pretty: Respect --abbrev option","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-05-04T08:34:21Z","receivedAt":"2010-05-04T08:34:21Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Jonathan Nieder wrote:\n\n> Subject: [PATCH 5/5] pretty: Respect --abbrev option\n[...]\n> Signed-off-by: Will Palmer <wmpalmer@gmail.com>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThis patch was by Will Palmer <wmpalmer@gmail.com> (except two\nof the tests).  Since I don’t use ‘git send-email’, I keep\nforgetting to include the From: pseudo-header.\n\nSorry for the trouble,\nJonathan\n\ndiff --git a/pretty.c b/pretty.c\nindex 1430616..e5dea91 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -908,6 +908,7 @@ static void pp_header(enum cmit_fmt fmt,\n \t\t      const char *encoding,\n \t\t      const struct commit *commit,\n \t\t      const char **msg_p,\n+\t\t      const char **author_p,\n \t\t      struct strbuf *sb)\n {\n \tint parents_shown = 0;\n@@ -954,6 +955,8 @@ static void pp_header(enum cmit_fmt fmt,\n \t\t * FULLER shows both authors and dates.\n \t\t */\n \t\tif (!memcmp(line, \"author \", 7)) {\n+\t\t\tif (author_p)\n+\t\t\t\t*author_p = line + 7;\n \t\t\tstrbuf_grow(sb, linelen + 80);\n \t\t\tpp_user_info(\"Author\", fmt, sb, line + 7, dmode, encoding);\n \t\t}\n@@ -1004,6 +1007,22 @@ void pp_title_line(enum cmit_fmt fmt,\n \tstrbuf_release(&title);\n }\n \n+static void pp_in_body_author(struct strbuf *sb,\n+\t\t\t      const char *author_line)\n+{\n+\tconst char *author_end, *sender;\n+\n+\tauthor_end = strchr(author_line, '>') + 1;\n+\tsender = git_author_info(IDENT_NO_DATE);\n+\tif (!strncmp(author_line, sender, author_end - author_line))\n+\t\treturn;\n+\n+\tstrbuf_addstr(sb, \"From: \");\n+\tstrbuf_add(sb, author_line, author_end - author_line);\n+\tstrbuf_addch(sb, '\\n');\n+\tstrbuf_addch(sb, '\\n');\n+}\n+\n void pp_remainder(enum cmit_fmt fmt,\n \t\t  const char **msg_p,\n \t\t  struct strbuf *sb,\n@@ -1057,6 +1076,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \tunsigned long beginning_of_body;\n \tint indent = 4;\n \tconst char *msg = commit->buffer;\n+\tconst char *author = NULL;\n \tchar *reencoded;\n \tconst char *encoding;\n \tint need_8bit_cte = context->need_8bit_cte;\n@@ -1082,15 +1102,13 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \t\tint i, ch, in_body;\n \n \t\tfor (in_body = i = 0; (ch = msg[i]); i++) {\n-\t\t\tif (!in_body) {\n-\t\t\t\t/* author could be non 7-bit ASCII but\n-\t\t\t\t * the log may be so; skip over the\n-\t\t\t\t * header part first.\n-\t\t\t\t */\n-\t\t\t\tif (ch == '\\n' && msg[i+1] == '\\n')\n-\t\t\t\t\tin_body = 1;\n-\t\t\t}\n-\t\t\telse if (non_ascii(ch)) {\n+\t\t\t/*\n+\t\t\t * If the author is non 7-bit ASCII but\n+\t\t\t * the log is 7bit, we still need a\n+\t\t\t * Content-type field, in case an in-body\n+\t\t\t * From: line is required.\n+\t\t\t */\n+\t\t\tif (non_ascii(ch)) {\n \t\t\t\tneed_8bit_cte = 1;\n \t\t\t\tbreak;\n \t\t\t}\n@@ -1098,7 +1116,7 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \t}\n \n \tpp_header(fmt, context->abbrev, context->date_mode, encoding,\n-\t\t  commit, &msg, sb);\n+\t\t  commit, &msg, &author, sb);\n \tif (fmt != CMIT_FMT_ONELINE && !context->subject) {\n \t\tstrbuf_addch(sb, '\\n');\n \t}\n@@ -1111,6 +1129,9 @@ void pretty_print_commit(enum cmit_fmt fmt, const struct commit *commit,\n \t\tpp_title_line(fmt, &msg, sb, context->subject,\n \t\t\t      context->after_subject, encoding, need_8bit_cte);\n \n+\tif (fmt == CMIT_FMT_EMAIL)\n+\t\tpp_in_body_author(sb, author);\n+\n \tbeginning_of_body = sb->len;\n \tif (fmt != CMIT_FMT_ONELINE)\n \t\tpp_remainder(fmt, &msg, sb, indent);\n-- \n"},{"id":"141249","messageId":"201005081713.49937.j6t@kdbg.org","threadId":"23675","inReplyTo":"4BDDDA21.4090304@kdbg.org","subject":"[PATCH 1/2] Have set_try_to_free_routine return the previous routine","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-05-08T15:13:49Z","receivedAt":"2010-05-08T15:13:49Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"This effectively requires from the callers of set_try_to_free_routine to\ntreat the try-to-free-routines as a stack.\n\nWe will need this for the next patch where the only current caller cannot\ndepend on that the previously set routine was the default routine.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\nOn Sonntag, 2. Mai 2010, Johannes Sixt wrote:\n> Am 02.05.2010 18:12, schrieb Junio C Hamano:\n> > * np/malloc-threading (2010-04-08) 2 commits\n> >\n> > * js/async-thread (2010-03-09) 7 commits\n>\n> Note that np/malloc-threading does not help the potential xmalloc race\n> condition in js/async-thread topic at all. :-( np/malloc-threading is only\n> about a race that is internal in pack-objects.\n>\n> Now that you force me to think about the problem, I suggest something along\n> these lines: Disable try_to_free_routine when GIT_TRACE is set, and require\n> callers of set_try_to_free_routine to restore the previous routine.\n\nHere is a 2-patch series that implements this idea. I wrote it on top of\nnp/malloc-threading, because it implements the infrastructure that is\nnecessary for this.\n\n builtin-pack-objects.c |    6 ++++--\n git-compat-util.h      |    3 ++-\n wrapper.c              |    6 ++++--\n 3 files changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/builtin-pack-objects.c b/builtin-pack-objects.c\nindex 26fc7cd..5279cd9 100644\n--- a/builtin-pack-objects.c\n+++ b/builtin-pack-objects.c\n@@ -1556,6 +1556,8 @@ static void try_to_free_from_threads(size_t size)\n \tread_unlock();\n }\n \n+try_to_free_t old_try_to_free_routine;\n+\n /*\n  * The main thread waits on the condition that (at least) one of the workers\n  * has stopped working (which is indicated in the .working member of\n@@ -1590,12 +1592,12 @@ static void init_threaded_search(void)\n \tpthread_mutex_init(&cache_mutex, NULL);\n \tpthread_mutex_init(&progress_mutex, NULL);\n \tpthread_cond_init(&progress_cond, NULL);\n-\tset_try_to_free_routine(try_to_free_from_threads);\n+\told_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads);\n }\n \n static void cleanup_threaded_search(void)\n {\n-\tset_try_to_free_routine(NULL);\n+\tset_try_to_free_routine(old_try_to_free_routine);\n \tpthread_cond_destroy(&progress_cond);\n \tpthread_mutex_destroy(&read_mutex);\n \tpthread_mutex_destroy(&cache_mutex);\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 1c171db..828aada 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -346,7 +346,8 @@ static inline char *gitstrchrnul(const char *s, int c)\n \n extern void release_pack_memory(size_t, int);\n \n-extern void set_try_to_free_routine(void (*routine)(size_t));\n+typedef void (*try_to_free_t)(size_t);\n+extern try_to_free_t set_try_to_free_routine(try_to_free_t);\n \n extern char *xstrdup(const char *str);\n extern void *xmalloc(size_t size);\ndiff --git a/wrapper.c b/wrapper.c\nindex 62edb57..8aa9df9 100644\n--- a/wrapper.c\n+++ b/wrapper.c\n@@ -10,9 +10,11 @@ static void try_to_free_builtin(size_t size)\n \n static void (*try_to_free_routine)(size_t size) = try_to_free_builtin;\n \n-void set_try_to_free_routine(void (*routine)(size_t))\n+try_to_free_t set_try_to_free_routine(try_to_free_t routine)\n {\n-\ttry_to_free_routine = (routine) ? routine : try_to_free_builtin;\n+\ttry_to_free_t old = try_to_free_routine;\n+\ttry_to_free_routine = routine;\n+\treturn old;\n }\n \n char *xstrdup(const char *str)\n-- \n1.7.1.64.ga1799.dirty\n"},{"id":"141250","messageId":"201005081718.07355.j6t@kdbg.org","threadId":"23675","inReplyTo":"201005081713.49937.j6t@kdbg.org","subject":"[PATCH 2/2] Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-05-08T15:18:06Z","receivedAt":"2010-05-08T15:18:06Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"This avoids a potential race condition when async procedures are\nimplemented as threads where release_pack_memory() can be called from\ndifferent threads without locking under memory pressure.\n\nSigned-off-by: Johannes Sixt <j6t@kdbg.org>\n---\n It is worthwhile to have this in np/malloc-threading (and in maint or\n master) even if js/async-thread is not in master, yet, because on\n Windows we already have async procedures implemented in threads.\n\n trace.c |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/trace.c b/trace.c\nindex 4229ae1..1e560cb 100644\n--- a/trace.c\n+++ b/trace.c\n@@ -25,6 +25,10 @@\n #include \"cache.h\"\n #include \"quote.h\"\n \n+void do_nothing(size_t unused)\n+{\n+}\n+\n /* Get a trace file descriptor from GIT_TRACE env variable. */\n static int get_trace_fd(int *need_close)\n {\n@@ -72,6 +76,7 @@ void trace_printf(const char *fmt, ...)\n \tif (!fd)\n \t\treturn;\n \n+\tset_try_to_free_routine(do_nothing);\t/* is never reset */\n \tstrbuf_init(&buf, 64);\n \tva_start(ap, fmt);\n \tlen = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);\n@@ -103,6 +108,7 @@ void trace_argv_printf(const char **argv, const char *fmt, ...)\n \tif (!fd)\n \t\treturn;\n \n+\tset_try_to_free_routine(do_nothing);\t/* is never reset */\n \tstrbuf_init(&buf, 64);\n \tva_start(ap, fmt);\n \tlen = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);\n-- \n1.7.1.64.ga1799.dirty\n"},{"id":"141254","messageId":"20100508164319.GA19037@localhost","threadId":"23675","inReplyTo":"7v7hnmuvtv.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (May 2010, #01; Sun, 2)","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2010-05-08T16:43:19Z","receivedAt":"2010-05-08T16:43:19Z","isPatch":false,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"On Sun, May 02, 2010 at 09:12:12AM -0700, Junio C Hamano wrote:\n\n> * cb/assume-unchanged-fix (2010-05-01) 2 commits\n>  - Documentation: git-add does not update files marked \"assume unchanged\"\n\nPlease remove the second hunk from that commit, where I add \"The assume\nunchanged bit is unset for all paths.\" That is clearly wrong.\n\nThank you.\n\nClemens\n"}]}