{"thread":{"id":"36380","subject":"[PATCH 0/5] Fixes","startedAt":"2014-04-09T18:49:59Z","lastAt":"2014-04-09T20:36:38Z","messageCount":8,"participants":["Felipe Contreras","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"238594","messageId":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":null,"subject":"[PATCH 0/5] Fixes","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:49:59Z","receivedAt":"2014-04-09T18:49:59Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Felipe Contreras (4):\n  remote-helpers: allow all tests running from any dir\n  remote-hg: always normalize paths\n  remote-bzr: add support for older versions\n  completion: fix completion of certain aliases\n\ndequis (1):\n  remote-bzr: include authors field in pushed commits\n\n contrib/completion/git-completion.bash   |  1 +\n contrib/completion/git-completion.zsh    |  1 +\n contrib/remote-helpers/git-remote-bzr    |  6 ++++--\n contrib/remote-helpers/git-remote-hg     |  1 +\n contrib/remote-helpers/test-bzr.sh       | 24 ++++++++++++++++++++++++\n contrib/remote-helpers/test-hg-bidi.sh   |  3 ++-\n contrib/remote-helpers/test-hg-hg-git.sh |  3 ++-\n 7 files changed, 35 insertions(+), 4 deletions(-)\n\n-- \n1.9.1+fc1\n"},{"id":"238595","messageId":"1397069404-7451-2-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 1/5] remote-helpers: allow all tests running from any dir","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:50:00Z","receivedAt":"2014-04-09T18:50:00Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Commit d3243d7 (test-bzr.sh, test-hg.sh: allow running from any dir)\nallowed the tests to run from any directory, however, it didn't update\nall the tests.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/test-hg-bidi.sh   | 3 ++-\n contrib/remote-helpers/test-hg-hg-git.sh | 3 ++-\n 2 files changed, 4 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/remote-helpers/test-hg-bidi.sh b/contrib/remote-helpers/test-hg-bidi.sh\nindex e24c51d..d86e147 100755\n--- a/contrib/remote-helpers/test-hg-bidi.sh\n+++ b/contrib/remote-helpers/test-hg-bidi.sh\n@@ -8,7 +8,8 @@\n \n test_description='Test bidirectionality of remote-hg'\n \n-. ./test-lib.sh\n+test -n \"$TEST_DIRECTORY\" || TEST_DIRECTORY=${0%/*}/../../t\n+. \"$TEST_DIRECTORY\"/test-lib.sh\n \n if ! test_have_prereq PYTHON\n then\ndiff --git a/contrib/remote-helpers/test-hg-hg-git.sh b/contrib/remote-helpers/test-hg-hg-git.sh\nindex 6dcd95d..b23909a 100755\n--- a/contrib/remote-helpers/test-hg-hg-git.sh\n+++ b/contrib/remote-helpers/test-hg-hg-git.sh\n@@ -8,7 +8,8 @@\n \n test_description='Test remote-hg output compared to hg-git'\n \n-. ./test-lib.sh\n+test -n \"$TEST_DIRECTORY\" || TEST_DIRECTORY=${0%/*}/../../t\n+. \"$TEST_DIRECTORY\"/test-lib.sh\n \n if ! test_have_prereq PYTHON\n then\n-- \n1.9.1+fc1\n"},{"id":"238596","messageId":"1397069404-7451-3-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 2/5] remote-hg: always normalize paths","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:50:01Z","receivedAt":"2014-04-09T18:50:01Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Apparently Mercurial can have paths such as 'foo//bar', so normalize all\npaths.\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-hg | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/contrib/remote-helpers/git-remote-hg b/contrib/remote-helpers/git-remote-hg\nindex eb89ef6..84e3872 100755\n--- a/contrib/remote-helpers/git-remote-hg\n+++ b/contrib/remote-helpers/git-remote-hg\n@@ -260,6 +260,7 @@ class Parser:\n         return (user, int(date), -tz)\n \n def fix_file_path(path):\n+    path = os.path.normpath(path)\n     if not os.path.isabs(path):\n         return path\n     return os.path.relpath(path, '/')\n-- \n1.9.1+fc1\n"},{"id":"238597","messageId":"1397069404-7451-4-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 3/5] remote-bzr: add support for older versions","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:50:02Z","receivedAt":"2014-04-09T18:50:02Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-bzr | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr\nindex 332aba7..7f354c8 100755\n--- a/contrib/remote-helpers/git-remote-bzr\n+++ b/contrib/remote-helpers/git-remote-bzr\n@@ -759,7 +759,7 @@ def clone(path, remote_branch):\n def get_remote_branch(name):\n     remote_branch = bzrlib.branch.Branch.open(branches[name],\n                                               possible_transports=transports)\n-    if isinstance(remote_branch.user_transport, bzrlib.transport.local.LocalTransport):\n+    if isinstance(remote_branch.bzrdir.root_transport, bzrlib.transport.local.LocalTransport):\n         return remote_branch\n \n     branch_path = os.path.join(dirname, 'clone', name)\n@@ -842,7 +842,7 @@ def get_repo(url, alias):\n     if not wanted:\n         try:\n             repo = origin.open_repository()\n-            if not repo.user_transport.listable():\n+            if not repo.bzrdir.root_transport.listable():\n                 # this repository is not usable for us\n                 raise bzrlib.errors.NoRepositoryPresent(repo.bzrdir)\n         except bzrlib.errors.NoRepositoryPresent:\n-- \n1.9.1+fc1\n"},{"id":"238598","messageId":"1397069404-7451-5-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 4/5] remote-bzr: include authors field in pushed commits","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:50:03Z","receivedAt":"2014-04-09T18:50:03Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"From: dequis <dx@dxzone.com.ar>\n\nTests-by: Felipe Contreras <felipe.contreras@gmail.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/remote-helpers/git-remote-bzr |  2 ++\n contrib/remote-helpers/test-bzr.sh    | 24 ++++++++++++++++++++++++\n 2 files changed, 26 insertions(+)\n\ndiff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr\nindex 7f354c8..6ca1e97 100755\n--- a/contrib/remote-helpers/git-remote-bzr\n+++ b/contrib/remote-helpers/git-remote-bzr\n@@ -618,10 +618,12 @@ def parse_commit(parser):\n         files[path] = f\n \n     committer, date, tz = committer\n+    author, _, _ = author\n     parents = [mark_to_rev(p) for p in parents]\n     revid = bzrlib.generate_ids.gen_revision_id(committer, date)\n     props = {}\n     props['branch-nick'] = branch.nick\n+    props['authors'] = author\n \n     mtree = CustomTree(branch, revid, parents, files)\n     changes = mtree.iter_changes()\ndiff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh\nindex 1e53ff9..431de3b 100755\n--- a/contrib/remote-helpers/test-bzr.sh\n+++ b/contrib/remote-helpers/test-bzr.sh\n@@ -391,4 +391,28 @@ test_expect_success 'export utf-8 authors' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success 'push different author' '\n+\ttest_when_finished \"rm -rf bzrrepo gitrepo\" &&\n+\n+\tbzr init bzrrepo &&\n+\n+\t(\n+\tgit init gitrepo &&\n+\tcd gitrepo &&\n+\techo john >> content &&\n+\tgit add content &&\n+\tgit commit -m john --author \"John Doe <jdoe@example.com>\" &&\n+\tgit remote add bzr \"bzr::../bzrrepo\" &&\n+\tgit push bzr master\n+\t) &&\n+\n+\t(\n+\tcd bzrrepo &&\n+\tbzr log | grep \"^author: \" > ../actual\n+\t) &&\n+\n+\techo \"author: John Doe <jdoe@example.com>\" > expected &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n1.9.1+fc1\n"},{"id":"238599","messageId":"1397069404-7451-6-git-send-email-felipe.contreras@gmail.com","threadId":"36380","inReplyTo":"1397069404-7451-1-git-send-email-felipe.contreras@gmail.com","subject":"[PATCH 5/5] completion: fix completion of certain aliases","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T18:50:04Z","receivedAt":"2014-04-09T18:50:04Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Some commands need the first word to determine the actual action that is\nbeing executed, however, the command is wrong when we use an alias, for\nexample 'alias.p=push', if we try to complete 'git p origin ', the\nresult would be wrong because __git_complete_remote_or_refspec() doesn't\nknow where it come from.\n\nSo let's override words[1], so the alias 'p' is override by the actual\ncommand, 'push'.\n\nReported-by: Aymeric Beaumet <aymeric.beaumet@gmail.com>\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n contrib/completion/git-completion.bash | 1 +\n contrib/completion/git-completion.zsh  | 1 +\n 2 files changed, 2 insertions(+)\n\ndiff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\nindex 9525343..893ae5d 100644\n--- a/contrib/completion/git-completion.bash\n+++ b/contrib/completion/git-completion.bash\n@@ -2547,6 +2547,7 @@ __git_main ()\n \n \tlocal expansion=$(__git_aliased_command \"$command\")\n \tif [ -n \"$expansion\" ]; then\n+\t\twords[1]=$expansion\n \t\tcompletion_func=\"_git_${expansion//-/_}\"\n \t\tdeclare -f $completion_func >/dev/null && $completion_func\n \tfi\ndiff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\nindex 6b77968..9f6f0fa 100644\n--- a/contrib/completion/git-completion.zsh\n+++ b/contrib/completion/git-completion.zsh\n@@ -104,6 +104,7 @@ __git_zsh_bash_func ()\n \n \tlocal expansion=$(__git_aliased_command \"$command\")\n \tif [ -n \"$expansion\" ]; then\n+\t\twords[1]=$expansion\n \t\tcompletion_func=\"_git_${expansion//-/_}\"\n \t\tdeclare -f $completion_func >/dev/null && $completion_func\n \tfi\n-- \n1.9.1+fc1\n"},{"id":"238600","messageId":"xmqqa9bu1enk.fsf@gitster.dls.corp.google.com","threadId":"36380","inReplyTo":"1397069404-7451-6-git-send-email-felipe.contreras@gmail.com","subject":"Re: [PATCH 5/5] completion: fix completion of certain aliases","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-04-09T19:33:35Z","receivedAt":"2014-04-09T19:33:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Felipe Contreras <felipe.contreras@gmail.com> writes:\n\n> Some commands need the first word to determine the actual action that is\n> being executed, however, the command is wrong when we use an alias, for\n> example 'alias.p=push', if we try to complete 'git p origin ', the\n> result would be wrong because __git_complete_remote_or_refspec() doesn't\n> know where it come from.\n>\n> So let's override words[1], so the alias 'p' is override by the actual\n> command, 'push'.\n>\n> Reported-by: Aymeric Beaumet <aymeric.beaumet@gmail.com>\n> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> ---\n\nDoes \"some commands\" above refer to anything that uses\n__git_complete_remote_or_refspec, or is the set of commands larger\nthan that?\n\nI am wondering if it is safer to introduce a new \"local\" variable\nthat is set by the caller of __git_complete_remote_or_refspec and\ninspected by __git_complete_remote_or_refspec (instead of words[1])\nto communiate the real name of the git subcommand being completed,\nwithout touching words[] in place.\n\nThat way, we wouldn't have to worry about all the other references\nof words[c], words[i], words[CURRENT] etc. in the script seeing the\nword that the end-user did not type and did not actually appear on\nthe command line.\n\nBut perhaps we muck with the contents of words[] in a similar way in\nmany different places in the existing completion code often enough\nthat such an attempt not to touch the words[] array does not buy us\nmuch safety anyway.  I didn't check (and that is why I am asking\nwith \"I am wondering...\").\n\nThanks, will queue.\n\n[Ram and Szeder CC'ed as they appear in shortlog for the past 12\nmonths].\n\n>  contrib/completion/git-completion.bash | 1 +\n>  contrib/completion/git-completion.zsh  | 1 +\n>  2 files changed, 2 insertions(+)\n>\n> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash\n> index 9525343..893ae5d 100644\n> --- a/contrib/completion/git-completion.bash\n> +++ b/contrib/completion/git-completion.bash\n> @@ -2547,6 +2547,7 @@ __git_main ()\n>  \n>  \tlocal expansion=$(__git_aliased_command \"$command\")\n>  \tif [ -n \"$expansion\" ]; then\n> +\t\twords[1]=$expansion\n>  \t\tcompletion_func=\"_git_${expansion//-/_}\"\n>  \t\tdeclare -f $completion_func >/dev/null && $completion_func\n>  \tfi\n> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh\n> index 6b77968..9f6f0fa 100644\n> --- a/contrib/completion/git-completion.zsh\n> +++ b/contrib/completion/git-completion.zsh\n> @@ -104,6 +104,7 @@ __git_zsh_bash_func ()\n>  \n>  \tlocal expansion=$(__git_aliased_command \"$command\")\n>  \tif [ -n \"$expansion\" ]; then\n> +\t\twords[1]=$expansion\n>  \t\tcompletion_func=\"_git_${expansion//-/_}\"\n>  \t\tdeclare -f $completion_func >/dev/null && $completion_func\n>  \tfi\n"},{"id":"238603","messageId":"5345af56dec8c_537810af310b9@nysa.notmuch","threadId":"36380","inReplyTo":"xmqqa9bu1enk.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH 5/5] completion: fix completion of certain aliases","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2014-04-09T20:36:38Z","receivedAt":"2014-04-09T20:36:38Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Junio C Hamano wrote:\n> Felipe Contreras <felipe.contreras@gmail.com> writes:\n> \n> > Some commands need the first word to determine the actual action that is\n> > being executed, however, the command is wrong when we use an alias, for\n> > example 'alias.p=push', if we try to complete 'git p origin ', the\n> > result would be wrong because __git_complete_remote_or_refspec() doesn't\n> > know where it come from.\n> >\n> > So let's override words[1], so the alias 'p' is override by the actual\n> > command, 'push'.\n> >\n> > Reported-by: Aymeric Beaumet <aymeric.beaumet@gmail.com>\n> > Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n> > ---\n> \n> Does \"some commands\" above refer to anything that uses\n> __git_complete_remote_or_refspec, or is the set of commands larger than that?\n\nFor this particular issue, yes, the former.\n\n> But perhaps we muck with the contents of words[] in a similar way in many\n> different places in the existing completion code often enough that such an\n> attempt not to touch the words[] array does not buy us much safety anyway.  I\n> didn't check (and that is why I am asking with \"I am wondering...\").\n\nThe 'words' array is already messed up and not used correctly, so I wouldn't\nworry too much about this patch messing it more (I don't see how that can be).\n\nFor example:\n  % git --git-dir=$PWD/.git fetch or<tab>\n\n-- \nFelipe Contreras\n"}]}