{"thread":{"id":"30151","subject":"What's cooking in git.git (Apr 2012, #02; Wed, 4)","startedAt":"2012-04-04T23:26:39Z","lastAt":"2012-04-06T07:16:02Z","messageCount":11,"participants":["Junio C Hamano","Jeff King","Jonathan Nieder","Matthieu Moy"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"188544","messageId":"7v8vib6pu8.fsf@alter.siamese.dyndns.org","threadId":"30151","inReplyTo":null,"subject":"What's cooking in git.git (Apr 2012, #02; Wed, 4)","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-04T23:26:39Z","receivedAt":"2012-04-04T23:26:39Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"What's cooking in git.git (Apr 2012, #02; Wed, 4)\n--------------------------------------------------\n\nHere are the topics that have been cooking.  Commits prefixed with '-' are\nonly in 'pu' (proposed updates) while commits prefixed with '+' are in 'next'.\n\nWith a couple of last-minute fixes to gitk breakage, 1.7.10-rc4 is out,\nand hopefully we can do the real 1.7.10 by the end of the week.\n\nYou can find the changes described here in the integration branches of the\nrepositories listed at\n\n    http://git-blame.blogspot.com/p/git-public-repositories.html\n\n--------------------------------------------------\n[New Topics]\n\n* jc/index-v4 (2012-04-04) 10 commits\n - update-index: upgrade/downgrade on-disk index version\n - read-cache.c: write prefix-compressed names in the index\n - read-cache.c: read prefix-compressed names in index on-disk version v4\n - read-cache.c: move code to copy incore to ondisk cache to a helper function\n - read-cache.c: move code to copy ondisk to incore cache to a helper function\n - read-cache.c: report the header version we do not understand\n - read-cache.c: make create_from_disk() report number of bytes it consumed\n - read-cache.c: allow unaligned mapping of the index file\n - cache.h: hide on-disk index details\n - varint: make it available outside the context of pack\n (this branch is tangled with jc/split-blob.)\n\n* jk/add-p-skip-conflicts (2012-04-04) 3 commits\n - fixup from rctay\n - snap\n - add -p: skip conflicted paths\n\n--------------------------------------------------\n[Graduated to \"master\"]\n\n* pt/gitk (2012-04-02) 2 commits\n + gitk: fix setting font display with new tabbed dialog layout.\n + gitk: fix tabbed preferences construction when using tcl 8.4\n\nPat spotted and fixed a few bugs in the latest gitk updates; we may need\nthese in 1.7.10 so testing on various platforms is very much appreciated.\n\n--------------------------------------------------\n[Stalled]\n\n* lp/maint-diff-three-dash-with-graph (2012-03-20) 3 commits\n - t4202: add test for \"log --graph --stat -p\" separator lines\n - log --graph: fix break in graph lines\n - log --graph --stat: three-dash separator should come after graph lines\n\nThe combination of two options \"log --graph --stat\" was an obscure corner\ncase nobody cared about, and did not correctly show the ancestry graph\nlines.\n\nI've split the original patch into three pieces, one for fixes to two\ndifferent issues and a test.  Also the test is adjusted so that the series\ncan be back-merged to older codebase that did not have 7f81463 (Use\ncorrect grammar in diffstat summary line, 2012-02-01) that first appeared\nin v1.7.9.2\n\nWith a review from Zbigniew, I would expect that this would be rerolled\nagain.\n\n* cn/apply-fix-ws-can-lengthen-lines (2012-03-11) 1 commit\n . apply: reallocate the postimage buffer when needed\n\nAttempts to address an ancient bug that dates back to the addition\nof an oddball \"tab-in-indent\" whitespace breakage class that wants\nto have longer lines than the original when fixing things up.\n\nNeeds more work; results in double-frees.\n\n* nd/columns (2012-03-13) 12 commits\n - column: support grouping entries\n - column: support \"denser\" mode\n - ls-files: support --column\n - tag: add --column\n - column: support piping stdout to external git-column process\n - status: add --column\n - branch: add --column\n - help: reuse print_columns() for help -a\n - column: add dense layout support\n - column: add columnar layout\n - Stop starting pager recursively\n - Add column layout skeleton and git-column\n\nRerolled again.  Modulo minor nits, looked nicer than the previous round.\n\n* nd/threaded-index-pack (2012-03-11) 2 commits\n - index-pack: support multithreaded delta resolving\n - index-pack: split second pass obj handling into own function\n\nAnother reroll after a bugreport on pthread usage discovered by Ramsey,\nbut it seems the topic is cooking between Ramsay and Duy out of tree.\nWaiting for resolution.\n\n* jh/apply-free-patch (2012-03-28) 7 commits\n - apply.c: WIP ownership audit\n - apply: free unused fragments for submodule patch\n - apply: free patch->result\n - apply: release memory for fn_table\n - apply: free patch->{def,old,new}_name fields\n - apply: rename free_patch() to free_patch_list()\n - apply: do not leak patches and fragments\n\nValgrind reports quite a lot of discarded memory inside apply.  I started\nauditing the memory ownership rules in the command, and am almost done.\n\nWill defer til 1.7.10.\n\n* ss/git-svn-prompt-sans-terminal (2012-01-04) 3 commits\n - fixup! 15eaaf4\n - git-svn, perl/Git.pm: extend Git::prompt helper for querying users\n - perl/Git.pm: \"prompt\" helper to honor GIT_ASKPASS and SSH_ASKPASS\n\nThe bottom one has been replaced with a rewrite based on comments\nfrom Ævar. The second one needs more work, both in perl/Git.pm and\nprompt.c, to give precedence to tty over SSH_ASKPASS when terminal\nis available.\n\n* jc/split-blob (2012-04-03) 7 commits\n - chunked-object: streaming checkout\n - chunked-object: fallback checkout codepaths\n - bulk-checkin: support chunked-object encoding\n - bulk-checkin: allow the same data to be multiply hashed\n - new representation types in the packstream\n - packfile: use varint functions\n - varint: make it available outside the context of pack\n (this branch is tangled with jc/index-v4.)\n\nNot ready.\n\nI finished the streaming checkout codepath, but as explained in\n127b177 (bulk-checkin: support chunked-object encoding, 2011-11-30),\nthese are still early steps of a long and painful journey. At least\npack-objects and fsck need to learn the new encoding for the series\nto be usable locally, and then index-pack/unpack-objects needs to\nlearn it to be used remotely.\n\nGiven that I heard a lot of noise that people want large files, and\nthat I was asked by somebody at GitTogether'11 privately for an\nadvice on how to pay developers (not me) to help adding necessary\nsupport, I am somewhat dissapointed that the original patch series\nthat was sent almost two months ago still remains here without much\ncomments and updates from the developer community. I even made the\ninterface to the logic that decides where to split chunks easily\nreplaceable, and I deliberately made the logic in the original patch\nextremely stupid to entice others, especially the \"bup\" fanboys, to\ncome up with a better logic, thinking that giving people an easy\ntarget to shoot for, they may be encouraged to help out. The plan is\nnot working :-(.\n\n--------------------------------------------------\n[Cooking]\n\n* bw/spawn-via-shell-path (2012-04-03) 1 commit\n - Use SHELL_PATH from build system in run_command.c:prepare_shell_cmd\n\n\"sh\" on the user's PATH may be utterly broken on some systems;\nconsistently use SHELL_PATH even from inside run-command API.\n\n* jc/commit-unedited-template (2012-04-03) 5 commits\n - Documentation/git-commit: rephrase the \"initial-ness\" of templates\n - git-commit.txt: clarify -t requires editing message\n - commit: rephrase the error when user did not touch templated log message\n - commit: do not trigger bogus \"has templated message edited\" check\n - t7501: test the right kind of breakage\n\nWhen \"git commit --template F\" errors out because the user did not touch\nthe message, it claimed that it aborts due to \"empty message\", which was\nutterly wrong.\n\n* jc/push-upstream-sanity (2012-04-03) 2 commits\n - [fixup] remove misguided \"try to see if URLs are the same\"\n - push: detect nonsense \"upstream\" check more carefully\n\n\"git push $there\" without refspec, when the current branch is set to push\nto a remote different from $there, used to push to $there using the\nupstream information to a remote unreleated to $there.\n\nThis is necessary if we were to switch the push.default to 'current'.\n\n* jk/http-backend-keep-committer-ident-env (2012-03-30) 1 commit\n - http-backend: respect existing GIT_COMMITTER_* variables\n\nThe smart-http backend used to always override GIT_COMMITTER_* variables\nwith REMOTE_USER and REMOTE_ADDR.\n\n* mk/gitweb-diff-hl (2012-04-04) 8 commits\n - gitweb: Refinement highlightning in combined diffs\n - gitweb: Highlight interesting parts of diff\n - gitweb: Push formatting diff lines to print_diff_chunk()\n - gitweb: Use print_diff_chunk() for both side-by-side and inline diffs\n - gitweb: Extract print_sidebyside_diff_lines()\n - gitweb: Pass esc_html_hl_regions() options to esc_html()\n - gitweb: esc_html_hl_regions(): Don't create empty <span> elements\n - gitweb: Use descriptive names in esc_html_hl_regions()\n\n* it/fetch-pack-many-refs (2012-04-02) 5 commits\n - remote-curl: main test case for the OS command line overflow\n - fetch-pack: test cases for the new --stdin option\n - fixup? no longer need flex argv[]\n - remote-curl: send the refs to fetch-pack on stdin\n - fetch-pack: new --stdin option to read refs from stdin\n\nWill squash the fix-up one and then requeue.\n\n* jn/debian-customizes-default-editor (2012-03-31) 3 commits\n - fixup? do not hide the \"usual\" default from readers\n - var doc: advertise current DEFAULT_PAGER and DEFAULT_EDITOR settings\n - var doc: default editor and pager are configurable at build time\n\nHaven't heard anything back for the fix-up suggestion, but otherwise\nlooked sane.\n\n* rs/commit-list-sort-in-batch (2012-04-02) 3 commits\n - revision: insert unsorted, then sort in prepare_revision_walk()\n - commit: use mergesort() in commit_list_sort_by_date()\n - add mergesort() for linked lists\n\n* hv/submodule-recurse-push (2012-03-30) 3 commits\n - push: teach --recurse-submodules the on-demand option\n - Refactor submodule push check to use string list instead of integer\n - Teach revision walking machinery to walk multiple times sequencially\n\n* dg/subtree (2012-03-25) 112 commits\n - Add 'contrib/subtree/' from commit '2e63f75b8f49abe220ef55ec4e978e7a3b8dc351'\n - Add Subtree Test Makefile\n - Build Subtree\n - Use Project Config Files\n - Remove Unneeded Files\n - ...\n\nA test merge of the 'subtree'.\n\n* jk/branch-quiet (2012-03-26) 2 commits\n - teach \"git branch\" a --quiet option\n - checkout: suppress tracking message with \"-q\"\n\nEven with \"-q\"uiet option, \"checkout\" used to report setting up tracking.\nAlso \"branch\" learns \"-q\"uiet option to squelch informational message.\n\n* jk/run-command-eacces (2012-04-03) 1 commit\n - run-command: treat inaccessible directories as ENOENT\n\nWhen PATH contains an unreadable directory, alias expansion code did not\nkick in, and failed with an error that said \"git-subcmd\" was not found.\n\n* jb/am-include (2012-03-28) 1 commit\n - am: support --include option\n\n* jc/am-report-3way (2012-03-28) 1 commit\n - am -3: list the paths that needed 3-way fallback\n\n* rs/combine-diff-zero-context-at-the-beginning (2012-03-25) 1 commit\n - combine-diff: fix loop index underflow\n\nFixes an age old corner case bug in combine diff (only triggered with -U0\nand the hunk at the beginning of the file needs to be shown).\n\n* sl/autoconf (2012-03-26) 3 commits\n - configure: be more idiomatic\n - configure: avoid some code repetitions thanks to m4_{push,pop}def\n - configure: move definitions of private m4 macros before AC_INIT invocation\n\nUpdates our configure.ac to follow a better \"autoconf\" style.\n\n* wk/gitweb-snapshot-use-if-modified-since (2012-03-30) 3 commits\n - gitweb: add If-Modified-Since handling to git_snapshot().\n - gitweb: refactor If-Modified-Since handling\n - gitweb: add `status` headers to git_feed() responses.\n\nMakes 'snapshot' request to \"gitweb\" honor If-Modified-Since: header,\nbased on the commit date.\n\n* jk/diff-no-rename-empty (2012-03-23) 4 commits\n - merge-recursive: don't detect renames of empty files\n - teach diffcore-rename to optionally ignore empty content\n - make is_empty_blob_sha1 available everywhere\n - drop casts from users EMPTY_TREE_SHA1_BIN\n\nForbids rename detection logic from matching two empty files as renames\nduring merge-recursive to prevent mismerges.\n\n* th/difftool-diffall (2012-04-04) 8 commits\n - difftool: print list of valid tools with '--tool-help'\n - difftool: teach difftool to handle directory diffs\n - difftool: eliminate setup_environment function\n - difftool: stop appending '.exe' to git\n - difftool: remove explicit change of PATH\n - difftool: exit(0) when usage is printed\n - difftool: add '--no-gui' option\n - difftool: parse options using Getopt::Long\n\nRolls the two-directory-diff logic from diffall script (in contrib/) into\n\"git difftool\" framework. \n\n* jc/maint-clean-nested-worktree-in-subdir (2012-03-15) 2 commits\n  (merged to 'next' on 2012-03-20 at fb5485e)\n + clean: preserve nested git worktree in subdirectories\n + remove_dir_recursively(): Add flag for skipping removal of toplevel dir\n (this branch is tangled with jh/notes-merge-in-git-dir-worktree.)\n\n\"git clean -d -f\" (not \"-d -f -f\") is supposed to protect nested working\ntrees of independent git repositories that exist in the current project\nworking tree from getting removed, but the protection applied only to such\nworking trees that are at the top-level of the current project by mistake.\n\nNot urgent.\n\n* ct/advise-push-default (2012-03-26) 2 commits\n  (merged to 'next' on 2012-03-28 at 62764ae)\n + clean up struct ref's nonfastforward field\n + push: Provide situational hints for non-fast-forward errors\n\nBreaks down the cases in which \"git push\" fails due to non-ff into three\ncategories, and gives separate advise messages.  This should be a good\nchange regardless of mm/push-default-switch-warning topic.\n\n* nl/rebase-i-cheat-sheet (2012-03-20) 1 commit\n  (merged to 'next' on 2012-03-20 at 3092a2b)\n + rebase -i: remind that the lines are top-to-bottom\n\nNot urgent.\n\n* da/difftool-test (2012-03-19) 1 commit\n  (merged to 'next' on 2012-03-20 at 0ada7d4)\n + t7800: Test difftool passing arguments to diff\n\nMakes sure \"difftool\" options can be given in any order.\n\n* jh/notes-merge-in-git-dir-worktree (2012-03-15) 4 commits\n  (merged to 'next' on 2012-03-20 at 0c1b1de)\n + notes-merge: Don't remove .git/NOTES_MERGE_WORKTREE; it may be the user's cwd\n + notes-merge: use opendir/readdir instead of using read_directory()\n + t3310: illustrate failure to \"notes merge --commit\" inside $GIT_DIR/\n + remove_dir_recursively(): Add flag for skipping removal of toplevel dir\n (this branch is tangled with jc/maint-clean-nested-worktree-in-subdir.)\n\nRunning \"notes merge --commit\" failed to perform correctly when run\nfrom any directory inside $GIT_DIR/.  When \"notes merge\" stops with\nconflicts, $GIT_DIR/NOTES_MERGE_WORKTREE is the place a user edits\nto resolve it.\n\nNot urgent.\n\n* jn/diffstat-tests (2012-03-13) 7 commits\n  (merged to 'next' on 2012-03-20 at 8791b2f)\n + diffstat summary line varies by locale: miscellany\n + test: use numstat instead of diffstat in binary-diff test\n + test: use --numstat instead of --stat in \"git stash show\" tests\n + test: test cherry-pick functionality and output separately\n + test: modernize funny-names test style\n + test: use numstat instead of diffstat in funny-names test\n + test: use test_i18ncmp when checking --stat output\n\nSome tests checked the \"diff --stat\" output when they do not have to,\nwhich unnecessarily made things harder to verify under GETTEXT_POISON.\n\nNot urgent.\n\n* tr/maint-word-diff-regex-sticky (2012-03-14) 3 commits\n  (merged to 'next' on 2012-03-20 at b3f67cd)\n + diff: tweak a _copy_ of diff_options with word-diff\n + diff: refactor the word-diff setup from builtin_diff_cmd\n + t4034: diff.*.wordregex should not be \"sticky\" in --word-diff\n\nThe regexp configured with wordregex was incorrectly reused across\nfiles.\nNot urgent.\n\n* zj/test-cred-helper-nicer-prove (2012-03-15) 2 commits\n  (merged to 'next' on 2012-03-20 at b675ec1)\n + t0303: resurrect commit message as test documentation\n + t0303: immediately bail out w/o GIT_TEST_CREDENTIAL_HELPER\n\nMinor improvement to t0303.\nNot urgent.\n\n* jc/commit-hook-authorship (2012-03-11) 3 commits\n  (merged to 'next' on 2012-03-12 at 05ca7f8)\n + commit: pass author/committer info to hooks\n + t7503: does pre-commit-hook learn authorship?\n + ident.c: add split_ident_line() to parse formatted ident line\n (this branch is tangled with jc/run-hook-env-1.)\n\n\"git commit --author=$name\" did not tell the name that was being\nrecorded in the resulting commit to hooks, even though it does do so\nwhen the end user overrode the authorship via the \"GIT_AUTHOR_NAME\"\nenvironment variable.  This is a simpler of the two approaches.\n\nWill defer til 1.7.10.\n\n* jc/run-hook-env-1 (2012-03-11) 3 commits\n - run_hook(): enhance the interface to pass arbitrary environment\n + t7503: does pre-commit-hook learn authorship?\n + ident.c: add split_ident_line() to parse formatted ident line\n (this branch is tangled with jc/commit-hook-authorship.)\n\nNot urgent.\n\nUpdates run_hook() API to be much less specific to \"commit\".  It would\nonly be useful if people start doing more interesting things with hooks.\n\n* jc/diff-algo-cleanup (2012-02-19) 2 commits\n  (merged to 'next' on 2012-03-15 at cca0032)\n + xdiff: PATIENCE/HISTOGRAM are not independent option bits\n + xdiff: remove XDL_PATCH_* macros\n\nResurrects the preparatory clean-up patches from another topic that was\ndiscarded, as this would give a saner foundation to build on diff.algo\nconfiguration option series.\n\nNot urgent.\n\n* rs/unpack-trees-leakfix (2012-03-06) 1 commit\n  (merged to 'next' on 2012-03-07 at 69a69cd)\n + unpack-trees: plug minor memory leak\n\nWill defer til 1.7.10.\n\n* mm/push-default-switch-warning (2012-03-09) 1 commit\n  (merged to 'next' on 2012-03-28 at 074b16b)\n + push: start warning upcoming default change for push.default\n\nNot urgent.\n\nThis resurrects an ancient patch I wrote during a discussion we had in the\n1.6.3-1.6.4 era.  This should probably come after ct/advise-push-default\ntopic and at that point the advise messages need to be rephrased, taking\nthe future default change into account.\n\n* jc/fmt-merge-msg-people (2012-03-13) 1 commit\n - fmt-merge-msg: show those involved in a merged series\n\nThe \"fmt-merge-msg\" command learns to list the primary contributors\ninvolved in the side topic you are merging.\n\nWill defer til 1.7.10.\n\n* nl/http-proxy-more (2012-03-15) 5 commits\n  (merged to 'next' on 2012-03-20 at c004001)\n + http: rename HTTP_REAUTH to HTTP_AUTH_RETRY\n + http: Avoid limit of retrying request only twice\n + http: handle proxy authentication failure (error 407)\n + http: handle proxy proactive authentication\n + http: try http_proxy env var when http.proxy config option is not set\n\nThe code to talk to http proxies learn to use the same credential\nAPI used to talk to the final http destinations.\n\nWill defer til 1.7.10.\n\n* nd/stream-more (2012-03-07) 7 commits\n  (merged to 'next' on 2012-03-07 at 7325922)\n + update-server-info: respect core.bigfilethreshold\n + fsck: use streaming API for writing lost-found blobs\n + show: use streaming API for showing blobs\n + parse_object: avoid putting whole blob in core\n + cat-file: use streaming API to print blobs\n + Add more large blob test cases\n + streaming: make streaming-write-entry to be more reusable\n\nUse API to read blob data in smaller chunks in more places to\nreduce the memory footprint.  In general, looked fairly good.\n\nWill defer til 1.7.10.\n\n--------------------------------------------------\n[Discarded]\n\n* tb/maint-remove-irrelevant-i18n-test (2012-03-06) 1 commit\n  (merged to 'next' on 2012-03-07 at 23f2dd1)\n + t0204: remove a test that checks undefined behaviour\n\nI tentatively parked this in 'next' but later reverted the merge.\n\n* dg/test-from-elsewhere (2012-03-04) 2 commits\n . Support out-of-tree Valgrind tests\n . Allow overriding GIT_BUILD_DIR\n\nNo immediate need; dropped.\n"},{"id":"188559","messageId":"20120405124706.GA3921@sigill.intra.peff.net","threadId":"30151","inReplyTo":"7v8vib6pu8.fsf@alter.siamese.dyndns.org","subject":"Re: What's cooking in git.git (Apr 2012, #02; Wed, 4)","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2012-04-05T12:47:06Z","receivedAt":"2012-04-05T12:47:06Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Apr 04, 2012 at 04:26:39PM -0700, Junio C Hamano wrote:\n\n> * jc/push-upstream-sanity (2012-04-03) 2 commits\n>  - [fixup] remove misguided \"try to see if URLs are the same\"\n>  - push: detect nonsense \"upstream\" check more carefully\n> \n> \"git push $there\" without refspec, when the current branch is set to push\n> to a remote different from $there, used to push to $there using the\n> upstream information to a remote unreleated to $there.\n\nThe patch produced by squashing those together looks good to me.  Though\nit might be worth getting input from people who use \"upstream\" (whether\nit becomes the default or not) by re-posting the final patch under a\nmore obvious subject.\n\n> This is necessary if we were to switch the push.default to 'current'.\n\nI assume you meant \"upstream\" here.\n\n-Peff\n"},{"id":"188567","messageId":"7v1uo26ue9.fsf_-_@alter.siamese.dyndns.org","threadId":"30151","inReplyTo":"20120405124706.GA3921@sigill.intra.peff.net","subject":"[PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-05T16:00:30Z","receivedAt":"2012-04-05T16:00:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"The user can say \"git push\" without specifying any refspec.  When using\nthe \"upstream\" semantics via the push.default configuration, the user\nwants to update the \"upstream\" branch of the current branch, which is the\nbranch at a remote repository the current branch is set to integrate with,\nwith this command.\n\nHowever, there are cases that such a \"git push\" that uses the \"upstream\"\nsemantics does not make sense:\n\n - The current branch does not have branch.$name.remote configured.  By\n   definition, \"git push\" that does not name where to push to will not\n   know where to push to.  The user may explicitly say \"git push $there\",\n   but again, by definition, no branch at repository $there is set to\n   integrate with the current branch in this case and we wouldn't know\n   which remote branch to update.\n\n - The current branch does have branch.$name.remote configured, but it\n   does not specify branch.$name.merge that names what branch at the\n   remote this branch integrates with. \"git push\" knows where to push in\n   this case (or the user may explicitly say \"git push $remote\" to tell us\n   where to push), but we do not know which remote branch to update.\n\n - The current branch does have its remote and upstream branch configured,\n   but the user said \"git push $there\", where $there is not the remote\n   named by \"branch.$name.remote\".  By definition, no branch at repository\n   $there is set to integrate with the current branch in this case, and\n   this push is not meant to update any branch at the remote repository\n   $there.\n\nThe first two cases were already checked correctly, but the third case was\nnot checked and we ended up updating the branch named branch.$name.merge\nat repository $there, which was totally bogus.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\nJeff King <peff@peff.net> writes:\n\n> The patch produced by squashing those together looks good to me.  Though\n> it might be worth getting input from people who use \"upstream\" (whether\n> it becomes the default or not) by re-posting the final patch under a\n> more obvious subject.\n\nOne obvious glitch that used to make \"upstream\" an unsuitable default for\nbeginners is down. Any others?\n\n builtin/push.c          |   25 +++++++++++++++-------\n t/t5528-push-default.sh |   54 +++++++++++++++++++++++++++++++++++++++++++++++\n 2 files changed, 71 insertions(+), 8 deletions(-)\n create mode 100755 t/t5528-push-default.sh\n\ndiff --git a/builtin/push.c b/builtin/push.c\nindex d315475..765b19c 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -65,6 +65,16 @@ static void set_refspecs(const char **refs, int nr)\n \t}\n }\n \n+static int push_url_of_remote(struct remote *remote, const char ***url_p)\n+{\n+\tif (remote->pushurl_nr) {\n+\t\t*url_p = remote->pushurl;\n+\t\treturn remote->pushurl_nr;\n+\t}\n+\t*url_p = remote->url;\n+\treturn remote->url_nr;\n+}\n+\n static void setup_push_upstream(struct remote *remote)\n {\n \tstruct strbuf refspec = STRBUF_INIT;\n@@ -76,7 +86,7 @@ static void setup_push_upstream(struct remote *remote)\n \t\t    \"\\n\"\n \t\t    \"    git push %s HEAD:<name-of-remote-branch>\\n\"),\n \t\t    remote->name);\n-\tif (!branch->merge_nr || !branch->merge)\n+\tif (!branch->merge_nr || !branch->merge || !branch->remote_name)\n \t\tdie(_(\"The current branch %s has no upstream branch.\\n\"\n \t\t    \"To push the current branch and set the remote as upstream, use\\n\"\n \t\t    \"\\n\"\n@@ -87,6 +97,11 @@ static void setup_push_upstream(struct remote *remote)\n \tif (branch->merge_nr != 1)\n \t\tdie(_(\"The current branch %s has multiple upstream branches, \"\n \t\t    \"refusing to push.\"), branch->name);\n+\tif (strcmp(branch->remote_name, remote->name))\n+\t\tdie(_(\"You are pushing to remote '%s', which is not the \"\n+\t\t      \"upstream of your\\ncurrent branch '%s'.\\n\"),\n+\t\t    remote->name, branch->name);\n+\n \tstrbuf_addf(&refspec, \"%s:%s\", branch->name, branch->merge[0]->src);\n \tadd_refspec(refspec.buf);\n }\n@@ -196,13 +211,7 @@ static int do_push(const char *repo, int flags)\n \t\t\tsetup_default_push_refspecs(remote);\n \t}\n \terrs = 0;\n-\tif (remote->pushurl_nr) {\n-\t\turl = remote->pushurl;\n-\t\turl_nr = remote->pushurl_nr;\n-\t} else {\n-\t\turl = remote->url;\n-\t\turl_nr = remote->url_nr;\n-\t}\n+\turl_nr = push_url_of_remote(remote, &url);\n \tif (url_nr) {\n \t\tfor (i = 0; i < url_nr; i++) {\n \t\t\tstruct transport *transport =\ndiff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh\nnew file mode 100755\nindex 0000000..c334c51\n--- /dev/null\n+++ b/t/t5528-push-default.sh\n@@ -0,0 +1,54 @@\n+#!/bin/sh\n+\n+test_description='check various push.default settings'\n+. ./test-lib.sh\n+\n+test_expect_success 'setup bare remotes' '\n+\tgit init --bare repo1 &&\n+\tgit remote add parent1 repo1 &&\n+\tgit init --bare repo2 &&\n+\tgit remote add parent2 repo2 &&\n+\ttest_commit one &&\n+\tgit push parent1 HEAD &&\n+\tgit push parent2 HEAD\n+'\n+\n+test_expect_success '\"upstream\" pushes to configured upstream' '\n+\tgit checkout master &&\n+\ttest_config branch.master.remote parent1 &&\n+\ttest_config branch.master.merge refs/heads/foo &&\n+\ttest_config push.default upstream &&\n+\ttest_commit two &&\n+\tgit push &&\n+\techo two >expect &&\n+\tgit --git-dir=repo1 log -1 --format=%s foo >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success '\"upstream\" does not push on unconfigured remote' '\n+\tgit checkout master &&\n+\ttest_unconfig branch.master.remote &&\n+\ttest_config push.default upstream &&\n+\ttest_commit three &&\n+\ttest_must_fail git push\n+'\n+\n+test_expect_success '\"upstream\" does not push on unconfigured branch' '\n+\tgit checkout master &&\n+\ttest_config branch.master.remote parent1 &&\n+\ttest_unconfig branch.master.merge &&\n+\ttest_config push.default upstream\n+\ttest_commit four &&\n+\ttest_must_fail git push\n+'\n+\n+test_expect_success '\"upstream\" does not push when remotes do not match' '\n+\tgit checkout master &&\n+\ttest_config branch.master.remote parent1 &&\n+\ttest_config branch.master.merge refs/heads/foo &&\n+\ttest_config push.default upstream &&\n+\ttest_commit five &&\n+\ttest_must_fail git push parent2\n+'\n+\n+test_done\n-- \n1.7.10.rc4.54.g1d5dd3\n"},{"id":"188577","messageId":"20120405184345.GA6448@burratino","threadId":"30151","inReplyTo":"7v1uo26ue9.fsf_-_@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-04-05T18:43:45Z","receivedAt":"2012-04-05T18:43:45Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> --- a/builtin/push.c\n> +++ b/builtin/push.c\n> @@ -65,6 +65,16 @@ static void set_refspecs(const char **refs, int nr)\n[...]\n> @@ -87,6 +97,11 @@ static void setup_push_upstream(struct remote *remote)\n>  \tif (branch->merge_nr != 1)\n>  \t\tdie(_(\"The current branch %s has multiple upstream branches, \"\n>  \t\t    \"refusing to push.\"), branch->name);\n> +\tif (strcmp(branch->remote_name, remote->name))\n> +\t\tdie(_(\"You are pushing to remote '%s', which is not the \"\n> +\t\t      \"upstream of your\\ncurrent branch '%s'.\\n\"),\n> +\t\t    remote->name, branch->name);\n> +\n\nI worry that a beginner seeing this message would think it means that\nwhen \"master\" is set up to track origin/master that there is no way to\npush that branch to any other repository.\n\nMaybe something like\n\n\t\tdie(_(\n\"You are pushing to remote '%s', which is not the upstream of your\\n\"\n\"current branch '%s', without specifying a refspec.\\n\"),\n\t\t    remote->name, branch->name);\n\nwould be harder to misunderstand.\n"},{"id":"188585","messageId":"7vlima5591.fsf@alter.siamese.dyndns.org","threadId":"30151","inReplyTo":"20120405184345.GA6448@burratino","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-05T19:48:58Z","receivedAt":"2012-04-05T19:48:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> I worry that a beginner seeing this message would think it means that\n> when \"master\" is set up to track origin/master that there is no way to\n> push that branch to any other repository.\n>\n> Maybe something like\n>\n> \t\tdie(_(\n> \"You are pushing to remote '%s', which is not the upstream of your\\n\"\n> \"current branch '%s', without specifying a refspec.\\n\"),\n> \t\t    remote->name, branch->name);\n>\n> would be harder to misunderstand.\n\nPerhaps.  Do we need to rephrase it without using the word 'refspec'\n(e.g. \"without telling me what to push\"), or there is no point avoiding\njargon because other jargons (i.e. 'remote' and 'upstream') already appear\nin the sentence?\n"},{"id":"188586","messageId":"20120405195832.GA6885@burratino","threadId":"30151","inReplyTo":"7vlima5591.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-04-05T19:58:32Z","receivedAt":"2012-04-05T19:58:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> Maybe something like\n>>\n>> \t\tdie(_(\n>> \"You are pushing to remote '%s', which is not the upstream of your\\n\"\n>> \"current branch '%s', without specifying a refspec.\\n\"),\n>> \t\t    remote->name, branch->name);\n>>\n>> would be harder to misunderstand.\n>\n> Perhaps.  Do we need to rephrase it without using the word 'refspec'\n> (e.g. \"without telling me what to push\"), or there is no point avoiding\n> jargon because other jargons (i.e. 'remote' and 'upstream') already appear\n> in the sentence?\n\n\"without telling me what to push\" sounds good.\n"},{"id":"188587","messageId":"7vhawy54nd.fsf@alter.siamese.dyndns.org","threadId":"30151","inReplyTo":"7vlima5591.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-05T20:01:58Z","receivedAt":"2012-04-05T20:01:58Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n>\n>> I worry that a beginner seeing this message would think it means that\n>> when \"master\" is set up to track origin/master that there is no way to\n>> push that branch to any other repository.\n>>\n>> Maybe something like\n>>\n>> \t\tdie(_(\n>> \"You are pushing to remote '%s', which is not the upstream of your\\n\"\n>> \"current branch '%s', without specifying a refspec.\\n\"),\n>> \t\t    remote->name, branch->name);\n>>\n>> would be harder to misunderstand.\n>\n> Perhaps.  Do we need to rephrase it without using the word 'refspec'\n> (e.g. \"without telling me what to push\"), or there is no point avoiding\n> jargon because other jargons (i.e. 'remote' and 'upstream') already appear\n> in the sentence?\n\nHow about phrasing it this way?\n\nNote that the short-looking first line (in the context) and the second\nline (updated) of the message are very much on purpose, to give '%s'\nenough room to expand without overflowing the usual terminal width.\n\n builtin/push.c |    4 +++-\n 1 file changed, 3 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/push.c b/builtin/push.c\nindex 765b19c..7a20036 100644\n--- a/builtin/push.c\n+++ b/builtin/push.c\n@@ -99,7 +99,9 @@ static void setup_push_upstream(struct remote *remote)\n \t\t    \"refusing to push.\"), branch->name);\n \tif (strcmp(branch->remote_name, remote->name))\n \t\tdie(_(\"You are pushing to remote '%s', which is not the \"\n-\t\t      \"upstream of your\\ncurrent branch '%s'.\\n\"),\n+\t\t      \"upstream of your\\ncurrent branch '%s',\\n\"\n+\t\t      \"without telling me to push which local branch to\\n\"\n+\t\t      \" update which remote branch with.\"),\n \t\t    remote->name, branch->name);\n \n \tstrbuf_addf(&refspec, \"%s:%s\", branch->name, branch->merge[0]->src);\n"},{"id":"188589","messageId":"20120405202327.GB6885@burratino","threadId":"30151","inReplyTo":"7vhawy54nd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2012-04-05T20:23:27Z","receivedAt":"2012-04-05T20:23:27Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> How about phrasing it this way?\n[\n\tfatal: You are pushing to remote '%s', which is not the upstream of your\n\tcurrent branch '%s',\n\twithout telling me to push which local branch to\n\t update which remote branch with.\n]\n\nI think some words got jumbled a little.  But in that spirit, maybe\nhere's a start:\n\n\tfatal: You are pushing to remote 'somethinglong',\n\twhich is not the upstream of your current branch 'something/very/long',\n\twithout telling me which local branches to use to update which\n\tremote branches.\n"},{"id":"188590","messageId":"vpqsjgi53mh.fsf@bauges.imag.fr","threadId":"30151","inReplyTo":"7vhawy54nd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-04-05T20:24:06Z","receivedAt":"2012-04-05T20:24:06Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>  \t\tdie(_(\"You are pushing to remote '%s', which is not the \"\n> -\t\t      \"upstream of your\\ncurrent branch '%s'.\\n\"),\n> +\t\t      \"upstream of your\\ncurrent branch '%s',\\n\"\n> +\t\t      \"without telling me to push which local branch to\\n\"\n> +\t\t      \" update which remote branch with.\"),\n\nSounds overly complex sentence to me. \"without telling me what to push\"\nsounded good enough without being long, so I prefered it.\n\nI like accompanying these messages with the way out for the user, so\nperhaps we can add stg like\n\n\"To push the current branch to this remote, run:\n\n  git push <remote> <branch>\n\n\"\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"188591","messageId":"7vy5q95354.fsf@alter.siamese.dyndns.org","threadId":"30151","inReplyTo":"vpqsjgi53mh.fsf@bauges.imag.fr","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-05T20:34:31Z","receivedAt":"2012-04-05T20:34:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n>\n>>  \t\tdie(_(\"You are pushing to remote '%s', which is not the \"\n>> -\t\t      \"upstream of your\\ncurrent branch '%s'.\\n\"),\n>> +\t\t      \"upstream of your\\ncurrent branch '%s',\\n\"\n>> +\t\t      \"without telling me to push which local branch to\\n\"\n>> +\t\t      \" update which remote branch with.\"),\n>\n> Sounds overly complex sentence to me. \"without telling me what to push\"\n> sounded good enough without being long, so I prefered it.\n\nYou are right; it is overly complex.\n\nAfter sending the updated patch, I rewrote it again to:\n\n    You are pushing to remote '%s', which is not the upstream of\n    your current branch '%s', without telling me what to push\n    to update which remote branch.\n\nThe point of Jonathan's 'refspec' and this attempt to rephrase it without\nusing a jargon is to make sure that the user realizes that both ends can\nbe specified.\n\n> I like accompanying these messages with the way out for the user, so\n> perhaps we can add stg like\n>\n> \"To push the current branch to this remote, run:\n>\n>   git push <remote> <branch>\n>\n> \"\n\nI am afraid that the above advice is a lot worse than leaving it unsaid.\n\nWe are in no position to assume that the user wanted the \"current\"\nsemantics when we issue this message.  Otherwise, we would be better off\nswitching the default semantics to \"current\", not \"upstream\".  But the\nworking assumption in this series is that \"upstream\" is an improvement\nover \"current\", no?\n"},{"id":"188636","messageId":"vpqiphd49fx.fsf@bauges.imag.fr","threadId":"30151","inReplyTo":"7vy5q95354.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] push: error out when the \"upstream\" semantics does not make sense","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2012-04-06T07:16:02Z","receivedAt":"2012-04-06T07:16:02Z","isPatch":true,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>> \"To push the current branch to this remote, run:\n>>\n>>   git push <remote> <branch>\n>>\n>> \"\n>\n> I am afraid that the above advice is a lot worse than leaving it unsaid.\n>\n> We are in no position to assume that the user wanted the \"current\"\n> semantics when we issue this message.  Otherwise, we would be better off\n> switching the default semantics to \"current\", not \"upstream\".  But the\n> working assumption in this series is that \"upstream\" is an improvement\n> over \"current\", no?\n\nI'm not sure. I do support \"upstream\", but I also think that in many\n(most?) cases, the user will want to set \"upstream\" to point to the\nbranch with the same name. If there is any confusion between \"current\"\nand \"upstream\", then avoiding situations where they do something\ndifferent is not stupid. This is already what we do when there is no\nupstream configured at all:\n\n  $ git push origin\n  fatal: The current branch master has no upstream branch.\n  To push the current branch and set the remote as upstream, use\n  \n      git push --set-upstream origin master\n\nOTOH, if the user sees this message, he already has several remotes\nconfigured, and we can probably expect him not to be a total newbie.\nThen suggesting\n\n  \"git push --set-upstream %s %s:<remote-branch-name>\", remote->name, branch->name\n\nwould make sense.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}