{"thread":{"id":"39506","subject":"[PATCH] pull: allow dirty tree when rebase.autostash enabled","startedAt":"2015-06-02T21:55:57Z","lastAt":"2015-07-22T20:48:52Z","messageCount":16,"participants":["Kevin Daudt","Paul Tan","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"262793","messageId":"1433282157-8171-1-git-send-email-me@ikke.info","threadId":"39506","inReplyTo":null,"subject":"[PATCH] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-06-02T21:55:57Z","receivedAt":"2015-06-02T21:55:57Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"rebase learned to stash changes when it encounters a dirty work tree, but\ngit pull --rebase does not.\n\nOnly verify if the working tree is dirty when rebase.autostash is not\nenabled.\n---\n git-pull.sh     |  5 ++++-\n t/t5520-pull.sh | 17 +++++++++++++++++\n 2 files changed, 21 insertions(+), 1 deletion(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 0917d0d..6b9e8a3 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n \t\tfi\n \telse\n-\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tif [ $(git config --bool --get rebase.autostash || echo false) = \"false\" ]\n+\t\tthen\n+\t\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tfi\n \tfi\n \toldremoteref= &&\n \ttest -n \"$curr_branch\" &&\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7efd45b..d849a19 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -297,6 +297,23 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \n '\n \n+test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n+\n+\ttest_when_finished \"git rm -f file4\" && \n+\tgit checkout to-rebase &&\n+\tgit update-ref refs/remotes/me/copy copy^ &&\n+\tCOPY=$(git rev-parse --verify me/copy) &&\n+\tgit rebase --onto $COPY copy &&\n+\ttest_config branch.to-rebase.remote me &&\n+\ttest_config branch.to-rebase.merge refs/heads/copy &&\n+\ttest_config branch.to-rebase.rebase true &&\n+\ttest_config rebase.autostash true &&\n+\techo dirty >> file4 &&\n+\tgit add file4 &&\n+\tgit pull\n+\n+'\n+\n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-- \n2.4.2\n"},{"id":"262807","messageId":"CACRoPnQ=5sdWpnebv0OKPHPBh4iyMZ1H47cix6KFh7i5fYomNA@mail.gmail.com","threadId":"39506","inReplyTo":"1433282157-8171-1-git-send-email-me@ikke.info","subject":"Re: [PATCH] pull: allow dirty tree when rebase.autostash enabled","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-06-03T04:50:03Z","receivedAt":"2015-06-03T04:50:03Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"Hi,\n\nSome comments which may not necessarily be correct.\n\nOn Wed, Jun 3, 2015 at 5:55 AM, Kevin Daudt <me@ikke.info> wrote:\n> rebase learned to stash changes when it encounters a dirty work tree, but\n> git pull --rebase does not.\n>\n> Only verify if the working tree is dirty when rebase.autostash is not\n> enabled.\n> ---\n\nMissing sign-off.\n\n>  git-pull.sh     |  5 ++++-\n>  t/t5520-pull.sh | 17 +++++++++++++++++\n>  2 files changed, 21 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 0917d0d..6b9e8a3 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n>                         die \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n>                 fi\n>         else\n> -               require_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +               if [ $(git config --bool --get rebase.autostash || echo false) = \"false\" ]\n\n\"false\" doesn't need to be quoted.\n\n> +               then\n> +                       require_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +               fi\n>         fi\n>         oldremoteref= &&\n>         test -n \"$curr_branch\" &&\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index 7efd45b..d849a19 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -297,6 +297,23 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n>\n>  '\n>\n> +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> +\n\nI know the surrounding old tests use a newline, but I think that all\nnew tests should use the modern style of not having a newline, since\nt5520 already consists of a mix of old and modern styles anyway.\n\n> +       test_when_finished \"git rm -f file4\" &&\n\nThere is trailing whitespace here.\n\nFurthermore, git rm -f will fail if \"file4\" does not exist in the\nindex. Perhaps it should be moved below the \"git add\" below.\n\n> +       git checkout to-rebase &&\n> +       git update-ref refs/remotes/me/copy copy^ &&\n> +       COPY=$(git rev-parse --verify me/copy) &&\n\n$COPY is not used anywhere in the test.\n\n> +       git rebase --onto $COPY copy &&\n> +       test_config branch.to-rebase.remote me &&\n> +       test_config branch.to-rebase.merge refs/heads/copy &&\n> +       test_config branch.to-rebase.rebase true &&\n> +       test_config rebase.autostash true &&\n> +       echo dirty >> file4 &&\n\nfile4 does not exist, so we don't need to append to it. I know the\nabove few tests do not adhere to it, but CodingGuidelines says that\nredirection operators do not have a space after\n\n> +       git add file4 &&\n> +       git pull\n\nI think we should check for file contents to ensure that\ngit-pull/git-stash/git-rebase is doing its job properly.\n\n> +\n\nSame as above, no need the newline.\n\n> +'\n> +\n\nWith all that said, I wonder if this test, and the test above (\"pull\n--rebase dies early with dirty working directory\") could be vastly\nsimplified, since we are not testing if we can handle a rebased\nupstream.\n\nE.g., my simplified version for the above test would be something like:\n\n    git checkout -f to-rebase &&\n    git rebase --onto copy^ copy &&\n    test_config rebase.autostash true &&\n    echo dirty >file4 &&\n    git add file4 &&\n    test_when_finished \"git rm -f file4\" &&\n    git pull --rebase . me/copy &&\n    test \"$(cat file4)\" = dirty &&\n    test \"$(cat file2)\" = file\n\nIt's still confusing though, because we cannot take advantage of the\n'before-rebase' tag introduced in the above tests. I would much prefer\nif this test and the (\"pull --rebase dies with dirty working\ndirectory\") test could be moved to the --rebase tests at lines 214+.\nAlso, this section in the t5520 test suite always gives me a headache\ntrying to decipher what it is trying to do ><\n\nThanks,\nPaul\n"},{"id":"263133","messageId":"1433625145-29668-1-git-send-email-me@ikke.info","threadId":"39506","inReplyTo":"1433282157-8171-1-git-send-email-me@ikke.info","subject":"[PATCH v2 1/2] t5520-pull: Simplify --rebase with dirty tree test","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-06-06T21:12:24Z","receivedAt":"2015-06-06T21:12:24Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"Simplify the test case for testing git aborts the pull --rebase when the\nwork tree is dirty.\n\nSigned-off-by: Kevin Daudt <me@ikke.info>\nHelped-by: Paul Tan <pyokagan@gmail.com>\n---\nThis is a preparation for the next pathch.\n\nChanges since v1:\n- Moved the tests just belof the first --rebase test\n- Simplified both tests to only test if the rebase either succeded for\n  failed\n\n\n t/t5520-pull.sh | 32 +++++++++++++-------------------\n 1 file changed, 13 insertions(+), 19 deletions(-)\n\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 7efd45b..925ad49 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -122,6 +122,19 @@ test_expect_success '--rebase' '\n \ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n \ttest new = $(git show HEAD:file2)\n '\n+\n+test_expect_success 'pull --rebase dies early with dirty working directory' '\n+\tgit reset --hard before-rebase &&\n+\tbefore=$(git rev-parse --verify before-rebase) &&\n+\ttest_config branch.to-rebase.rebase true &&\n+\techo dirty >>file &&\n+\tcp file expect &&\n+\tgit add file &&\n+\ttest_must_fail git pull . copy &&\n+\ttest $(git rev-parse --verify to-rebase) = $before &&\n+\ttest_cmp file expect\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n@@ -278,25 +291,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n \n '\n \n-test_expect_success 'pull --rebase dies early with dirty working directory' '\n-\n-\tgit checkout to-rebase &&\n-\tgit update-ref refs/remotes/me/copy copy^ &&\n-\tCOPY=$(git rev-parse --verify me/copy) &&\n-\tgit rebase --onto $COPY copy &&\n-\ttest_config branch.to-rebase.remote me &&\n-\ttest_config branch.to-rebase.merge refs/heads/copy &&\n-\ttest_config branch.to-rebase.rebase true &&\n-\techo dirty >> file &&\n-\tgit add file &&\n-\ttest_must_fail git pull &&\n-\ttest $COPY = $(git rev-parse --verify me/copy) &&\n-\tgit checkout HEAD -- file &&\n-\tgit pull &&\n-\ttest $COPY != $(git rev-parse --verify me/copy)\n-\n-'\n-\n test_expect_success 'pull --rebase works on branch yet to be born' '\n \tgit rev-parse master >expect &&\n \tmkdir empty_repo &&\n-- \n2.4.2\n"},{"id":"263134","messageId":"1433625145-29668-2-git-send-email-me@ikke.info","threadId":"39506","inReplyTo":"1433625145-29668-1-git-send-email-me@ikke.info","subject":"[PATCH v2 2/2] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-06-06T21:12:25Z","receivedAt":"2015-06-06T21:12:25Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"From: Kevin Daudt <compufreak@gmail.com>\n\nrebase learned to stash changes when it encounters a dirty work tree, but\ngit pull --rebase does not.\n\nOnly verify if the working tree is dirty when rebase.autostash is not\nenabled.\n\nSigned-off-by: Kevin Daudt <me@ikke.info>\nHelped-by: Paul Tan <pyokagan@gmail.com>\n---\n git-pull.sh     |  5 ++++-\n t/t5520-pull.sh | 12 ++++++++++++\n 2 files changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 0917d0d..f0a3b6e 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n \t\tfi\n \telse\n-\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tif [ $(git config --bool --get rebase.autostash || echo false) = false ]\n+\t\tthen\n+\t\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tfi\n \tfi\n \toldremoteref= &&\n \ttest -n \"$curr_branch\" &&\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex 925ad49..d06119f 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -135,6 +135,18 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n \ttest_cmp file expect\n '\n \n+test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n+\ttest_config branch.to-rebase.rebase true &&\n+\ttest_config rebase.autostash true &&\n+\tgit checkout HEAD -- file &&\n+\techo dirty > new_file &&\n+\tgit add new_file &&\n+\tgit pull . copy &&\n+\ttest $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n+\ttest $(cat new_file) = dirty &&\n+\ttest \"$(cat file)\" = \"modified again\"\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n-- \n2.4.2\n"},{"id":"263581","messageId":"CACRoPnSnxT2_joEcgiimbiuo53sA_JobNGHj+ZJ_1+mjkaG8HQ@mail.gmail.com","threadId":"39506","inReplyTo":"1433625145-29668-1-git-send-email-me@ikke.info","subject":"Re: [PATCH v2 1/2] t5520-pull: Simplify --rebase with dirty tree test","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-06-11T13:20:04Z","receivedAt":"2015-06-11T13:20:04Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"On Sun, Jun 7, 2015 at 5:12 AM, Kevin Daudt <me@ikke.info> wrote:\n> @@ -278,25 +291,6 @@ test_expect_success 'rebased upstream + fetch + pull --rebase' '\n>\n>  '\n>\n> -test_expect_success 'pull --rebase dies early with dirty working directory' '\n> -\n> -       git checkout to-rebase &&\n> -       git update-ref refs/remotes/me/copy copy^ &&\n> -       COPY=$(git rev-parse --verify me/copy) &&\n> -       git rebase --onto $COPY copy &&\n> -       test_config branch.to-rebase.remote me &&\n> -       test_config branch.to-rebase.merge refs/heads/copy &&\n> -       test_config branch.to-rebase.rebase true &&\n> -       echo dirty >> file &&\n> -       git add file &&\n> -       test_must_fail git pull &&\n> -       test $COPY = $(git rev-parse --verify me/copy) &&\n> -       git checkout HEAD -- file &&\n> -       git pull &&\n> -       test $COPY != $(git rev-parse --verify me/copy)\n> -\n> -'\n\nEh whoops, I don't think we should touch this test. It comes from\nf9189cf, which states that:\n\n    When rebasing fails during \"pull --rebase\", you cannot just clean up\n    the working directory and call \"pull --rebase\" again, since the\n    remote branch was already fetched.\n\nWhich makes me believe that \"die-ing early with dirty working\ndirectory\" has something to do with the rebased upstream handling\nfeature of git-pull, and so this test is correct in testing that, and\nthus we should not touch it.\n\nThe location of the test in the other patch is fine though.\n\nThanks,\nPaul\n"},{"id":"263582","messageId":"CACRoPnQ0+h2g2cUJk+8zSkcHjoHjezAGC=5pTjn8aFsgB0GrQA@mail.gmail.com","threadId":"39506","inReplyTo":"1433625145-29668-2-git-send-email-me@ikke.info","subject":"Re: [PATCH v2 2/2] pull: allow dirty tree when rebase.autostash enabled","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-06-11T13:34:08Z","receivedAt":"2015-06-11T13:34:08Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"On Sun, Jun 7, 2015 at 5:12 AM, Kevin Daudt <me@ikke.info> wrote:\n> From: Kevin Daudt <compufreak@gmail.com>\n>\n> rebase learned to stash changes when it encounters a dirty work tree, but\n> git pull --rebase does not.\n>\n> Only verify if the working tree is dirty when rebase.autostash is not\n> enabled.\n>\n> Signed-off-by: Kevin Daudt <me@ikke.info>\n\nEhh? The sign-off does not match the author of the patch.\n\n> Helped-by: Paul Tan <pyokagan@gmail.com>\n> ---\n>  git-pull.sh     |  5 ++++-\n>  t/t5520-pull.sh | 12 ++++++++++++\n>  2 files changed, 16 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 0917d0d..f0a3b6e 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n>                         die \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n>                 fi\n>         else\n> -               require_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +               if [ $(git config --bool --get rebase.autostash || echo false) = false ]\n> +               then\n> +                       require_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +               fi\n>         fi\n>         oldremoteref= &&\n>         test -n \"$curr_branch\" &&\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index 925ad49..d06119f 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -135,6 +135,18 @@ test_expect_success 'pull --rebase dies early with dirty working directory' '\n>         test_cmp file expect\n>  '\n>\n> +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> +       test_config branch.to-rebase.rebase true &&\n\nOk, though I wonder why not just a git pull --rebase...\n\n> +       test_config rebase.autostash true &&\n> +       git checkout HEAD -- file &&\n\nWhy not git reset --hard before-rebase? If we don't reset HEAD, then\nhow would we know if we actually did a rebase?\n\n> +       echo dirty > new_file &&\n\nstyle: echo dirty >new_file &&\n\n> +       git add new_file &&\n> +       git pull . copy &&\n> +       test $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n\nOkay, although it would be better to use \"test_cmp_rev HEAD^ copy\"\nbecause it prints out the hashes if they are different.\n\n> +       test $(cat new_file) = dirty &&\n\n\"$(cat new_file)\" should be quoted to prevent field splitting.\n\n> +       test \"$(cat file)\" = \"modified again\"\n> +'\n> +\n>  test_expect_success 'pull.rebase' '\n>         git reset --hard before-rebase &&\n>         test_config pull.rebase true &&\n> --\n> 2.4.2\n\nThanks,\nPaul\n"},{"id":"264002","messageId":"20150617104003.GA7345@vps892.directvps.nl","threadId":"39506","inReplyTo":"CACRoPnQ0+h2g2cUJk+8zSkcHjoHjezAGC=5pTjn8aFsgB0GrQA@mail.gmail.com","subject":"Re: [PATCH v2 2/2] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-06-17T10:40:03Z","receivedAt":"2015-06-17T10:40:03Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Thu, Jun 11, 2015 at 09:34:08PM +0800, Paul Tan wrote:\n> On Sun, Jun 7, 2015 at 5:12 AM, Kevin Daudt <me@ikke.info> wrote:\n> > From: Kevin Daudt <compufreak@gmail.com>\n> >\n> > Signed-off-by: Kevin Daudt <me@ikke.info>\n> \n> Ehh? The sign-off does not match the author of the patch.\n\nI changed it, but aparently forgot to reset the author for that commit\n\n> \n> >  '\n> >\n> > +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> > +       test_config branch.to-rebase.rebase true &&\n> \n> Ok, though I wonder why not just a git pull --rebase...\n\nCopied that from another test, but was doubting whether to use it or\nnot.\n\n> \n> > +       test_config rebase.autostash true &&\n> > +       git checkout HEAD -- file &&\n> \n> Why not git reset --hard before-rebase? If we don't reset HEAD, then\n> how would we know if we actually did a rebase?\n> \n\nGood tip, thanks.\n\n> > +       echo dirty > new_file &&\n> \n> style: echo dirty >new_file &&\n> \n\nFixed\n\n> > +       git add new_file &&\n> > +       git pull . copy &&\n> > +       test $(git rev-parse HEAD^) = $(git rev-parse copy) &&\n> \n> Okay, although it would be better to use \"test_cmp_rev HEAD^ copy\"\n> because it prints out the hashes if they are different.\n> \n\nDidn't know about that, and aparently, also not documented. Thanks.\n\n> > +       test $(cat new_file) = dirty &&\n> \n> \"$(cat new_file)\" should be quoted to prevent field splitting.\n> \n\nFixed\n\nNew patch is coming.\n"},{"id":"264004","messageId":"1434538880-15608-1-git-send-email-me@ikke.info","threadId":"39506","inReplyTo":"1433625145-29668-2-git-send-email-me@ikke.info","subject":"[PATCH v3] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-06-17T11:01:20Z","receivedAt":"2015-06-17T11:01:20Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"rebase learned to stash changes when it encounters a dirty work tree, but\ngit pull --rebase does not.\n\nOnly verify if the working tree is dirty when rebase.autostash is not\nenabled.\n\nSigned-off-by: Kevin Daudt <me@ikke.info>\nHelped-by: Paul Tan <pyokagan@gmail.com>\n---\nChanges to v2:\n - Dropped the change of the existing --rebase test\n - Improvements to the test.\n\nVerified that the test fails before the change, and succeeds after the change.\n\n git-pull.sh     |  5 ++++-\n t/t5520-pull.sh | 11 +++++++++++\n 2 files changed, 15 insertions(+), 1 deletion(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex 0917d0d..f0a3b6e 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n \t\tfi\n \telse\n-\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tif [ $(git config --bool --get rebase.autostash || echo false) = false ]\n+\t\tthen\n+\t\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n+\t\tfi\n \tfi\n \toldremoteref= &&\n \ttest -n \"$curr_branch\" &&\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex af31f04..aa247ec 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -233,6 +233,17 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest modified = \"$(git show HEAD:file)\"\n '\n \n+test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n+\ttest_config rebase.autostash true &&\n+\tgit reset --hard before-rebase &&\n+\techo dirty >new_file &&\n+\tgit add new_file &&\n+\tgit pull --rebase . copy &&\n+\ttest_cmp_rev HEAD^ copy &&\n+\ttest \"$(cat new_file)\" = dirty &&\n+\ttest \"$(cat file)\" = \"modified again\"\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n-- \n2.4.3\n"},{"id":"264032","messageId":"xmqqh9q64a9p.fsf@gitster.dls.corp.google.com","threadId":"39506","inReplyTo":"1434538880-15608-1-git-send-email-me@ikke.info","subject":"Re: [PATCH v3] pull: allow dirty tree when rebase.autostash enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-06-17T15:36:34Z","receivedAt":"2015-06-17T15:36:34Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Daudt <me@ikke.info> writes:\n\n> rebase learned to stash changes when it encounters a dirty work tree, but\n> git pull --rebase does not.\n>\n> Only verify if the working tree is dirty when rebase.autostash is not\n> enabled.\n>\n> Signed-off-by: Kevin Daudt <me@ikke.info>\n> Helped-by: Paul Tan <pyokagan@gmail.com>\n> ---\n> Changes to v2:\n>  - Dropped the change of the existing --rebase test\n>  - Improvements to the test.\n>\n> Verified that the test fails before the change, and succeeds after the change.\n>\n>  git-pull.sh     |  5 ++++-\n>  t/t5520-pull.sh | 11 +++++++++++\n>  2 files changed, 15 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-pull.sh b/git-pull.sh\n> index 0917d0d..f0a3b6e 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -239,7 +239,10 @@ test true = \"$rebase\" && {\n>  \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n>  \t\tfi\n>  \telse\n> -\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +\t\tif [ $(git config --bool --get rebase.autostash || echo false) = false ]\n\nStyle (use of []).\n\nShouldn't you be doing\n\n\tif ...\n\tthen        \t\n\t\ton an unborn\n\telif we are not doing autostash\n\t\trequire clean work tree\n\tfi\n\nwhich does not need unnecessarily deep nesting?\n\n> +\t\tthen\n> +\t\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> +\t\tfi\n>  \tfi\n>  \toldremoteref= &&\n>  \ttest -n \"$curr_branch\" &&\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index af31f04..aa247ec 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -233,6 +233,17 @@ test_expect_success '--rebase fails with multiple branches' '\n>  \ttest modified = \"$(git show HEAD:file)\"\n>  '\n>  \n> +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> +\ttest_config rebase.autostash true &&\n> +\tgit reset --hard before-rebase &&\n> +\techo dirty >new_file &&\n> +\tgit add new_file &&\n> +\tgit pull --rebase . copy &&\n> +\ttest_cmp_rev HEAD^ copy &&\n> +\ttest \"$(cat new_file)\" = dirty &&\n> +\ttest \"$(cat file)\" = \"modified again\"\n> +'\n> +\n>  test_expect_success 'pull.rebase' '\n>  \tgit reset --hard before-rebase &&\n>  \ttest_config pull.rebase true &&\n"},{"id":"265519","messageId":"20150704210032.GB7345@vps892.directvps.nl","threadId":"39506","inReplyTo":"xmqqh9q64a9p.fsf@gitster.dls.corp.google.com","subject":"kd/","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-07-04T21:00:32Z","receivedAt":"2015-07-04T21:00:32Z","isPatch":false,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Wed, Jun 17, 2015 at 08:36:34AM -0700, Junio C Hamano wrote:\n> Kevin Daudt <me@ikke.info> writes:\n> \n> > -\t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n> > +\t\tif [ $(git config --bool --get rebase.autostash || echo false) = false ]\n> \n> Style (use of []).\n\nFixed it.\n\n> \n> Shouldn't you be doing\n> \n> \tif ...\n> \tthen        \t\n> \t\ton an unborn\n> \telif we are not doing autostash\n> \t\trequire clean work tree\n> \tfi\n> \n> which does not need unnecessarily deep nesting?\n> \n\nYou are right, much simpler. New patch is underway.\n"},{"id":"265521","messageId":"1436046158-19426-1-git-send-email-me@ikke.info","threadId":"39506","inReplyTo":"1434538880-15608-1-git-send-email-me@ikke.info","subject":"[PATCH v4] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-07-04T21:42:38Z","receivedAt":"2015-07-04T21:42:38Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"rebase learned to stash changes when it encounters a dirty work tree, but\ngit pull --rebase does not.\n\nOnly verify if the working tree is dirty when rebase.autostash is not\nenabled.\n\nSigned-off-by: Kevin Daudt <me@ikke.info>\nHelped-by: Paul Tan <pyokagan@gmail.com>\n---\n git-pull.sh     |  3 ++-\n t/t5520-pull.sh | 11 +++++++++++\n 2 files changed, 13 insertions(+), 1 deletion(-)\n\ndiff --git a/git-pull.sh b/git-pull.sh\nindex a814bf6..ff28d3f 100755\n--- a/git-pull.sh\n+++ b/git-pull.sh\n@@ -284,7 +284,8 @@ test true = \"$rebase\" && {\n \t\tthen\n \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n \t\tfi\n-\telse\n+\telif test $(git config --bool --get rebase.autostash || echo false) = false\n+\tthen\n \t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n \tfi\n \toldremoteref= &&\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex f4a7193..a0013ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -245,6 +245,17 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest modified = \"$(git show HEAD:file)\"\n '\n \n+test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n+\ttest_config rebase.autostash true &&\n+\tgit reset --hard before-rebase &&\n+\techo dirty >new_file &&\n+\tgit add new_file &&\n+\tgit pull --rebase . copy &&\n+\ttest_cmp_rev HEAD^ copy &&\n+\ttest \"$(cat new_file)\" = dirty &&\n+\ttest \"$(cat file)\" = \"modified again\"\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n-- \n2.4.5\n"},{"id":"265624","messageId":"xmqqd205yq98.fsf@gitster.dls.corp.google.com","threadId":"39506","inReplyTo":"1436046158-19426-1-git-send-email-me@ikke.info","subject":"Re: [PATCH v4] pull: allow dirty tree when rebase.autostash enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-06T20:39:47Z","receivedAt":"2015-07-06T20:39:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Daudt <me@ikke.info> writes:\n\n> rebase learned to stash changes when it encounters a dirty work tree, but\n> git pull --rebase does not.\n>\n> Only verify if the working tree is dirty when rebase.autostash is not\n> enabled.\n>\n> Signed-off-by: Kevin Daudt <me@ikke.info>\n> Helped-by: Paul Tan <pyokagan@gmail.com>\n> ---\n\nI applied it, tried to run today's integration cycle, and then ended\nup ejecting it from my tree for now, as this seemed to break 5520\nwhen merged to 'pu' X-<.\n\nWell, that is partly expected, as Paul's builtin/pull.c does not\nknow about it (yet).\n\n>  git-pull.sh     |  3 ++-\n>  t/t5520-pull.sh | 11 +++++++++++\n>  2 files changed, 13 insertions(+), 1 deletion(-)\n>\n> diff --git a/git-pull.sh b/git-pull.sh\n> index a814bf6..ff28d3f 100755\n> --- a/git-pull.sh\n> +++ b/git-pull.sh\n> @@ -284,7 +284,8 @@ test true = \"$rebase\" && {\n>  \t\tthen\n>  \t\t\tdie \"$(gettext \"updating an unborn branch with changes added to the index\")\"\n>  \t\tfi\n> -\telse\n> +\telif test $(git config --bool --get rebase.autostash || echo false) = false\n> +\tthen\n>  \t\trequire_clean_work_tree \"pull with rebase\" \"Please commit or stash them.\"\n>  \tfi\n>  \toldremoteref= &&\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index f4a7193..a0013ee 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -245,6 +245,17 @@ test_expect_success '--rebase fails with multiple branches' '\n>  \ttest modified = \"$(git show HEAD:file)\"\n>  '\n>  \n> +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> +\ttest_config rebase.autostash true &&\n> +\tgit reset --hard before-rebase &&\n> +\techo dirty >new_file &&\n> +\tgit add new_file &&\n> +\tgit pull --rebase . copy &&\n> +\ttest_cmp_rev HEAD^ copy &&\n> +\ttest \"$(cat new_file)\" = dirty &&\n> +\ttest \"$(cat file)\" = \"modified again\"\n> +'\n> +\n>  test_expect_success 'pull.rebase' '\n>  \tgit reset --hard before-rebase &&\n>  \ttest_config pull.rebase true &&\n"},{"id":"265642","messageId":"20150707035956.GA6105@yoshi.chippynet.com","threadId":"39506","inReplyTo":"xmqqd205yq98.fsf@gitster.dls.corp.google.com","subject":"[PATCH v5] pull: allow dirty tree when rebase.autostash enabled","fromName":"Paul Tan","fromEmail":"pyokagan@gmail.com","sentAt":"2015-07-07T03:59:56Z","receivedAt":"2015-07-07T03:59:56Z","isPatch":true,"sender":{"key":"pyokagan@gmail.com","avatar":"https://avatars.githubusercontent.com/u/109479?v=4"},"body":"On Mon, Jul 06, 2015 at 01:39:47PM -0700, Junio C Hamano wrote:\n> Kevin Daudt <me@ikke.info> writes:\n> \n> > rebase learned to stash changes when it encounters a dirty work tree, but\n> > git pull --rebase does not.\n> >\n> > Only verify if the working tree is dirty when rebase.autostash is not\n> > enabled.\n> >\n> > Signed-off-by: Kevin Daudt <me@ikke.info>\n> > Helped-by: Paul Tan <pyokagan@gmail.com>\n> > ---\n> \n> I applied it, tried to run today's integration cycle, and then ended\n> up ejecting it from my tree for now, as this seemed to break 5520\n> when merged to 'pu' X-<.\n> \n> Well, that is partly expected, as Paul's builtin/pull.c does not\n> know about it (yet).\n\nYeah, sorry about that.\n\nHere's a modified patch for the C code.\n\nRegards,\nPaul\n\n--- >8 ---\nFrom: Kevin Daudt <me@ikke.info>\nDate: Sat, 4 Jul 2015 23:42:38 +0200\n\nrebase learned to stash changes when it encounters a dirty work tree,\nbut git pull --rebase does not.\n\nOnly verify if the working tree is dirty when rebase.autostash is not\nenabled.\n\nSigned-off-by: Kevin Daudt <me@ikke.info>\nSigned-off-by: Paul Tan <pyokagan@gmail.com>\n---\n builtin/pull.c  |  6 +++++-\n t/t5520-pull.sh | 11 +++++++++++\n 2 files changed, 16 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/pull.c b/builtin/pull.c\nindex 722a83c..b7bc1ff 100644\n--- a/builtin/pull.c\n+++ b/builtin/pull.c\n@@ -823,10 +823,14 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n \t\thashclr(orig_head);\n \n \tif (opt_rebase) {\n+\t\tint autostash = 0;\n+\n \t\tif (is_null_sha1(orig_head) && !is_cache_unborn())\n \t\t\tdie(_(\"Updating an unborn branch with changes added to the index.\"));\n \n-\t\tdie_on_unclean_work_tree(prefix);\n+\t\tgit_config_get_bool(\"rebase.autostash\", &autostash);\n+\t\tif (!autostash)\n+\t\t\tdie_on_unclean_work_tree(prefix);\n \n \t\tif (get_rebase_fork_point(rebase_fork_point, repo, *refspecs))\n \t\t\thashclr(rebase_fork_point);\ndiff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\nindex f4a7193..a0013ee 100755\n--- a/t/t5520-pull.sh\n+++ b/t/t5520-pull.sh\n@@ -245,6 +245,17 @@ test_expect_success '--rebase fails with multiple branches' '\n \ttest modified = \"$(git show HEAD:file)\"\n '\n \n+test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n+\ttest_config rebase.autostash true &&\n+\tgit reset --hard before-rebase &&\n+\techo dirty >new_file &&\n+\tgit add new_file &&\n+\tgit pull --rebase . copy &&\n+\ttest_cmp_rev HEAD^ copy &&\n+\ttest \"$(cat new_file)\" = dirty &&\n+\ttest \"$(cat file)\" = \"modified again\"\n+'\n+\n test_expect_success 'pull.rebase' '\n \tgit reset --hard before-rebase &&\n \ttest_config pull.rebase true &&\n-- \n2.5.0.rc1.21.gbd65f2d.dirty\n"},{"id":"266619","messageId":"20150722190724.GA11291@ikke.info","threadId":"39506","inReplyTo":"20150707035956.GA6105@yoshi.chippynet.com","subject":"Re: [PATCH v5] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-07-22T19:07:24Z","receivedAt":"2015-07-22T19:07:24Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Tue, Jul 07, 2015 at 11:59:56AM +0800, Paul Tan wrote:\n> On Mon, Jul 06, 2015 at 01:39:47PM -0700, Junio C Hamano wrote:\n> > Kevin Daudt <me@ikke.info> writes:\n> > \n> > > rebase learned to stash changes when it encounters a dirty work tree, but\n> > > git pull --rebase does not.\n> > >\n> > > Only verify if the working tree is dirty when rebase.autostash is not\n> > > enabled.\n> > >\n> > > Signed-off-by: Kevin Daudt <me@ikke.info>\n> > > Helped-by: Paul Tan <pyokagan@gmail.com>\n> > > ---\n> > \n> > I applied it, tried to run today's integration cycle, and then ended\n> > up ejecting it from my tree for now, as this seemed to break 5520\n> > when merged to 'pu' X-<.\n> > \n> > Well, that is partly expected, as Paul's builtin/pull.c does not\n> > know about it (yet).\n> \n> Yeah, sorry about that.\n> \n> Here's a modified patch for the C code.\n> \n> Regards,\n> Paul\n> \n> --- >8 ---\n> From: Kevin Daudt <me@ikke.info>\n> Date: Sat, 4 Jul 2015 23:42:38 +0200\n> \n> rebase learned to stash changes when it encounters a dirty work tree,\n> but git pull --rebase does not.\n> \n> Only verify if the working tree is dirty when rebase.autostash is not\n> enabled.\n> \n> Signed-off-by: Kevin Daudt <me@ikke.info>\n> Signed-off-by: Paul Tan <pyokagan@gmail.com>\n> ---\n>  builtin/pull.c  |  6 +++++-\n>  t/t5520-pull.sh | 11 +++++++++++\n>  2 files changed, 16 insertions(+), 1 deletion(-)\n> \n> diff --git a/builtin/pull.c b/builtin/pull.c\n> index 722a83c..b7bc1ff 100644\n> --- a/builtin/pull.c\n> +++ b/builtin/pull.c\n> @@ -823,10 +823,14 @@ int cmd_pull(int argc, const char **argv, const char *prefix)\n>  \t\thashclr(orig_head);\n>  \n>  \tif (opt_rebase) {\n> +\t\tint autostash = 0;\n> +\n>  \t\tif (is_null_sha1(orig_head) && !is_cache_unborn())\n>  \t\t\tdie(_(\"Updating an unborn branch with changes added to the index.\"));\n>  \n> -\t\tdie_on_unclean_work_tree(prefix);\n> +\t\tgit_config_get_bool(\"rebase.autostash\", &autostash);\n> +\t\tif (!autostash)\n> +\t\t\tdie_on_unclean_work_tree(prefix);\n>  \n>  \t\tif (get_rebase_fork_point(rebase_fork_point, repo, *refspecs))\n>  \t\t\thashclr(rebase_fork_point);\n> diff --git a/t/t5520-pull.sh b/t/t5520-pull.sh\n> index f4a7193..a0013ee 100755\n> --- a/t/t5520-pull.sh\n> +++ b/t/t5520-pull.sh\n> @@ -245,6 +245,17 @@ test_expect_success '--rebase fails with multiple branches' '\n>  \ttest modified = \"$(git show HEAD:file)\"\n>  '\n>  \n> +test_expect_success 'pull --rebase succeeds with dirty working directory and rebase.autostash set' '\n> +\ttest_config rebase.autostash true &&\n> +\tgit reset --hard before-rebase &&\n> +\techo dirty >new_file &&\n> +\tgit add new_file &&\n> +\tgit pull --rebase . copy &&\n> +\ttest_cmp_rev HEAD^ copy &&\n> +\ttest \"$(cat new_file)\" = dirty &&\n> +\ttest \"$(cat file)\" = \"modified again\"\n> +'\n> +\n>  test_expect_success 'pull.rebase' '\n>  \tgit reset --hard before-rebase &&\n>  \ttest_config pull.rebase true &&\n> -- \n> 2.5.0.rc1.21.gbd65f2d.dirty\n> \n\nAny news about this? Is it still waiting for something?\n"},{"id":"266627","messageId":"xmqqvbdcq8rq.fsf@gitster.dls.corp.google.com","threadId":"39506","inReplyTo":"20150722190724.GA11291@ikke.info","subject":"Re: [PATCH v5] pull: allow dirty tree when rebase.autostash enabled","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-07-22T19:42:17Z","receivedAt":"2015-07-22T19:42:17Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kevin Daudt <me@ikke.info> writes:\n\n> On Tue, Jul 07, 2015 at 11:59:56AM +0800, Paul Tan wrote:\n>\n> Any news about this? Is it still waiting for something?\n\nPaul's patch was buried in the noise and I didn't notice it.\n\nI'd prefer to see a new feature like this, that did not exist in the\noriginal, be done on top of the \"rewrite pull in C\" topic, which\nwill need a bit more time to mature and be merged to 'master'.\n\nThanks.\n"},{"id":"266631","messageId":"20150722204852.GB11291@ikke.info","threadId":"39506","inReplyTo":"xmqqvbdcq8rq.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v5] pull: allow dirty tree when rebase.autostash enabled","fromName":"Kevin Daudt","fromEmail":"me@ikke.info","sentAt":"2015-07-22T20:48:52Z","receivedAt":"2015-07-22T20:48:52Z","isPatch":true,"sender":{"key":"me@ikke.info","avatar":"https://avatars.githubusercontent.com/u/135698?v=4"},"body":"On Wed, Jul 22, 2015 at 12:42:17PM -0700, Junio C Hamano wrote:\n> Kevin Daudt <me@ikke.info> writes:\n> \n> > On Tue, Jul 07, 2015 at 11:59:56AM +0800, Paul Tan wrote:\n> >\n> > Any news about this? Is it still waiting for something?\n> \n> Paul's patch was buried in the noise and I didn't notice it.\n> \n> I'd prefer to see a new feature like this, that did not exist in the\n> original, be done on top of the \"rewrite pull in C\" topic, which\n> will need a bit more time to mature and be merged to 'master'.\n> \n> Thanks.\n\nOk, no problem.\n"}]}