{"thread":{"id":"27551","subject":"What's cooking in git.git (Jun 2011, #01; Sun, 5)","startedAt":"2011-06-06T06:29:13Z","lastAt":"2011-09-16T16:20:04Z","messageCount":17,"participants":["Junio C Hamano","Johannes Sixt","Erik Faye-Lund","Jamey Sharp","Bert Wesarg","Josh Triplett","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"169335","messageId":"7vsjrna2x2.fsf@alter.siamese.dyndns.org","threadId":"27551","inReplyTo":null,"subject":"What's cooking in git.git (Jun 2011, #01; Sun, 5)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-06T06:29:13Z","receivedAt":"2011-06-06T06:29:13Z","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'.\n\nWe will be in the feature freeze, and 1.7.6-rc1 will be tagged in a few\ndays. Unless it is a very obviously correct fix to trivial bug (either\ncode or documentation), nothing other than regression fixes will graduate\nto \"master\".\n\nSubsystem people are asked to kindly give pull requests to me.\n\n--------------------------------------------------\n[New Topics]\n\n* js/ref-namespaces (2011-06-05) 4 commits\n - ref namespaces: documentation\n - ref namespaces: support remote repositories via upload-pack and receive-pack\n - ref namespaces: infrastructure\n - Fix prefix handling in ref iteration functions\n\nFairly involved feature enhancement, and breaks tests when merged to 'pu'.\nNot urgent. Will not merge before 1.7.6.\n\n* db/http-cookies (2011-06-03) 1 commit\n - http: pass http.cookiefile using CURLOPT_COOKIEFILE\n\nFairly trivial enhancement.\nNot urgent. Will not merge before 1.7.6.\n\n* jc/maint-1.7.3-checkout-describe (2011-06-05) 1 commit\n - checkout -b <name>: correctly detect existing branch\n\nFairly trivial bugfix.\nNot urgent. Will not merge before 1.7.6.\n\n* jk/clone-detached (2011-06-05) 4 commits\n - remote-testgit: short-term fix to allow t5800 pass\n - clone: always fetch remote HEAD\n - consider only branches in guess_remote_head\n - t: add tests for cloning remotes with detached HEAD\n\nSomewhat involved bugfix.\nNot urgent. Will not merge before 1.7.6.\n\n* jk/maint-1.7.2-status-ignored (2011-06-02) 2 commits\n  (merged to 'next' on 2011-06-02 at 8626cc6)\n + git status --ignored: tests and docs\n + status: fix bug with missing --ignore files\n\nFairly trivial bugfix.\nNot urgent. Will not merge before 1.7.6.\n\n* jl/submodule-add-relurl-wo-upstream (2011-06-05) 1 commit\n - submodule add: improve message when resolving a relative url fails\n\nThis is just a message change without loosening a seemingly overtight\nrestriction in the code. It might turn out to be a good idea to loosen\nthe check.\n\nNot urgent. Will not merge before 1.7.6.\n\n* jn/gitweb-docs (2011-06-03) 3 commits\n  (merged to 'next' on 2011-06-05 at 691c7e6)\n + gitweb: Move \"Requirements\" up in gitweb/INSTALL\n  (merged to 'next' on 2011-06-02 at 56cba41)\n + gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL\n + gitweb: Move information about installation from README to INSTALL\n\nShould be safe.\nWill merge to \"master\" before 1.7.6-rc1.\n\n* jn/mime-type-with-params (2011-06-05) 1 commit\n  (merged to 'next' on 2011-06-05 at 697f9d2)\n + gitweb: Fix usability of $prevent_xss\n\nWill merge to \"master\" before 1.7.6-rc1.\n\n* rs/grep-color (2011-06-05) 3 commits\n - grep: add --heading\n - grep: add --break\n - grep: fix coloring of hunk marks between files\n\nFairly straightforward feature enhancement.\nNot urgent. Will not merge before 1.7.6.\n\n--------------------------------------------------\n[Stalled]\n\n* jk/maint-merge-rename-create (2011-03-25) 3 commits\n - merge: turn on rewrite detection\n - merge: handle renames with replacement content\n - t3030: fix accidental success in symlink rename\n\nPeff wanted to reroll this.\n\n* jc/index-pack (2011-06-05) 9 commits\n - verify-pack: use index-pack --verify\n - index-pack: show histogram when emulating \"verify-pack -v\"\n - index-pack: start learning to emulate \"verify-pack -v\"\n - index-pack: a miniscule refactor\n - index-pack --verify: read anomalous offsets from v2 idx file\n - write_idx_file: need_large_offset() helper function\n - index-pack: --verify\n - write_idx_file: introduce a struct to hold idx customization options\n - index-pack: group the delta-base array entries also by type\n\nKilled \"verify-pack\" ;-) The next will be to update fsck, which would be a\nbigger task.\n\nNot urgent. Will not merge before 1.7.6.\n\n* jh/receive-count-limit (2011-05-23) 10 commits\n - receive-pack: Allow server to refuse pushes with too many objects\n - pack-objects: Estimate pack size; abort early if pack size limit is exceeded\n - send-pack/receive-pack: Allow server to refuse pushing too large packs\n - pack-objects: Allow --max-pack-size to be used together with --stdout\n - send-pack/receive-pack: Allow server to refuse pushes with too many commits\n - pack-objects: Teach new option --max-commit-count, limiting #commits in pack\n - receive-pack: Prepare for addition of the new 'limit-*' family of capabilities\n - Tighten rules for matching server capabilities in server_supports()\n - send-pack: Attempt to retrieve remote status even if pack-objects fails\n - Update technical docs to reflect side-band-64k capability in receive-pack\n\nWould need another round to separate per-pack and per-session limits.\nNot urgent. Will not merge before 1.7.6.\n\n* jk/tag-contains (2010-07-05) 4 commits\n - Why is \"git tag --contains\" so slow?\n - default core.clockskew variable to one day\n - limit \"contains\" traversals based on commit timestamp\n - tag: speed up --contains calculation\n\nThe idea of the bottom one is probably Ok, except that the use of object\nflags needs to be rethought, or at least the helper needs to be moved to\nbuiltin/tag.c to make it clear that it should not be used outside the\ncurrent usage context.\n\n--------------------------------------------------\n[Cooking]\n\n* jc/diff-index-quick-exit-early (2011-05-31) 2 commits\n  (merged to 'next' on 2011-06-01 at 79d868a)\n + diff-index --quiet: learn the \"stop feeding the backend early\" logic\n + Merge remote-tracking branch 'ko/maint' into jc/diff-index-quick-exit-early\n (this branch uses jk/diff-not-so-quick.)\n\nNot urgent. Will not merge before 1.7.6.\n\n* jk/diff-not-so-quick (2011-05-31) 2 commits\n  (merged to 'next' on 2011-06-01 at 5f66784)\n + diff: futureproof \"stop feeding the backend early\" logic\n + diff_tree: disable QUICK optimization with diff filter\n (this branch is used by jc/diff-index-quick-exit-early.)\n\nWill merge to \"master\" before 1.7.6-rc1.\n\n* bc/maint-status-z-to-use-porcelain (2011-05-29) 2 commits\n  (merged to 'next' on 2011-06-01 at 4f44a91)\n + builtin/commit.c: set status_format _after_ option parsing\n + t7508: demonstrate status's failure to use --porcelain format with -z\n\nWill merge to \"master\" before 1.7.6-rc1.\n\n* ef/maint-win-verify-path (2011-05-27) 3 commits\n  (merged to 'next' on 2011-06-01 at f316f68)\n + verify_path: consider dos drive prefix\n + real_path: do not assume '/' is the path seperator\n + A Windows path starting with a backslash is absolute\n\nWill cook a bit longer.\n\n* jc/apply-nsbp (2011-05-27) 4 commits\n - War on nbsp: teach \"git apply\" to check and fix nbsp\n - War on nbsp: Add \"nbsp\" whitespace breakage class\n - War on nbsp: a bit of retreat\n - ws.c: add a helper to format comma separated messages\n\nWill probably drop.\nIt was fun to write, though.\n\n* jn/gitweb-js-blame (2011-05-27) 3 commits\n  (merged to 'next' on 2011-06-01 at a984a1b)\n + gitweb.js: use setTimeout rather than setInterval in blame_incremental.js\n + gitweb.js: No need for loop in blame_incremental's handleResponse()\n + gitweb.js: No need for inProgress in blame_incremental.js\n\nWill cook a bit longer.\n\n* mg/diff-stat-count (2011-05-27) 4 commits\n  (merged to 'next' on 2011-06-01 at 5cdb776)\n + diff --stat-count: finishing touches\n + diff-options.txt: describe --stat-{width,name-width,count}\n + diff: introduce --stat-lines to limit the stat lines\n + diff.c: omit hidden entries from namelen calculation with --stat\n\nNot urgent. Will not merge before 1.7.6.\n\n* da/git-prefix-everywhere (2011-06-02) 4 commits\n  (merged to 'next' on 2011-06-02 at 2ab66e7)\n + t/t7503-pre-commit-hook.sh: Add GIT_PREFIX tests\n  (merged to 'next' on 2011-05-30 at 9480900)\n + git-mergetool--lib: Make vimdiff retain the current directory\n + git: Remove handling for GIT_PREFIX\n + setup: Provide GIT_PREFIX to built-ins\n\nNot urgent. Will not merge before 1.7.6.\n\n* jc/streaming-filter (2011-05-26) 8 commits\n - t0021: test application of both crlf and ident\n - t0021-conversion.sh: fix NoTerminatingSymbolAtEOF test\n - streaming: filter cascading\n - streaming filter: ident filter\n - Add LF-to-CRLF streaming conversion\n - stream filter: add \"no more input\" to the filters\n - Add streaming filter API\n - convert.h: move declarations for conversion from cache.h\n (this branch uses jc/streaming.)\n\nTrivial lf-to-crlf and ident conversions can be performed without reading\neverything in-core first.\n\nNot urgent. Will not merge before 1.7.6.\n\n* jk/combine-diff-binary-etc (2011-05-24) 5 commits\n  (merged to 'next' on 2011-05-24 at 07cf180)\n + combine-diff: respect textconv attributes\n + refactor get_textconv to not require diff_filespec\n + combine-diff: handle binary files as binary\n + combine-diff: calculate mode_differs earlier\n + combine-diff: split header printing into its own function\n\nNot urgent. Will not merge before 1.7.6.\n\n* jc/advice-about-to-lose-commit (2011-05-24) 1 commit\n  (merged to 'next' on 2011-05-30 at 42385cc)\n + checkout: make advice when reattaching the HEAD less loud\n\nNot urgent. Will not merge before 1.7.6.\n\n* jc/streaming (2011-05-26) 14 commits\n  (merged to 'next' on 2011-05-26 at 7fdda8d)\n + sha1_file: use the correct type (ssize_t, not size_t) for read-style function\n  (merged to 'next' on 2011-05-23 at 7fd0b52)\n + streaming: read loose objects incrementally\n + sha1_file.c: expose helpers to read loose objects\n + streaming: read non-delta incrementally from a pack\n + streaming_write_entry(): support files with holes\n + convert: CRLF_INPUT is a no-op in the output codepath\n + streaming_write_entry(): use streaming API in write_entry()\n + streaming: a new API to read from the object store\n + write_entry(): separate two helper functions out\n + unpack_object_header(): make it public\n + sha1_object_info_extended(): hint about objects in delta-base cache\n + sha1_object_info_extended(): expose a bit more info\n + packed_object_info_detail(): do not return a string\n + Merge branches 'jc/convert', 'jc/bigfile' and 'jc/replacing' into jc/streaming\n (this branch is used by jc/streaming-filter.)\n\nNot urgent. Will not merge before 1.7.6.\n\n* ab/i18n-scripts (2011-05-21) 48 commits\n  (merged to 'next' on 2011-05-23 at 69164a3)\n + i18n: git-bisect bisect_next_check \"You need to\" message\n + i18n: git-bisect [Y/n] messages\n + i18n: git-bisect bisect_replay + $1 messages\n + i18n: git-bisect bisect_reset + $1 messages\n + i18n: git-bisect bisect_run + $@ messages\n + i18n: git-bisect die + eval_gettext messages\n + i18n: git-bisect die + gettext messages\n + i18n: git-bisect echo + eval_gettext message\n + i18n: git-bisect echo + gettext messages\n + i18n: git-bisect gettext + echo message\n + i18n: git-bisect add git-sh-i18n\n + i18n: git-stash drop_stash say/die messages\n + i18n: git-stash \"unknown option\" message\n + i18n: git-stash die + eval_gettext $1 messages\n + i18n: git-stash die + eval_gettext $* messages\n + i18n: git-stash die + eval_gettext messages\n + i18n: git-stash die + gettext messages\n + i18n: git-stash say + gettext messages\n + i18n: git-stash echo + gettext message\n + i18n: git-stash add git-sh-i18n\n + i18n: git-submodule \"blob\" and \"submodule\" messages\n + i18n: git-submodule \"path not initialized\" message\n + i18n: git-submodule \"[...] path is ignored\" message\n + i18n: git-submodule \"Entering [...]\" message\n + i18n: git-submodule $errmsg messages\n + i18n: git-submodule \"Submodule change[...]\" messages\n + i18n: git-submodule \"cached cannot be used\" message\n + i18n: git-submodule $update_module say + die messages\n + i18n: git-submodule die + eval_gettext messages\n + i18n: git-submodule say + eval_gettext messages\n + i18n: git-submodule echo + eval_gettext messages\n + i18n: git-submodule add git-sh-i18n\n + i18n: git-pull eval_gettext + warning message\n + i18n: git-pull eval_gettext + die message\n + i18n: git-pull die messages\n + i18n: git-pull add git-sh-i18n\n + i18n: git-am printf(1) message to eval_gettext\n + i18n: git-am core say messages\n + i18n: git-am \"Falling back\" say message\n + i18n: git-am \"Apply?\" message\n + i18n: git-am clean_abort messages\n + i18n: git-am cannot_fallback messages\n + i18n: git-am die messages\n + i18n: git-am gettext + gettext to stderr message\n + i18n: git-am eval_gettext messages\n + i18n: git-am multi-line getttext $msg; echo\n + i18n: git-am one-line gettext $msg; echo\n + i18n: git-am add git-sh-i18n\n\nRerolled.\nWill cook a bit longer.\n"},{"id":"169340","messageId":"4DEC7EE9.9060807@viscovery.net","threadId":"27551","inReplyTo":"7vsjrna2x2.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (Jun 2011, #01; Sun, 5)","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2011-06-06T07:16:57Z","receivedAt":"2011-06-06T07:16:57Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 6/6/2011 8:29, schrieb Junio C Hamano:\n> * ef/maint-win-verify-path (2011-05-27) 3 commits\n>   (merged to 'next' on 2011-06-01 at f316f68)\n>  + verify_path: consider dos drive prefix\n>  + real_path: do not assume '/' is the path seperator\n>  + A Windows path starting with a backslash is absolute\n> \n> Will cook a bit longer.\n\nI agree to all changes. There was a bit of back-and-forth about the\n\"verify_path\" change. Erik, Theo, would you please check whether the\nqueued version is the one you finally agreed on?\n\n-- Hannes\n"},{"id":"169342","messageId":"BANLkTim3Cd9yn=2NZ4K6dLJExTHgFUSR7A@mail.gmail.com","threadId":"27551","inReplyTo":"4DEC7EE9.9060807@viscovery.net","subject":"Re: What's cooking in git.git (Jun 2011, #01; Sun, 5)","fromName":"Erik Faye-Lund","fromEmail":"kusmabite@gmail.com","sentAt":"2011-06-06T07:38:32Z","receivedAt":"2011-06-06T07:38:32Z","isPatch":false,"sender":{"key":"kusmabite@gmail.com","avatar":"https://avatars.githubusercontent.com/u/47073?v=4"},"body":"On Mon, Jun 6, 2011 at 9:16 AM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Am 6/6/2011 8:29, schrieb Junio C Hamano:\n>> * ef/maint-win-verify-path (2011-05-27) 3 commits\n>>   (merged to 'next' on 2011-06-01 at f316f68)\n>>  + verify_path: consider dos drive prefix\n>>  + real_path: do not assume '/' is the path seperator\n>>  + A Windows path starting with a backslash is absolute\n>>\n>> Will cook a bit longer.\n>\n> I agree to all changes. There was a bit of back-and-forth about the\n> \"verify_path\" change. Erik, Theo, would you please check whether the\n> queued version is the one you finally agreed on?\n>\n> -- Hannes\n>\n\nThanks for pointing this out. No, it isn't the one me and Theo agreed\non; we simplified the logic a tas as well (but I never sent out a\nversion with that fixup squashed in). I'll send out an updated version\nin a few days (when I finally get some time for Git again).\n"},{"id":"169486","messageId":"1307470885-4018-1-git-send-email-jamey@minilop.net","threadId":"27551","inReplyTo":"7vsjrna2x2.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (Jun 2011, #01; Sun, 5)","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-06-07T18:21:21Z","receivedAt":"2011-06-07T18:21:21Z","isPatch":false,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"On Sun, Jun 05, 2011 at 11:29:13PM -0700, Junio C Hamano wrote:\n> * js/ref-namespaces (2011-06-05) 4 commits\n>  - ref namespaces: documentation\n>  - ref namespaces: support remote repositories via upload-pack and receive-pack\n>  - ref namespaces: infrastructure\n>  - Fix prefix handling in ref iteration functions\n> \n> Fairly involved feature enhancement, and breaks tests when merged to 'pu'.\n> Not urgent. Will not merge before 1.7.6.\n\nWe tracked down the test failure.  t5501 detects that pushing into a\nrepository with an alternate fails to make use of the alternate to avoid\nextra objects.  This failure occurs with the first patch in the series,\n\"Fix prefix handling in ref iteration functions\".  We added some\ndebugging code which revealed the cause:\n\nDEBUG: Ignoring ref \".have\" due to base \"refs/\"\n\nSo, the suggested change to actually use \"refs/\" as a filter caused this\nfailure.  Based on this, we'd tend to suggest that we should go back to\nthe version which preserved the existing behavior, to avoid breaking\nassumptions like this; that seems preferable to tracking down all the\nplaces that would break due to this new ref filtering.  Adding that\nfiltering and fixing all the resulting breakage seems like an entirely\nseparate change.\n\nThis patch series takes that approach.\n\nJosh Triplett and Jamey Sharp (4):\n  Fix prefix handling in ref iteration functions\n  Add infrastructure for ref namespaces\n  Support ref namespaces for remote repositories via upload-pack and\n    receive-pack\n  Add documentation for ref namespaces\n\n Documentation/Makefile                 |    2 +-\n Documentation/git-http-backend.txt     |    8 +++\n Documentation/git-receive-pack.txt     |    2 +-\n Documentation/git-upload-pack.txt      |    4 ++\n Documentation/git.txt                  |   13 +++++-\n Documentation/gitnamespaces.txt        |   75 ++++++++++++++++++++++++++++++++\n builtin/receive-pack.c                 |   34 ++++++++++++---\n cache.h                                |    3 +\n contrib/completion/git-completion.bash |    3 +-\n environment.c                          |   41 +++++++++++++++++\n git.c                                  |   18 +++++++-\n refs.c                                 |   33 ++++++++++++--\n refs.h                                 |    3 +\n upload-pack.c                          |   15 +++---\n 14 files changed, 230 insertions(+), 24 deletions(-)\n create mode 100644 Documentation/gitnamespaces.txt\n\n-- \n1.7.5.3\n"},{"id":"169483","messageId":"1307470885-4018-2-git-send-email-jamey@minilop.net","threadId":"27551","inReplyTo":"1307470885-4018-1-git-send-email-jamey@minilop.net","subject":"[PATCH 1/4] Fix prefix handling in ref iteration functions","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-06-07T18:21:22Z","receivedAt":"2011-06-07T18:21:22Z","isPatch":true,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"From: Josh Triplett <josh@joshtriplett.org>\n\nThe do_for_each_ref iteration function accepts a prefix and a trim, and\nchecks for the prefix on each ref before passing in that ref; it also\nsupports trimming off part of the ref before passing it.  However,\ndo_for_each_ref used trim as the length of the prefix to check, ignoring\nthe actual length of the prefix.  Switch to using prefixcmp, checking\nthe entire length of the prefix string, to properly support a trim value\ndifferent than the length of the prefix.\n\nSeveral callers passed a prefix of \"refs/\" to filter out everything\noutside of refs/, but a trim of 0 to avoid trimming off the \"refs/\"; the\ntrim of 0 meant that the filter of \"refs/\" no longer applied.  Change\nthese callers to pass an empty prefix instead, to avoid changing the\nexisting behavior.  Various callers count on this lack of filtering,\nsuch as receive-pack which uses add_extra_ref to add alternates as refs\nnamed \".have\"; adding filtering would break that, causing\nt5501-fetch-push-alternates.sh to fail.  That lack of filtering doesn't\ncurrently have any other effect, since the loose ref functions can never\nsupply refs outside of \"refs/\", and packed-refs will not normally\ninclude such refs unless manually edited.\n\nCommit by Josh Triplett and Jamey Sharp.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n refs.c |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/refs.c b/refs.c\nindex e3c0511..858cf92 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -584,7 +584,7 @@ int read_ref(const char *ref, unsigned char *sha1)\n static int do_one_ref(const char *base, each_ref_fn fn, int trim,\n \t\t      int flags, void *cb_data, struct ref_list *entry)\n {\n-\tif (strncmp(base, entry->name, trim))\n+\tif (prefixcmp(entry->name, base))\n \t\treturn 0;\n \n \tif (!(flags & DO_FOR_EACH_INCLUDE_BROKEN)) {\n@@ -728,12 +728,12 @@ int head_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)\n \n int for_each_ref(each_ref_fn fn, void *cb_data)\n {\n-\treturn do_for_each_ref(NULL, \"refs/\", fn, 0, 0, cb_data);\n+\treturn do_for_each_ref(NULL, \"\", fn, 0, 0, cb_data);\n }\n \n int for_each_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data)\n {\n-\treturn do_for_each_ref(submodule, \"refs/\", fn, 0, 0, cb_data);\n+\treturn do_for_each_ref(submodule, \"\", fn, 0, 0, cb_data);\n }\n \n int for_each_ref_in(const char *prefix, each_ref_fn fn, void *cb_data)\n@@ -819,7 +819,7 @@ int for_each_glob_ref(each_ref_fn fn, const char *pattern, void *cb_data)\n \n int for_each_rawref(each_ref_fn fn, void *cb_data)\n {\n-\treturn do_for_each_ref(NULL, \"refs/\", fn, 0,\n+\treturn do_for_each_ref(NULL, \"\", fn, 0,\n \t\t\t       DO_FOR_EACH_INCLUDE_BROKEN, cb_data);\n }\n \n-- \n1.7.5.3\n"},{"id":"169484","messageId":"1307470885-4018-3-git-send-email-jamey@minilop.net","threadId":"27551","inReplyTo":"1307470885-4018-1-git-send-email-jamey@minilop.net","subject":"[PATCH 2/4] Add infrastructure for ref namespaces","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-06-07T18:21:23Z","receivedAt":"2011-06-07T18:21:23Z","isPatch":true,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"From: Josh Triplett <josh@joshtriplett.org>\n\nAdd support for dividing the refs of a single repository into multiple\nnamespaces, each of which can have its own branches, tags, and HEAD.\nGit can expose each namespace as an independent repository to pull from\nand push to, while sharing the object store, and exposing all the refs\nto operations such as git-gc.\n\nStoring multiple repositories as namespaces of a single repository\navoids storing duplicate copies of the same objects, such as when\nstoring multiple branches of the same source.  The alternates mechanism\nprovides similar support for avoiding duplicates, but alternates do not\nprevent duplication between new objects added to the repositories\nwithout ongoing maintenance, while namespaces do.\n\nTo specify a namespace, set the GIT_NAMESPACE environment variable to\nthe namespace.  For each ref namespace, git stores the corresponding\nrefs in a directory under refs/namespaces/.  For example,\nGIT_NAMESPACE=foo will store refs under refs/namespaces/foo/.  You can\nalso specify namespaces via the --namespace option to git.\n\nNote that namespaces which include a / will expand to a hierarchy of\nnamespaces; for example, GIT_NAMESPACE=foo/bar will store refs under\nrefs/namespaces/foo/refs/namespaces/bar/.  This makes paths in\nGIT_NAMESPACE behave hierarchically, so that cloning with\nGIT_NAMESPACE=foo/bar produces the same result as cloning with\nGIT_NAMESPACE=foo and cloning from that repo with GIT_NAMESPACE=bar.  It\nalso avoids ambiguity with strange namespace paths such as\nfoo/refs/heads/, which could otherwise generate directory/file conflicts\nwithin the refs directory.\n\nThis adds the infrastructure for ref namespaces: handling the\nGIT_NAMESPACE environment variable and --namespace option, and iterating\nover refs in a namespace.  Subsequent commits use this infrastructure to\nimplement the user-visible support for ref namespaces.\n\nCommit by Josh Triplett and Jamey Sharp.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n cache.h                                |    3 ++\n contrib/completion/git-completion.bash |    1 +\n environment.c                          |   41 ++++++++++++++++++++++++++++++++\n git.c                                  |   18 ++++++++++++-\n refs.c                                 |   25 +++++++++++++++++++\n refs.h                                 |    3 ++\n 6 files changed, 89 insertions(+), 2 deletions(-)\n\ndiff --git a/cache.h b/cache.h\nindex e11cf6a..b256a94 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -379,6 +379,7 @@ static inline enum object_type object_type(unsigned int mode)\n }\n \n #define GIT_DIR_ENVIRONMENT \"GIT_DIR\"\n+#define GIT_NAMESPACE_ENVIRONMENT \"GIT_NAMESPACE\"\n #define GIT_WORK_TREE_ENVIRONMENT \"GIT_WORK_TREE\"\n #define DEFAULT_GIT_DIR_ENVIRONMENT \".git\"\n #define DB_ENVIRONMENT \"GIT_OBJECT_DIRECTORY\"\n@@ -419,6 +420,8 @@ extern char *get_object_directory(void);\n extern char *get_index_file(void);\n extern char *get_graft_file(void);\n extern int set_git_dir(const char *path);\n+extern const char *get_git_namespace(void);\n+extern const char *strip_namespace(const char *namespaced_ref);\n extern const char *get_git_work_tree(void);\n extern const char *read_gitfile_gently(const char *path);\n extern void set_git_work_tree(const char *tree);\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b36290f..b10a1ec 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2640,6 +2640,7 @@ _git ()\n \t\t\t--exec-path\n \t\t\t--html-path\n \t\t\t--work-tree=\n+\t\t\t--namespace=\n \t\t\t--help\n \t\t\t\"\n \t\t\t;;\ndiff --git a/environment.c b/environment.c\nindex 94d58fd..aad274b 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"refs.h\"\n \n char git_default_email[MAX_GITNAME];\n char git_default_name[MAX_GITNAME];\n@@ -65,6 +66,9 @@ int core_preload_index = 0;\n char *git_work_tree_cfg;\n static char *work_tree;\n \n+static const char *namespace;\n+static size_t namespace_len;\n+\n static const char *git_dir;\n static char *git_object_dir, *git_index_file, *git_graft_file;\n \n@@ -86,6 +90,27 @@ const char * const local_repo_env[LOCAL_REPO_ENV_SIZE + 1] = {\n \tNULL\n };\n \n+static char *expand_namespace(const char *raw_namespace)\n+{\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tstruct strbuf **components, **c;\n+\n+\tif (!raw_namespace || !*raw_namespace)\n+\t\treturn xstrdup(\"\");\n+\n+\tstrbuf_addstr(&buf, raw_namespace);\n+\tcomponents = strbuf_split(&buf, '/');\n+\tstrbuf_reset(&buf);\n+\tfor (c = components; *c; c++)\n+\t\tif (strcmp((*c)->buf, \"/\") != 0)\n+\t\t\tstrbuf_addf(&buf, \"refs/namespaces/%s\", (*c)->buf);\n+\tstrbuf_list_free(components);\n+\tif (check_ref_format(buf.buf) != CHECK_REF_FORMAT_OK)\n+\t\tdie(\"bad git namespace path \\\"%s\\\"\", raw_namespace);\n+\tstrbuf_addch(&buf, '/');\n+\treturn strbuf_detach(&buf, NULL);\n+}\n+\n static void setup_git_env(void)\n {\n \tgit_dir = getenv(GIT_DIR_ENVIRONMENT);\n@@ -111,6 +136,8 @@ static void setup_git_env(void)\n \t\tgit_graft_file = git_pathdup(\"info/grafts\");\n \tif (getenv(NO_REPLACE_OBJECTS_ENVIRONMENT))\n \t\tread_replace_refs = 0;\n+\tnamespace = expand_namespace(getenv(GIT_NAMESPACE_ENVIRONMENT));\n+\tnamespace_len = strlen(namespace);\n }\n \n int is_bare_repository(void)\n@@ -131,6 +158,20 @@ const char *get_git_dir(void)\n \treturn git_dir;\n }\n \n+const char *get_git_namespace(void)\n+{\n+\tif (!namespace)\n+\t\tsetup_git_env();\n+\treturn namespace;\n+}\n+\n+const char *strip_namespace(const char *namespaced_ref)\n+{\n+\tif (prefixcmp(namespaced_ref, get_git_namespace()) != 0)\n+\t\treturn NULL;\n+\treturn namespaced_ref + namespace_len;\n+}\n+\n static int git_work_tree_initialized;\n \n /*\ndiff --git a/git.c b/git.c\nindex 89721d4..98cbf7b 100644\n--- a/git.c\n+++ b/git.c\n@@ -7,8 +7,8 @@\n \n const char git_usage_string[] =\n \t\"git [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\\n\"\n-\t\"           [-p|--paginate|--no-pager] [--no-replace-objects]\\n\"\n-\t\"           [--bare] [--git-dir=<path>] [--work-tree=<path>]\\n\"\n+\t\"           [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]\\n\"\n+\t\"           [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\\n\"\n \t\"           [-c name=value] [--help]\\n\"\n \t\"           <command> [<args>]\";\n \n@@ -126,6 +126,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n \t\t\tsetenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);\n \t\t\tif (envchanged)\n \t\t\t\t*envchanged = 1;\n+\t\t} else if (!strcmp(cmd, \"--namespace\")) {\n+\t\t\tif (*argc < 2) {\n+\t\t\t\tfprintf(stderr, \"No directory given for --namespace.\\n\" );\n+\t\t\t\tusage(git_usage_string);\n+\t\t\t}\n+\t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n+\t\t\tif (envchanged)\n+\t\t\t\t*envchanged = 1;\n+\t\t\t(*argv)++;\n+\t\t\t(*argc)--;\n+\t\t} else if (!prefixcmp(cmd, \"--namespace=\")) {\n+\t\t\tsetenv(GIT_NAMESPACE_ENVIRONMENT, cmd + 12, 1);\n+\t\t\tif (envchanged)\n+\t\t\t\t*envchanged = 1;\n \t\t} else if (!strcmp(cmd, \"--work-tree\")) {\n \t\t\tif (*argc < 2) {\n \t\t\t\tfprintf(stderr, \"No directory given for --work-tree.\\n\" );\ndiff --git a/refs.c b/refs.c\nindex 858cf92..e83bbf8 100644\n--- a/refs.c\n+++ b/refs.c\n@@ -782,6 +782,31 @@ int for_each_replace_ref(each_ref_fn fn, void *cb_data)\n \treturn do_for_each_ref(NULL, \"refs/replace/\", fn, 13, 0, cb_data);\n }\n \n+int head_ref_namespaced(each_ref_fn fn, void *cb_data)\n+{\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tint ret = 0;\n+\tunsigned char sha1[20];\n+\tint flag;\n+\n+\tstrbuf_addf(&buf, \"%sHEAD\", get_git_namespace());\n+\tif (resolve_ref(buf.buf, sha1, 1, &flag))\n+\t\tret = fn(buf.buf, sha1, flag, cb_data);\n+\tstrbuf_release(&buf);\n+\n+\treturn ret;\n+}\n+\n+int for_each_namespaced_ref(each_ref_fn fn, void *cb_data)\n+{\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tint ret;\n+\tstrbuf_addf(&buf, \"%srefs/\", get_git_namespace());\n+\tret = do_for_each_ref(NULL, buf.buf, fn, 0, 0, cb_data);\n+\tstrbuf_release(&buf);\n+\treturn ret;\n+}\n+\n int for_each_glob_ref_in(each_ref_fn fn, const char *pattern,\n \tconst char *prefix, void *cb_data)\n {\ndiff --git a/refs.h b/refs.h\nindex 5e7a9a5..9a5c9e0 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -36,6 +36,9 @@ extern int for_each_tag_ref_submodule(const char *submodule, each_ref_fn fn, voi\n extern int for_each_branch_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data);\n extern int for_each_remote_ref_submodule(const char *submodule, each_ref_fn fn, void *cb_data);\n \n+extern int head_ref_namespaced(each_ref_fn fn, void *cb_data);\n+extern int for_each_namespaced_ref(each_ref_fn fn, void *cb_data);\n+\n static inline const char *has_glob_specials(const char *pattern)\n {\n \treturn strpbrk(pattern, \"?*[\");\n-- \n1.7.5.3\n"},{"id":"169487","messageId":"1307470885-4018-4-git-send-email-jamey@minilop.net","threadId":"27551","inReplyTo":"1307470885-4018-1-git-send-email-jamey@minilop.net","subject":"[PATCH 3/4] Support ref namespaces for remote repositories via upload-pack and receive-pack","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-06-07T18:21:24Z","receivedAt":"2011-06-07T18:21:24Z","isPatch":true,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"From: Josh Triplett <josh@joshtriplett.org>\n\nChange upload-pack and receive-pack to use the namespace-prefixed refs\nwhen working with the repository, and use the unprefixed refs when\ntalking to the client, maintaining the masquerade.  This allows\nclone, pull, fetch, and push to work with a suitably configured\nGIT_NAMESPACE.\n\nWith appropriate configuration, this also allows http-backend to expose\nnamespaces as multiple repositories with different paths.  This only\nrequires setting GIT_NAMESPACE, which http-backend passes through to\nupload-pack and receive-pack.\n\nCommit by Josh Triplett and Jamey Sharp.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n builtin/receive-pack.c |   34 ++++++++++++++++++++++++++++------\n upload-pack.c          |   15 ++++++++-------\n 2 files changed, 36 insertions(+), 13 deletions(-)\n\ndiff --git a/builtin/receive-pack.c b/builtin/receive-pack.c\nindex e1a687a..54dd5d4 100644\n--- a/builtin/receive-pack.c\n+++ b/builtin/receive-pack.c\n@@ -120,9 +120,14 @@ static int show_ref(const char *path, const unsigned char *sha1, int flag, void\n \treturn 0;\n }\n \n+static int show_ref_cb(const char *path, const unsigned char *sha1, int flag, void *cb_data)\n+{\n+\treturn show_ref(strip_namespace(path), sha1, flag, cb_data);\n+}\n+\n static void write_head_info(void)\n {\n-\tfor_each_ref(show_ref, NULL);\n+\tfor_each_namespaced_ref(show_ref_cb, NULL);\n \tif (!sent_capabilities)\n \t\tshow_ref(\"capabilities^{}\", null_sha1, 0, NULL);\n \n@@ -333,6 +338,8 @@ static void refuse_unconfigured_deny_delete_current(void)\n static const char *update(struct command *cmd)\n {\n \tconst char *name = cmd->ref_name;\n+\tstruct strbuf namespaced_name_buf = STRBUF_INIT;\n+\tconst char *namespaced_name;\n \tunsigned char *old_sha1 = cmd->old_sha1;\n \tunsigned char *new_sha1 = cmd->new_sha1;\n \tstruct ref_lock *lock;\n@@ -343,7 +350,10 @@ static const char *update(struct command *cmd)\n \t\treturn \"funny refname\";\n \t}\n \n-\tif (is_ref_checked_out(name)) {\n+\tstrbuf_addf(&namespaced_name_buf, \"%s%s\", get_git_namespace(), name);\n+\tnamespaced_name = strbuf_detach(&namespaced_name_buf, NULL);\n+\n+\tif (is_ref_checked_out(namespaced_name)) {\n \t\tswitch (deny_current_branch) {\n \t\tcase DENY_IGNORE:\n \t\t\tbreak;\n@@ -371,7 +381,7 @@ static const char *update(struct command *cmd)\n \t\t\treturn \"deletion prohibited\";\n \t\t}\n \n-\t\tif (!strcmp(name, head_name)) {\n+\t\tif (!strcmp(namespaced_name, head_name)) {\n \t\t\tswitch (deny_delete_current) {\n \t\t\tcase DENY_IGNORE:\n \t\t\t\tbreak;\n@@ -427,14 +437,14 @@ static const char *update(struct command *cmd)\n \t\t\trp_warning(\"Allowing deletion of corrupt ref.\");\n \t\t\told_sha1 = NULL;\n \t\t}\n-\t\tif (delete_ref(name, old_sha1, 0)) {\n+\t\tif (delete_ref(namespaced_name, old_sha1, 0)) {\n \t\t\trp_error(\"failed to delete %s\", name);\n \t\t\treturn \"failed to delete\";\n \t\t}\n \t\treturn NULL; /* good */\n \t}\n \telse {\n-\t\tlock = lock_any_ref_for_update(name, old_sha1, 0);\n+\t\tlock = lock_any_ref_for_update(namespaced_name, old_sha1, 0);\n \t\tif (!lock) {\n \t\t\trp_error(\"failed to lock %s\", name);\n \t\t\treturn \"failed to lock\";\n@@ -491,17 +501,29 @@ static void run_update_post_hook(struct command *commands)\n \n static void check_aliased_update(struct command *cmd, struct string_list *list)\n {\n+\tstruct strbuf buf = STRBUF_INIT;\n+\tconst char *dst_name;\n \tstruct string_list_item *item;\n \tstruct command *dst_cmd;\n \tunsigned char sha1[20];\n \tchar cmd_oldh[41], cmd_newh[41], dst_oldh[41], dst_newh[41];\n \tint flag;\n \n-\tconst char *dst_name = resolve_ref(cmd->ref_name, sha1, 0, &flag);\n+\tstrbuf_addf(&buf, \"%s%s\", get_git_namespace(), cmd->ref_name);\n+\tdst_name = resolve_ref(buf.buf, sha1, 0, &flag);\n+\tstrbuf_release(&buf);\n \n \tif (!(flag & REF_ISSYMREF))\n \t\treturn;\n \n+\tdst_name = strip_namespace(dst_name);\n+\tif (!dst_name) {\n+\t\trp_error(\"refusing update to broken symref '%s'\", cmd->ref_name);\n+\t\tcmd->skip_update = 1;\n+\t\tcmd->error_string = \"broken symref\";\n+\t\treturn;\n+\t}\n+\n \tif ((item = string_list_lookup(list, dst_name)) == NULL)\n \t\treturn;\n \ndiff --git a/upload-pack.c b/upload-pack.c\nindex ce5cbbe..267e5b1 100644\n--- a/upload-pack.c\n+++ b/upload-pack.c\n@@ -641,16 +641,17 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo\n \t\t\" side-band-64k ofs-delta shallow no-progress\"\n \t\t\" include-tag multi_ack_detailed\";\n \tstruct object *o = parse_object(sha1);\n+\tconst char *refname_nons = strip_namespace(refname);\n \n \tif (!o)\n \t\tdie(\"git upload-pack: cannot find object %s:\", sha1_to_hex(sha1));\n \n \tif (capabilities)\n-\t\tpacket_write(1, \"%s %s%c%s%s\\n\", sha1_to_hex(sha1), refname,\n+\t\tpacket_write(1, \"%s %s%c%s%s\\n\", sha1_to_hex(sha1), refname_nons,\n \t\t\t     0, capabilities,\n \t\t\t     stateless_rpc ? \" no-done\" : \"\");\n \telse\n-\t\tpacket_write(1, \"%s %s\\n\", sha1_to_hex(sha1), refname);\n+\t\tpacket_write(1, \"%s %s\\n\", sha1_to_hex(sha1), refname_nons);\n \tcapabilities = NULL;\n \tif (!(o->flags & OUR_REF)) {\n \t\to->flags |= OUR_REF;\n@@ -659,7 +660,7 @@ static int send_ref(const char *refname, const unsigned char *sha1, int flag, vo\n \tif (o->type == OBJ_TAG) {\n \t\to = deref_tag(o, refname, 0);\n \t\tif (o)\n-\t\t\tpacket_write(1, \"%s %s^{}\\n\", sha1_to_hex(o->sha1), refname);\n+\t\t\tpacket_write(1, \"%s %s^{}\\n\", sha1_to_hex(o->sha1), refname_nons);\n \t}\n \treturn 0;\n }\n@@ -680,12 +681,12 @@ static void upload_pack(void)\n {\n \tif (advertise_refs || !stateless_rpc) {\n \t\treset_timeout();\n-\t\thead_ref(send_ref, NULL);\n-\t\tfor_each_ref(send_ref, NULL);\n+\t\thead_ref_namespaced(send_ref, NULL);\n+\t\tfor_each_namespaced_ref(send_ref, NULL);\n \t\tpacket_flush(1);\n \t} else {\n-\t\thead_ref(mark_our_ref, NULL);\n-\t\tfor_each_ref(mark_our_ref, NULL);\n+\t\thead_ref_namespaced(mark_our_ref, NULL);\n+\t\tfor_each_namespaced_ref(mark_our_ref, NULL);\n \t}\n \tif (advertise_refs)\n \t\treturn;\n-- \n1.7.5.3\n"},{"id":"169485","messageId":"1307470885-4018-5-git-send-email-jamey@minilop.net","threadId":"27551","inReplyTo":"1307470885-4018-1-git-send-email-jamey@minilop.net","subject":"[PATCH 4/4] Add documentation for ref namespaces","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-06-07T18:21:25Z","receivedAt":"2011-06-07T18:21:25Z","isPatch":true,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"From: Josh Triplett <josh@joshtriplett.org>\n\nDocument the namespace mechanism in a new gitnamespaces(7) page.\nReference it from receive-pack and upload-pack.\n\nDocument the new --namespace option and GIT_NAMESPACE environment\nvariable in git(1), and reference gitnamespaces(7).\n\nAdd a sample Apache configuration to http-backend(1) to support\nnamespaced repositories, and reference gitnamespaces(7).\n\nCommit by Josh Triplett and Jamey Sharp.\n\nSigned-off-by: Josh Triplett <josh@joshtriplett.org>\nSigned-off-by: Jamey Sharp <jamey@minilop.net>\n---\n Documentation/Makefile                 |    2 +-\n Documentation/git-http-backend.txt     |    8 +++\n Documentation/git-receive-pack.txt     |    2 +-\n Documentation/git-upload-pack.txt      |    4 ++\n Documentation/git.txt                  |   13 +++++-\n Documentation/gitnamespaces.txt        |   75 ++++++++++++++++++++++++++++++++\n contrib/completion/git-completion.bash |    2 +-\n 7 files changed, 101 insertions(+), 5 deletions(-)\n create mode 100644 Documentation/gitnamespaces.txt\n\ndiff --git a/Documentation/Makefile b/Documentation/Makefile\nindex 36989b7..2004fbe 100644\n--- a/Documentation/Makefile\n+++ b/Documentation/Makefile\n@@ -6,7 +6,7 @@ MAN5_TXT=gitattributes.txt gitignore.txt gitmodules.txt githooks.txt \\\n \tgitrepository-layout.txt\n MAN7_TXT=gitcli.txt gittutorial.txt gittutorial-2.txt \\\n \tgitcvs-migration.txt gitcore-tutorial.txt gitglossary.txt \\\n-\tgitdiffcore.txt gitrevisions.txt gitworkflows.txt\n+\tgitdiffcore.txt gitnamespaces.txt gitrevisions.txt gitworkflows.txt\n \n MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)\n MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))\ndiff --git a/Documentation/git-http-backend.txt b/Documentation/git-http-backend.txt\nindex 277d9e1..f4e0741 100644\n--- a/Documentation/git-http-backend.txt\n+++ b/Documentation/git-http-backend.txt\n@@ -119,6 +119,14 @@ ScriptAliasMatch \\\n \n ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/\n ----------------------------------------------------------------\n++\n+To serve multiple repositories from different linkgit:gitnamespaces[7] in a\n+single repository:\n++\n+----------------------------------------------------------------\n+SetEnvIf Request_URI \"^/git/([^/]*)\" GIT_NAMESPACE=$1\n+ScriptAliasMatch ^/git/[^/]*(.*) /usr/libexec/git-core/git-http-backend/storage.git$1\n+----------------------------------------------------------------\n \n Accelerated static Apache 2.x::\n \tSimilar to the above, but Apache can be used to return static\ndiff --git a/Documentation/git-receive-pack.txt b/Documentation/git-receive-pack.txt\nindex f34e0ae..3534ba0 100644\n--- a/Documentation/git-receive-pack.txt\n+++ b/Documentation/git-receive-pack.txt\n@@ -149,7 +149,7 @@ if the repository is packed and is served via a dumb transport.\n \n SEE ALSO\n --------\n-linkgit:git-send-pack[1]\n+linkgit:git-send-pack[1], linkgit:gitnamespaces[7]\n \n GIT\n ---\ndiff --git a/Documentation/git-upload-pack.txt b/Documentation/git-upload-pack.txt\nindex 4c0ca9d..61a9a04 100644\n--- a/Documentation/git-upload-pack.txt\n+++ b/Documentation/git-upload-pack.txt\n@@ -33,6 +33,10 @@ OPTIONS\n <directory>::\n \tThe repository to sync from.\n \n+SEE ALSO\n+--------\n+linkgit:gitnamespaces[7]\n+\n GIT\n ---\n Part of the linkgit:git[1] suite\ndiff --git a/Documentation/git.txt b/Documentation/git.txt\nindex 5c45446..4cbf741 100644\n--- a/Documentation/git.txt\n+++ b/Documentation/git.txt\n@@ -10,8 +10,8 @@ SYNOPSIS\n --------\n [verse]\n 'git' [--version] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]\n-    [-p|--paginate|--no-pager] [--no-replace-objects]\n-    [--bare] [--git-dir=<path>] [--work-tree=<path>]\n+    [-p|--paginate|--no-pager] [--no-replace-objects] [--bare]\n+    [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]\n     [-c <name>=<value>]\n     [--help] <command> [<args>]\n \n@@ -325,6 +325,11 @@ help ...`.\n \tvariable (see core.worktree in linkgit:git-config[1] for a\n \tmore detailed discussion).\n \n+--namespace=<path>::\n+\tSet the git namespace.  See linkgit:gitnamespaces[7] for more\n+\tdetails.  Equivalent to setting the `GIT_NAMESPACE` environment\n+\tvariable.\n+\n --bare::\n \tTreat the repository as a bare repository.  If GIT_DIR\n \tenvironment is not set, it is set to the current working\n@@ -589,6 +594,10 @@ git so take care if using Cogito etc.\n \tThis can also be controlled by the '--work-tree' command line\n \toption and the core.worktree configuration variable.\n \n+'GIT_NAMESPACE'::\n+\tSet the git namespace; see linkgit:gitnamespaces[7] for details.\n+\tThe '--namespace' command-line option also sets this value.\n+\n 'GIT_CEILING_DIRECTORIES'::\n \tThis should be a colon-separated list of absolute paths.\n \tIf set, it is a list of directories that git should not chdir\ndiff --git a/Documentation/gitnamespaces.txt b/Documentation/gitnamespaces.txt\nnew file mode 100644\nindex 0000000..ed8924e\n--- /dev/null\n+++ b/Documentation/gitnamespaces.txt\n@@ -0,0 +1,75 @@\n+gitnamespaces(7)\n+================\n+\n+NAME\n+----\n+gitnamespaces - Git namespaces\n+\n+DESCRIPTION\n+-----------\n+\n+Git supports dividing the refs of a single repository into multiple\n+namespaces, each of which has its own branches, tags, and HEAD.  Git can\n+expose each namespace as an independent repository to pull from and push\n+to, while sharing the object store, and exposing all the refs to\n+operations such as linkgit:git-gc[1].\n+\n+Storing multiple repositories as namespaces of a single repository\n+avoids storing duplicate copies of the same objects, such as when\n+storing multiple branches of the same source.  The alternates mechanism\n+provides similar support for avoiding duplicates, but alternates do not\n+prevent duplication between new objects added to the repositories\n+without ongoing maintenance, while namespaces do.\n+\n+To specify a namespace, set the `GIT_NAMESPACE` environment variable to\n+the namespace.  For each ref namespace, git stores the corresponding\n+refs in a directory under `refs/namespaces/`.  For example,\n+`GIT_NAMESPACE=foo` will store refs under `refs/namespaces/foo/`.  You\n+can also specify namespaces via the `--namespace` option to\n+linkgit:git[1].\n+\n+Note that namespaces which include a `/` will expand to a hierarchy of\n+namespaces; for example, `GIT_NAMESPACE=foo/bar` will store refs under\n+`refs/namespaces/foo/refs/namespaces/bar/`.  This makes paths in\n+`GIT_NAMESPACE` behave hierarchically, so that cloning with\n+`GIT_NAMESPACE=foo/bar` produces the same result as cloning with\n+`GIT_NAMESPACE=foo` and cloning from that repo with `GIT_NAMESPACE=bar`.  It\n+also avoids ambiguity with strange namespace paths such as `foo/refs/heads/`,\n+which could otherwise generate directory/file conflicts within the `refs`\n+directory.\n+\n+linkgit:git-upload-pack[1] and linkgit:git-receive-pack[1] rewrite the\n+names of refs as specified by `GIT_NAMESPACE`.  git-upload-pack and\n+git-receive-pack will ignore all references outside the specified\n+namespace.\n+\n+The smart HTTP server, linkgit:git-http-backend[1], will pass\n+GIT_NAMESPACE through to the backend programs; see\n+linkgit:git-http-backend[1] for sample configuration to expose\n+repository namespaces as repositories.\n+\n+For a simple local test, you can use linkgit:git-remote-ext[1]:\n+\n+----------\n+git clone ext::'git --namespace=foo %s /tmp/prefixed.git'\n+----------\n+\n+SECURITY\n+--------\n+\n+Anyone with access to any namespace within a repository can potentially\n+access objects from any other namespace stored in the same repository.\n+You can't directly say \"give me object ABCD\" if you don't have a ref to\n+it, but you can do some other sneaky things like:\n+\n+. Claiming to push ABCD, at which point the server will optimize out the\n+  need for you to actually send it. Now you have a ref to ABCD and can\n+  fetch it (claiming not to have it, of course).\n+\n+. Requesting other refs, claiming that you have ABCD, at which point the\n+  server may generate deltas against ABCD.\n+\n+None of this causes a problem if you only host public repositories, or\n+if everyone who may read one namespace may also read everything in every\n+other namespace (for instance, if everyone in an organization has read\n+permission to every repository).\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex b10a1ec..ec1c986 100755\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -1469,7 +1469,7 @@ _git_help ()\n \t__gitcomp \"$__git_all_commands $(__git_aliases)\n \t\tattributes cli core-tutorial cvs-migration\n \t\tdiffcore gitk glossary hooks ignore modules\n-\t\trepository-layout tutorial tutorial-2\n+\t\tnamespaces repository-layout tutorial tutorial-2\n \t\tworkflows\n \t\t\"\n }\n-- \n1.7.5.3\n"},{"id":"169489","messageId":"7vlixd5uxt.fsf@alter.siamese.dyndns.org","threadId":"27551","inReplyTo":"1307470885-4018-1-git-send-email-jamey@minilop.net","subject":"Re: What's cooking in git.git (Jun 2011, #01; Sun, 5)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-06-07T18:59:42Z","receivedAt":"2011-06-07T18:59:42Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jamey Sharp <jamey@minilop.net> writes:\n\n> So, the suggested change to actually use \"refs/\" as a filter caused this\n> failure.  Based on this, we'd tend to suggest that we should go back to\n> the version which preserved the existing behavior, to avoid breaking\n> assumptions like this; that seems preferable to tracking down all the\n> places that would break due to this new ref filtering.  Adding that\n> filtering and fixing all the resulting breakage seems like an entirely\n> separate change.\n\nThanks, that makes sense.\n"},{"id":"169492","messageId":"BANLkTika2C9iw7E6Z-HRW=4KNstYqMbxrw@mail.gmail.com","threadId":"27551","inReplyTo":"1307470885-4018-3-git-send-email-jamey@minilop.net","subject":"Re: [PATCH 2/4] Add infrastructure for ref namespaces","fromName":"Bert Wesarg","fromEmail":"bert.wesarg@googlemail.com","sentAt":"2011-06-07T19:12:09Z","receivedAt":"2011-06-07T19:12:09Z","isPatch":true,"sender":{"key":"bert.wesarg@googlemail.com","avatar":"https://avatars.githubusercontent.com/u/111934?v=4"},"body":"On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n> diff --git a/git.c b/git.c\n> index 89721d4..98cbf7b 100644\n> --- a/git.c\n> +++ b/git.c\n> @@ -126,6 +126,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n>                        setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);\n>                        if (envchanged)\n>                                *envchanged = 1;\n> +               } else if (!strcmp(cmd, \"--namespace\")) {\n> +                       if (*argc < 2) {\n> +                               fprintf(stderr, \"No directory given for --namespace.\\n\" );\n\nThis 'directory' is probably misnamed here.\n\nBert\n\n> +                               usage(git_usage_string);\n> +                       }\n> +                       setenv(GIT_NAMESPACE_ENVIRONMENT, (*argv)[1], 1);\n> +                       if (envchanged)\n> +                               *envchanged = 1;\n> +                       (*argv)++;\n> +                       (*argc)--;\n> +               } else if (!prefixcmp(cmd, \"--namespace=\")) {\n> +                       setenv(GIT_NAMESPACE_ENVIRONMENT, cmd + 12, 1);\n> +                       if (envchanged)\n> +                               *envchanged = 1;\n>                } else if (!strcmp(cmd, \"--work-tree\")) {\n>                        if (*argc < 2) {\n>                                fprintf(stderr, \"No directory given for --work-tree.\\n\" );\n"},{"id":"169513","messageId":"20110607222520.GA1761@leaf","threadId":"27551","inReplyTo":"BANLkTika2C9iw7E6Z-HRW=4KNstYqMbxrw@mail.gmail.com","subject":"Re: [PATCH 2/4] Add infrastructure for ref namespaces","fromName":"Josh Triplett","fromEmail":"josh@joshtriplett.org","sentAt":"2011-06-07T22:25:21Z","receivedAt":"2011-06-07T22:25:21Z","isPatch":true,"sender":{"key":"josh@joshtriplett.org","avatar":"https://avatars.githubusercontent.com/u/162737?v=4"},"body":"On Tue, Jun 07, 2011 at 09:12:09PM +0200, Bert Wesarg wrote:\n> On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n> > diff --git a/git.c b/git.c\n> > index 89721d4..98cbf7b 100644\n> > --- a/git.c\n> > +++ b/git.c\n> > @@ -126,6 +126,20 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)\n> >                        setenv(GIT_DIR_ENVIRONMENT, cmd + 10, 1);\n> >                        if (envchanged)\n> >                                *envchanged = 1;\n> > +               } else if (!strcmp(cmd, \"--namespace\")) {\n> > +                       if (*argc < 2) {\n> > +                               fprintf(stderr, \"No directory given for --namespace.\\n\" );\n> \n> This 'directory' is probably misnamed here.\n\nThanks, will fix.\n\n- Josh Triplett\n"},{"id":"174086","messageId":"CACBZZX4bow8vwrwSL5uRJQtAgeg10_K+5ss8u-HvCHOn3+0Tuw@mail.gmail.com","threadId":"27551","inReplyTo":"1307470885-4018-5-git-send-email-jamey@minilop.net","subject":"Re: [PATCH 4/4] Add documentation for ref namespaces","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-08-23T10:38:04Z","receivedAt":"2011-08-23T10:38:04Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n\n> Document the namespace mechanism in a new gitnamespaces(7) page.\n> Reference it from receive-pack and upload-pack.\n\nThis breaks the build on older asciidoc versions, the fix is to do\nwhat I did in f5008f56d5aba06598e1c6272f4f55b4ee4bb016.\n"},{"id":"174105","messageId":"7vfwksrqp1.fsf@alter.siamese.dyndns.org","threadId":"27551","inReplyTo":"CACBZZX4bow8vwrwSL5uRJQtAgeg10_K+5ss8u-HvCHOn3+0Tuw@mail.gmail.com","subject":"Re: [PATCH 4/4] Add documentation for ref namespaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-23T17:19:22Z","receivedAt":"2011-08-23T17:19:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n>\n>> Document the namespace mechanism in a new gitnamespaces(7) page.\n>> Reference it from receive-pack and upload-pack.\n>\n> This breaks the build on older asciidoc versions, the fix is to do\n> what I did in f5008f56d5aba06598e1c6272f4f55b4ee4bb016.\n\nThanks for a sharp-eye, even though I would have appreciated it even more\nif you spotted it while the series was still in 'next'.\n\nLike this?\n\n Documentation/gitnamespaces.txt |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/gitnamespaces.txt b/Documentation/gitnamespaces.txt\nindex ed8924e..6e03946 100644\n--- a/Documentation/gitnamespaces.txt\n+++ b/Documentation/gitnamespaces.txt\n@@ -5,6 +5,11 @@ NAME\n ----\n gitnamespaces - Git namespaces\n \n+SYNOPSIS\n+--------\n+None (this section is to only please older version of AsciiDoc)\n+\n+\n DESCRIPTION\n -----------\n \n"},{"id":"174149","messageId":"CACBZZX7OYF9g_0dWXSmZiPqRmMRt+kR-dM0fBfkhmH4yg485KA@mail.gmail.com","threadId":"27551","inReplyTo":"7vfwksrqp1.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 4/4] Add documentation for ref namespaces","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2011-08-24T12:30:12Z","receivedAt":"2011-08-24T12:30:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Aug 23, 2011 at 19:19, Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n>>\n>>> Document the namespace mechanism in a new gitnamespaces(7) page.\n>>> Reference it from receive-pack and upload-pack.\n>>\n>> This breaks the build on older asciidoc versions, the fix is to do\n>> what I did in f5008f56d5aba06598e1c6272f4f55b4ee4bb016.\n>\n> Thanks for a sharp-eye, even though I would have appreciated it even more\n> if you spotted it while the series was still in 'next'.\n\nThat should work. And I very rarely compile things on these old boxes\nso I usually don't spot them until they hit master. Sorry.\n"},{"id":"175634","messageId":"7vaaa5pc8q.fsf_-_@alter.siamese.dyndns.org","threadId":"27551","inReplyTo":"CACBZZX4bow8vwrwSL5uRJQtAgeg10_K+5ss8u-HvCHOn3+0Tuw@mail.gmail.com","subject":"Re* [PATCH 4/4] Add documentation for ref namespaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-16T00:22:29Z","receivedAt":"2011-09-16T00:22:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n>\n>> Document the namespace mechanism in a new gitnamespaces(7) page.\n>> Reference it from receive-pack and upload-pack.\n>\n> This breaks the build on older asciidoc versions, the fix is to do\n> what I did in f5008f56d5aba06598e1c6272f4f55b4ee4bb016.\n\nEarlier I sent out a tongue-in-cheek \"like this\" that had a completely\nbogus SYNOPSIS section that is unusable in a released version of Git,\nhoping that somebody who _care_ more about the feature that the page\ndescribes would give us a better wording, but unfortunately it never\nhappened.\n\nSo here is a more realistic replacement, so that we won't have to suffer\nby complaints from people with older AsciiDoc saying \"the release does not\nbuild\". If we were to include this in 1.7.7 final, we now need to make\nsure we won't to have to hear from people with newer AsciiDoc saying \"why\ndo we have nonsense in SYNOPSIS section\", so your help is needed here.\n\nI explicitly avoided saying:\n\n\t[verse]\n\texport GIT_NAMESPACE=<namespace>\n\nas nothing other than the selected transports seems to pay attention to\nthis environment variable.\n\n-- >8 --\nSubject: [PATCH] Documentation/gitnamespaces.txt: cater to older asciidoc\n\nOlder asciidoc (e.g. 8.2.5 on Centos 5.5) is unhappy if a manpage does not\nhave a SYNOPSIS section. Show a sample (and a possibly bogus) command line\nof running two commands that pay attention to this environment variable\nwith a customized value.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/gitnamespaces.txt |    7 +++++++\n 1 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/gitnamespaces.txt b/Documentation/gitnamespaces.txt\nindex ed8924e..c6713cf 100644\n--- a/Documentation/gitnamespaces.txt\n+++ b/Documentation/gitnamespaces.txt\n@@ -5,6 +5,13 @@ NAME\n ----\n gitnamespaces - Git namespaces\n \n+SYNOPSIS\n+--------\n+[verse]\n+GIT_NAMESPACE=<namespace> 'git upload-pack'\n+GIT_NAMESPACE=<namespace> 'git receive-pack'\n+\n+\n DESCRIPTION\n -----------\n \n-- \n1.7.7.rc1.3.g559357\n"},{"id":"175637","messageId":"20110916034051.GH3144@oh.minilop.net","threadId":"27551","inReplyTo":"7vaaa5pc8q.fsf_-_@alter.siamese.dyndns.org","subject":"Re: Re* [PATCH 4/4] Add documentation for ref namespaces","fromName":"Jamey Sharp","fromEmail":"jamey@minilop.net","sentAt":"2011-09-16T03:40:51Z","receivedAt":"2011-09-16T03:40:51Z","isPatch":true,"sender":{"key":"jamey@minilop.net","avatar":"https://gravatar.com/avatar/979ed4f9190c19c13a84945afe9a6cf141e8884ef6ddaae342db7a74ae28828e?d=mp&s=160"},"body":"On Thu, Sep 15, 2011 at 05:22:29PM -0700, Junio C Hamano wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n> \n> > On Tue, Jun 7, 2011 at 20:21, Jamey Sharp <jamey@minilop.net> wrote:\n> >\n> >> Document the namespace mechanism in a new gitnamespaces(7) page.\n> >> Reference it from receive-pack and upload-pack.\n> >\n> > This breaks the build on older asciidoc versions, the fix is to do\n> > what I did in f5008f56d5aba06598e1c6272f4f55b4ee4bb016.\n> \n> Earlier I sent out a tongue-in-cheek \"like this\" that had a completely\n> bogus SYNOPSIS section that is unusable in a released version of Git,\n> hoping that somebody who _care_ more about the feature that the page\n> describes would give us a better wording, but unfortunately it never\n> happened.\n\nI'm afraid your wit was too subtle for me, as I believed your proposal\nwas serious and would be applied as-is. I assumed AsciiDoc was going to\nmagically omit the bogus synopsis, somehow. Perhaps it should detect\nwhen people are making fun of it, and ignore them then?\n\nYour rationale for giving a more specific synopsis is sound, although:\n1) git http-backend also supports the environment variable because it's\ninherited by the underlying upload-pack and receive-pack; and 2) the\nenvironment variable is an alternative to a general git command-line\noption. How much detail do you want in a synopsis?\n\nAssuming that you're happy with this level of detail, and that the\nAsciiDoc syntax is correct (I'm not familiar enough with it), I'm happy\nwith the patch you propose---\n\nReviewed-by: Jamey Sharp <jamey@minilop.net>\n\n> So here is a more realistic replacement, so that we won't have to suffer\n> by complaints from people with older AsciiDoc saying \"the release does not\n> build\". If we were to include this in 1.7.7 final, we now need to make\n> sure we won't to have to hear from people with newer AsciiDoc saying \"why\n> do we have nonsense in SYNOPSIS section\", so your help is needed here.\n> \n> I explicitly avoided saying:\n> \n> \t[verse]\n> \texport GIT_NAMESPACE=<namespace>\n> \n> as nothing other than the selected transports seems to pay attention to\n> this environment variable.\n> \n> -- >8 --\n> Subject: [PATCH] Documentation/gitnamespaces.txt: cater to older asciidoc\n> \n> Older asciidoc (e.g. 8.2.5 on Centos 5.5) is unhappy if a manpage does not\n> have a SYNOPSIS section. Show a sample (and a possibly bogus) command line\n> of running two commands that pay attention to this environment variable\n> with a customized value.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  Documentation/gitnamespaces.txt |    7 +++++++\n>  1 files changed, 7 insertions(+), 0 deletions(-)\n> \n> diff --git a/Documentation/gitnamespaces.txt b/Documentation/gitnamespaces.txt\n> index ed8924e..c6713cf 100644\n> --- a/Documentation/gitnamespaces.txt\n> +++ b/Documentation/gitnamespaces.txt\n> @@ -5,6 +5,13 @@ NAME\n>  ----\n>  gitnamespaces - Git namespaces\n>  \n> +SYNOPSIS\n> +--------\n> +[verse]\n> +GIT_NAMESPACE=<namespace> 'git upload-pack'\n> +GIT_NAMESPACE=<namespace> 'git receive-pack'\n> +\n> +\n>  DESCRIPTION\n>  -----------\n>  \n> -- \n> 1.7.7.rc1.3.g559357\n> \n"},{"id":"175648","messageId":"7v1uvgh32j.fsf@alter.siamese.dyndns.org","threadId":"27551","inReplyTo":"20110916034051.GH3144@oh.minilop.net","subject":"Re: Re* [PATCH 4/4] Add documentation for ref namespaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-09-16T16:20:04Z","receivedAt":"2011-09-16T16:20:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jamey Sharp <jamey@minilop.net> writes:\n\n> Assuming that you're happy with this level of detail, and that the\n> AsciiDoc syntax is correct (I'm not familiar enough with it), I'm happy\n> with the patch you propose---\n>\n> Reviewed-by: Jamey Sharp <jamey@minilop.net>\n\nThanks.\n"}]}