{"thread":{"id":"39352","subject":"[PATCH 2/2] work in progress","startedAt":"2015-05-18T13:30:45Z","lastAt":"2015-05-21T08:29:53Z","messageCount":6,"participants":["Paul Tan","Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"261429","messageId":"1431955855-16228-1-git-send-email-pyokagan@gmail.com","threadId":"39352","inReplyTo":null,"subject":"[PATCH 1/2] pull: handle git-fetch's options as well","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-18T13:30:45Z","receivedAt":"2015-05-18T13:30:45Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"t5520: failing test for pull --all with no configured upstream\nt5521: test pull --all --dry-run does not make any changes\n\nerror_on_no_merge_candidates() does not consider the case where \"$#\"\nincludes command-line flags that are passed to git-fetch.\n\nAs such, when the current branch has no configured upstream, and there\nare no merge candidates because of that, git-pull --all erroneously reports\nthat we are pulling from \"--all\", as it believes that the first argument\nis the remote name.\n\nAdd a failing test that shows this case.\n\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n git-pull.sh             | 34 ++++++++++++++++++++++++++++++++--\n t/t5520-pull.sh         | 20 ++++++++++++++++++++\n t/t5521-pull-options.sh | 14 ++++++++++++++\n 3 files changed, 66 insertions(+), 2 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 9ed01fd..28d49ab 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -163,11 +163,39 @@ do\n \t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n \t\tdry_run=--dry-run\n \t\t;;\n+\t--all|--no-all)\n+\t\tall=$1 ;;\n+\t-a|--append|--no-append)\n+\t\tappend=$1 ;;\n+\t--upload-pack=*|--no-upload-pack)\n+\t\tupload_pack=\"$1\" ;;\n+\t-f|--force|--no-force)\n+\t\tforce=\"$force $1\" ;;\n+\t-t|--tags|--no-tags)\n+\t\ttags=$1 ;;\n+\t-p|--prune|--no-prune)\n+\t\tprune=$1 ;;\n+\t-k|--keep|--no-keep)\n+\t\tkeep=$1 ;;\n+\t--depth=*|--no-depth)\n+\t\tdepth=\"$1\" ;;\n+\t--unshallow|--no-unshallow)\n+\t\tunshallow=$1 ;;\n+\t--update-shallow|--no-update-shallow)\n+\t\tupdate_shallow=$1 ;;\n+\t--refmap=*|--no-refmap)\n+\t\trefmap=\"$1\" ;;\n \t-h|--help-all)\n \t\tusage\n \t\t;;\n+\t--)\n+\t\tshift\n+\t\tbreak\n+\t\t;;\n+\t-*)\n+\t\tusage\n+\t\t;;\n \t*)\n-\t\t# Pass thru anything that may be meant for fetch.\n \t\tbreak\n \t\t;;\n \tesac\n@@ -254,7 +282,9 @@ test true = \"$rebase\" && {\n \toldremoteref=$(git merge-base --fork-point \"$remoteref\" $curr_branch 2>/dev/null)\n }\n orig_head=$(git rev-parse -q --verify HEAD)\n-git fetch $verbosity $progress $dry_run $recurse_submodules --update-head-ok \"$@\" || exit 1\n+git fetch $verbosity $progress $dry_run $recurse_submodules $all $append \\\n+$upload_pack $force $tags $prune $keep $depth $unshallow $update_shallow \\\n+$refmap --update-head-ok \"$@\" || exit 1\n test -z \"$dry_run\" || exit 0\n \n curr_head=$(git rev-parse -q --verify HEAD)\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 62dbfb5..ea73f2f 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -160,6 +160,18 @@ test_expect_success 'fail if no configuration for current branch' '\n \ttest \"$(cat file)\" = file\n '\n \n+test_expect_success 'pull --all: fail if no configuration for current branch' '\n+\tgit remote add test_remote . &&\n+\ttest_when_finished \"git remote remove test_remote\" &&\n+\tgit checkout -b test copy^ &&\n+\ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n+\ttest_config branch.test.remote test_remote &&\n+\ttest \"$(cat file)\" = file &&\n+\ttest_must_fail git pull --all 2>err &&\n+\ttest_i18ngrep \"There is no tracking information\" err &&\n+\ttest \"$(cat file)\" = file\n+'\n+\n test_expect_success 'fail if upstream branch does not exist' '\n \tgit checkout -b test copy^ &&\n \ttest_when_finished \"git checkout -f copy && git branch -D test\" &&\n@@ -366,6 +378,14 @@ test_expect_success '--rebase with rebased upstream' '\n \n '\n \n+test_expect_success '--rebase -f with rebased upstream' '\n+\ttest_when_finished \"test_might_fail git rebase --abort\" &&\n+\tgit reset --hard to-rebase-orig &&\n+\tgit pull --rebase -f me copy &&\n+\ttest \"conflicting modification\" = \"$(cat file)\" &&\n+\ttest file = \"$(cat file2)\"\n+'\n+\n test_expect_success '--rebase with rebased default upstream' '\n \n \tgit update-ref refs/remotes/me/copy copy-orig &&\ndiff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh\nindex 56e7377..9d5e41f 100755\n--- a/t/t5521-pull-options.sh\n+++ b/t/t5521-pull-options.sh\n@@ -130,4 +130,18 @@ test_expect_success 'git pull --dry-run' '\n \t)\n '\n \n+test_expect_failure 'git pull --all --dry-run' '\n+\ttest_when_finished \"rm -rf clonedmulti\" &&\n+\tgit init clonedry &&\n+\t(\n+\t\tcd clonedry &&\n+\t\tgit remote add origin ../parent &&\n+\t\tgit pull --all --dry-run &&\n+\t\ttest_path_is_missing .git/FETCH_HEAD &&\n+\t\ttest_path_is_missing .git/refs/remotes/origin/master &&\n+\t\ttest_path_is_missing .git/index &&\n+\t\ttest_path_is_missing file\n+\t)\n+'\n+\n test_done\n-- \n2.1.4\n"},{"id":"261428","messageId":"1431955855-16228-2-git-send-email-pyokagan@gmail.com","threadId":"39352","inReplyTo":"1431955855-16228-1-git-send-email-pyokagan@gmail.com","subject":"[PATCH 2/2] work in progress","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-18T13:30:46Z","receivedAt":"2015-05-18T13:30:46Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Signed-off-by: Paul Tan <pyokagan@gmail.com>\n---\n git-pull.sh | 102 +++++++++++++++++++++++++++++++++---------------------------\n 1 file changed, 57 insertions(+), 45 deletions(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 28d49ab..18f5210 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -4,13 +4,53 @@\n #\n # Fetch one or more remote refs and merge it/them into the current HEAD.\n \n-USAGE='[-n | --no-stat] [--[no-]commit] [--[no-]squash] [--[no-]ff|--ff-only] [--[no-]rebase|--rebase=preserve] [-s strategy]... [<fetch-options>] <repo> <head>...'\n-LONG_USAGE='Fetch one or more remote refs and integrate it/them with the current HEAD.'\n SUBDIRECTORY_OK=Yes\n-OPTIONS_SPEC=\n+OPTIONS_KEEPDASHDASH=Yes\n+OPTIONS_STUCKLONG=Yes\n+OPTIONS_SPEC=\"\\\n+git pull [options] [<repo> [<refspec>...]]\n+\n+Fetch one or more remote refs and integrate it/them with the current HEAD.\n+--\n+v,verbose                  be more verbose\n+q,quiet                    be more quiet\n+progress                   force progress reporting\n+\n+  Options related to merging\n+r,rebase?false|true|preserve incorporate changes by rebasing rather than merging\n+n!                         do not show a diffstat at the end of the merge\n+stat                       show a diffstat at the end of the merge\n+summary                    (synonym to --stat)\n+log?n                      add (at most <n>) entries from shortlog to merge commit message\n+squash                     create a single commit instead of doing a merge\n+commit                     perform a commit if the merge succeeds (default)\n+e,edit                       edit message before committing\n+ff                         allow fast-forward\n+ff-only!                   abort if fast-forward is not possible\n+verify-signatures          verify that the named commit has a valid GPG signature\n+s,strategy=strategy        merge strategy to use\n+X,strategy-option=option   option for selected merge strategy\n+S,gpg-sign?key-id          GPG sign commit\n+\n+  Options related to fetching\n+all                        fetch from all remotes\n+a,append                   append to .git/FETCH_HEAD instead of overwriting\n+upload-pack=path           path to upload pack on remote end\n+f,force                    force overwrite of local branch\n+t,tags                     fetch all tags and associated objects\n+p,prune                    prune remote-tracking branches no longer on remote\n+recurse-submodules?on-demand control recursive fetching of submodules\n+dry-run                    dry run\n+k,keep                     keep downloaded pack\n+depth=depth                deepen history of shallow clone\n+unshallow                  convert to a complete repository\n+update-shallow             accept refs that update .git/shallow\n+refmap=refmap              specify fetch refmap\n+\"\n+args=\"$*\"\n . git-sh-setup\n . git-sh-i18n\n-set_reflog_action \"pull${1+ $*}\"\n+set_reflog_action \"pull${args:+ $args}\"\n require_work_tree_exists\n cd_to_toplevel\n \n@@ -83,17 +123,15 @@ do\n \t\tdiffstat=--stat ;;\n \t--log|--no-log)\n \t\tlog_arg=$1 ;;\n-\t--no-c|--no-co|--no-com|--no-comm|--no-commi|--no-commit)\n-\t\tno_commit=--no-commit ;;\n-\t--c|--co|--com|--comm|--commi|--commit)\n-\t\tno_commit=--commit ;;\n+\t--commit|--no-commit)\n+\t\tno_commit=\"$1\" ;;\n \t-e|--edit)\n \t\tedit=--edit ;;\n \t--no-edit)\n \t\tedit=--no-edit ;;\n-\t--sq|--squ|--squa|--squas|--squash)\n+\t--squash)\n \t\tsquash=--squash ;;\n-\t--no-sq|--no-squ|--no-squa|--no-squas|--no-squash)\n+\t--no-squash)\n \t\tsquash=--no-squash ;;\n \t--ff)\n \t\tno_ff=--ff ;;\n@@ -101,39 +139,19 @@ do\n \t\tno_ff=--no-ff ;;\n \t--ff-only)\n \t\tff_only=--ff-only ;;\n-\t-s=*|--s=*|--st=*|--str=*|--stra=*|--strat=*|--strate=*|\\\n-\t\t--strateg=*|--strategy=*|\\\n-\t-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)\n-\t\tcase \"$#,$1\" in\n-\t\t*,*=*)\n-\t\t\tstrategy=$(expr \"z$1\" : 'z-[^=]*=\\(.*\\)') ;;\n-\t\t1,*)\n-\t\t\tusage ;;\n-\t\t*)\n-\t\t\tstrategy=\"$2\"\n-\t\t\tshift ;;\n-\t\tesac\n-\t\tstrategy_args=\"${strategy_args}-s $strategy \"\n+\t--strategy=*)\n+\t\tstrategy_args=\"$strategy_args $1\"\n \t\t;;\n-\t-X*)\n-\t\tcase \"$#,$1\" in\n-\t\t1,-X)\n-\t\t\tusage ;;\n-\t\t*,-X)\n-\t\t\txx=\"-X $(git rev-parse --sq-quote \"$2\")\"\n-\t\t\tshift ;;\n-\t\t*,*)\n-\t\t\txx=$(git rev-parse --sq-quote \"$1\") ;;\n-\t\tesac\n-\t\tmerge_args=\"$merge_args$xx \"\n+\t--strategy-option=*)\n+\t\tmerge_args=\"$merge_args $1\"\n \t\t;;\n-\t-r=*|--r=*|--re=*|--reb=*|--reba=*|--rebas=*|--rebase=*)\n+\t--rebase=*)\n \t\trebase=\"${1#*=}\"\n \t\t;;\n-\t-r|--r|--re|--reb|--reba|--rebas|--rebase)\n+\t-r|--rebase)\n \t\trebase=true\n \t\t;;\n-\t--no-r|--no-re|--no-reb|--no-reba|--no-rebas|--no-rebase)\n+\t--no-rebase)\n \t\trebase=false\n \t\t;;\n \t--recurse-submodules)\n@@ -157,10 +175,7 @@ do\n \t--gpg-sign=*)\n \t\tgpg_sign_args=$(git rev-parse --sq-quote \"-S${1#--gpg-sign=}\")\n \t\t;;\n-\t-S*)\n-\t\tgpg_sign_args=$(git rev-parse --sq-quote \"$1\")\n-\t\t;;\n-\t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n+\t--dry-run)\n \t\tdry_run=--dry-run\n \t\t;;\n \t--all|--no-all)\n@@ -192,11 +207,8 @@ do\n \t\tshift\n \t\tbreak\n \t\t;;\n-\t-*)\n-\t\tusage\n-\t\t;;\n \t*)\n-\t\tbreak\n+\t\tusage\n \t\t;;\n \tesac\n \tshift\n-- \n2.1.4\n"},{"id":"261446","messageId":"CACRoPnRQiDxzOy_cGm42ugHkWdKm=rzvzo2vr_5eVy0Q5T2CHQ@mail.gmail.com","threadId":"39352","inReplyTo":"1431955855-16228-1-git-send-email-pyokagan@gmail.com","subject":"Re: [PATCH 1/2] pull: handle git-fetch's options as well","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-18T14:05:45Z","receivedAt":"2015-05-18T14:05:45Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Hi all,\n\nUgh. It seems I mistakenly sent an older version by mistake (and\ndidn't even realize). Please disregard. :-/\n\nPlease see [1] instead.\n\nSorry for the trouble.\n\n[1] http://thread.gmane.org/gmane.comp.version-control.git/269249\n\nThanks,\nPaul\n"},{"id":"261447","messageId":"1a102d8dabff79207c0d7e3bf434bd6f@www.dscho.org","threadId":"39352","inReplyTo":"1431955855-16228-1-git-send-email-pyokagan@gmail.com","subject":"Re: [PATCH 1/2] pull: handle git-fetch's options as well","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-05-18T14:37:17Z","receivedAt":"2015-05-18T14:37:17Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Paul,\n\nOn 2015-05-18 15:30, Paul Tan wrote:\n> t5520: failing test for pull --all with no configured upstream\n> t5521: test pull --all --dry-run does not make any changes\n> \n> error_on_no_merge_candidates() does not consider the case where \"$#\"\n> includes command-line flags that are passed to git-fetch.\n> \n> As such, when the current branch has no configured upstream, and there\n> are no merge candidates because of that, git-pull --all erroneously reports\n> that we are pulling from \"--all\", as it believes that the first argument\n> is the remote name.\n> \n> Add a failing test that shows this case.\n> \n> Signed-off-by: Paul Tan <pyokagan@gmail.com>\n> ---\n>  git-pull.sh             | 34 ++++++++++++++++++++++++++++++++--\n>  t/t5520-pull.sh         | 20 ++++++++++++++++++++\n>  t/t5521-pull-options.sh | 14 ++++++++++++++\n>  3 files changed, 66 insertions(+), 2 deletions(-)\n> \n> diff --git a/git-pull.sh b/git-pull.sh\n> index 9ed01fd..28d49ab 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -163,11 +163,39 @@ do\n>  \t--d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n>  \t\tdry_run=--dry-run\n>  \t\t;;\n> +\t--all|--no-all)\n> +\t\tall=$1 ;;\n\nI *think* you also want to add a corresponding \"all=\" line just below the \"dry_run=\" line, to ensure that \"all=blablabla git pull\" does not interfere with this command-line setting.\n\nThe patch looks fine to me, otherwise.\n\nCiao,\nDscho\n"},{"id":"261762","messageId":"CACRoPnQ31xQ6n--EkraCXw3i-rTR5wMLyMP7+xi=d6w4eG2Y0g@mail.gmail.com","threadId":"39352","inReplyTo":"1a102d8dabff79207c0d7e3bf434bd6f@www.dscho.org","subject":"Re: [PATCH 1/2] pull: handle git-fetch's options as well","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-21T08:29:08Z","receivedAt":"2015-05-21T08:29:08Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Hi,\n\nOn Mon, May 18, 2015 at 10:37 PM, Johannes Schindelin\n<johannes.schindelin@gmx.de> wrote:\n> On 2015-05-18 15:30, Paul Tan wrote:\n>> t5520: failing test for pull --all with no configured upstream\n>> t5521: test pull --all --dry-run does not make any changes\n>>\n>> error_on_no_merge_candidates() does not consider the case where \"$#\"\n>> includes command-line flags that are passed to git-fetch.\n>>\n>> As such, when the current branch has no configured upstream, and there\n>> are no merge candidates because of that, git-pull --all erroneously reports\n>> that we are pulling from \"--all\", as it believes that the first argument\n>> is the remote name.\n>>\n>> Add a failing test that shows this case.\n>>\n>> Signed-off-by: Paul Tan <pyokagan@gmail.com>\n>> ---\n>>  git-pull.sh             | 34 ++++++++++++++++++++++++++++++++--\n>>  t/t5520-pull.sh         | 20 ++++++++++++++++++++\n>>  t/t5521-pull-options.sh | 14 ++++++++++++++\n>>  3 files changed, 66 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/git-pull.sh b/git-pull.sh\n>> index 9ed01fd..28d49ab 100755\n>> --- a/git-pull.sh\n>> +++ b/git-pull.sh\n>> @@ -163,11 +163,39 @@ do\n>>       --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n>>               dry_run=--dry-run\n>>               ;;\n>> +     --all|--no-all)\n>> +             all=$1 ;;\n>\n> I *think* you also want to add a corresponding \"all=\" line just below the \"dry_run=\" line, to ensure that \"all=blablabla git pull\" does not interfere with this command-line setting.\n\nFixed, thanks.\n\nRegards,\nPaul\n"},{"id":"261763","messageId":"CACRoPnQTTj-ve-gJ2-prTtgB8jzYk_dLTeQRYVKZoC4wXYOx2w@mail.gmail.com","threadId":"39352","inReplyTo":"1a102d8dabff79207c0d7e3bf434bd6f@www.dscho.org","subject":"Re: [PATCH 1/2] pull: handle git-fetch's options as well","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-05-21T08:29:53Z","receivedAt":"2015-05-21T08:29:53Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Hi,\n\nOn Mon, May 18, 2015 at 10:37 PM, Johannes Schindelin\n<johannes.schindelin@gmx.de> wrote:\n> On 2015-05-18 15:30, Paul Tan wrote:\n>> t5520: failing test for pull --all with no configured upstream\n>> t5521: test pull --all --dry-run does not make any changes\n>>\n>> error_on_no_merge_candidates() does not consider the case where \"$#\"\n>> includes command-line flags that are passed to git-fetch.\n>>\n>> As such, when the current branch has no configured upstream, and there\n>> are no merge candidates because of that, git-pull --all erroneously reports\n>> that we are pulling from \"--all\", as it believes that the first argument\n>> is the remote name.\n>>\n>> Add a failing test that shows this case.\n>>\n>> Signed-off-by: Paul Tan <pyokagan@gmail.com>\n>> ---\n>>  git-pull.sh             | 34 ++++++++++++++++++++++++++++++++--\n>>  t/t5520-pull.sh         | 20 ++++++++++++++++++++\n>>  t/t5521-pull-options.sh | 14 ++++++++++++++\n>>  3 files changed, 66 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/git-pull.sh b/git-pull.sh\n>> index 9ed01fd..28d49ab 100755\n>> --- a/git-pull.sh\n>> +++ b/git-pull.sh\n>> @@ -163,11 +163,39 @@ do\n>>       --d|--dr|--dry|--dry-|--dry-r|--dry-ru|--dry-run)\n>>               dry_run=--dry-run\n>>               ;;\n>> +     --all|--no-all)\n>> +             all=$1 ;;\n>\n> I *think* you also want to add a corresponding \"all=\" line just below the \"dry_run=\" line, to ensure that \"all=blablabla git pull\" does not interfere with this command-line setting.\n\nFixed, thanks.\n\nRegards,\nPaul\n"}]}