{"thread":{"id":"28186","subject":"[Git 1.7.6.557.gcee4] git stash","startedAt":"2011-08-22T06:01:24Z","lastAt":"2011-08-22T20:15:33Z","messageCount":5,"participants":["Hilco Wijbenga","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"173996","messageId":"CAE1pOi1D+J5_fmsdhho1FRAipyO3Ri7GS_wy4fTNtCGbatDaDg@mail.gmail.com","threadId":"28186","inReplyTo":null,"subject":"[Git 1.7.6.557.gcee4] git stash","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2011-08-22T06:01:24Z","receivedAt":"2011-08-22T06:01:24Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"Hi David,\n\nI noticed your very timely change to git stash in the current master\nbranch. I tried it but it doesn't behave as I was expecting/hoping.\n\nhilco@centaur ~/tmp/repo repo$ git --version\ngit version 1.7.6.557.gcee4\nhilco@centaur ~/tmp/repo repo$ git init\nInitialized empty Git repository in /home/hilco/tmp/repo/.git/\nhilco@centaur ~/tmp/repo repo (master #)$ cat >>.gitignore <<- EOF\n>         *.ignore\n>         ignore-dir/\n> EOF\nhilco@centaur ~/tmp/repo repo (master #%)$ mkdir src\nhilco@centaur ~/tmp/repo repo (master #%)$ touch file.txt src/code.txt\nhilco@centaur ~/tmp/repo repo (master #%)$ git add -A .\nhilco@centaur ~/tmp/repo repo (master #)$ git commit -m '1'\n[master (root-commit) 0fb4106] 1\n 1 files changed, 2 insertions(+), 0 deletions(-)\n create mode 100644 .gitignore\n create mode 100644 file.txt\n create mode 100644 src/code.txt\nhilco@centaur ~/tmp/repo repo (master)$ touch file-a.ignore src/file-b.ignore\nhilco@centaur ~/tmp/repo repo (master %)$ echo \"hello\">src/code.txt\nhilco@centaur ~/tmp/repo repo (master *%)$ mkdir ignore-dir\nhilco@centaur ~/tmp/repo repo (master *%)$ touch\nignore-dir/{file.ignore,file.txt}\nhilco@centaur ~/tmp/repo repo (master *%)$ git status\n# On branch master\n# Changes not staged for commit:\n#   (use \"git add <file>...\" to update what will be committed)\n#   (use \"git checkout -- <file>...\" to discard changes in working directory)\n#\n#       modified:   src/code.txt\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       file-a.ignore\n#       ignore-dir/\n#       src/file-b.ignore\nno changes added to commit (use \"git add\" and/or \"git commit -a\")\nhilco@centaur ~/tmp/repo repo (master *%)$ git stash --no-keep-index --all\nSaved working directory and index state WIP on master: 0fb4106 1\nHEAD is now at 0fb4106 1\nNot removing ignore-dir/\nhilco@centaur ~/tmp/repo repo (master $%)$ git status\n# On branch master\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       ignore-dir/\nnothing added to commit but untracked files present (use \"git add\" to track)\n\nSo it quite explicitly states \"Not removing ignore-dir/\". How do I\nmake sure it also stashes the ignore-dir directory?\n\nCheers,\nHilco\n"},{"id":"174027","messageId":"euT1_KmfLWaxwFqOd8u_Zv-flc6Wr9rvg1tf_39P-YMaH8T-tpKl94WG8yCIAmW0AMLjdqnjA3I2uGRQf9YpY513-Io-lue5aNPuVDv8Qp8@cipher.nrlssc.navy.mil","threadId":"28186","inReplyTo":"CAE1pOi1D+J5_fmsdhho1FRAipyO3Ri7GS_wy4fTNtCGbatDaDg@mail.gmail.com","subject":"Re: [Git 1.7.6.557.gcee4] git stash","fromName":"Brandon Casey","fromEmail":"brandon.casey.ctr@nrlssc.navy.mil","sentAt":"2011-08-22T17:15:29Z","receivedAt":"2011-08-22T17:15:29Z","isPatch":false,"sender":{"key":"brandon.casey.ctr@nrlssc.navy.mil","avatar":null},"body":"On 08/22/2011 01:01 AM, Hilco Wijbenga wrote:\n> Hi David,\n> \n> I noticed your very timely change to git stash in the current master\n> branch. I tried it but it doesn't behave as I was expecting/hoping.\n\nIt looks like it is actually creating the stash correctly, but it's\njust not deleting the ignored directory.\n\nBut, there is a small problem with your command sequence...\n\n> hilco@centaur ~/tmp/repo repo$ git --version\n> git version 1.7.6.557.gcee4\n> hilco@centaur ~/tmp/repo repo$ git init\n> Initialized empty Git repository in /home/hilco/tmp/repo/.git/\n> hilco@centaur ~/tmp/repo repo (master #)$ cat >>.gitignore <<- EOF\n>>         *.ignore\n>>         ignore-dir/\n>> EOF\n> hilco@centaur ~/tmp/repo repo (master #%)$ mkdir src\n> hilco@centaur ~/tmp/repo repo (master #%)$ touch file.txt src/code.txt\n> hilco@centaur ~/tmp/repo repo (master #%)$ git add -A .\n> hilco@centaur ~/tmp/repo repo (master #)$ git commit -m '1'\n> [master (root-commit) 0fb4106] 1\n>  1 files changed, 2 insertions(+), 0 deletions(-)\n>  create mode 100644 .gitignore\n>  create mode 100644 file.txt\n>  create mode 100644 src/code.txt\n> hilco@centaur ~/tmp/repo repo (master)$ touch file-a.ignore src/file-b.ignore\n> hilco@centaur ~/tmp/repo repo (master %)$ echo \"hello\">src/code.txt\n> hilco@centaur ~/tmp/repo repo (master *%)$ mkdir ignore-dir\n> hilco@centaur ~/tmp/repo repo (master *%)$ touch\n> ignore-dir/{file.ignore,file.txt}\n> hilco@centaur ~/tmp/repo repo (master *%)$ git status\n> # On branch master\n> # Changes not staged for commit:\n> #   (use \"git add <file>...\" to update what will be committed)\n> #   (use \"git checkout -- <file>...\" to discard changes in working directory)\n> #\n> #       modified:   src/code.txt\n> #\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #       file-a.ignore\n> #       ignore-dir/\n> #       src/file-b.ignore\n          ^^^^^^^^^^^^^^^^^\nWhy are these entries here?\n\n> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n\nif your .gitignore file looks like this:\n\n   $ cat .gitignore\n   *.ignore\n   ignore-dir/\n\nthen why are those items showing up under \"Untracked files:\" in the call\nto git status above?  /methinks something is wrong with your .gitignore\nfile.  It doesn't matter in this case, since --all will cause stash to\nstash the untracked files regardless of whether they are ignored.\n\n> hilco@centaur ~/tmp/repo repo (master *%)$ git stash --no-keep-index --all\n> Saved working directory and index state WIP on master: 0fb4106 1\n> HEAD is now at 0fb4106 1\n> Not removing ignore-dir/\n> hilco@centaur ~/tmp/repo repo (master $%)$ git status\n> # On branch master\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #       ignore-dir/\n> nothing added to commit but untracked files present (use \"git add\" to track)\n\nAlso, in the future it would be nicer if you provided your list of\ncommands separately, at the beginning, linked together with &&.\nThis makes it easier to copy/paste into my terminal, rather than\nhaving to extract the commands out from within the body.\nLike this (slightly simplified):\n\n   git --version &&\n   git init &&\n   cat <<-\\EOF >.gitignore &&\n\t*.ignore\n\tignore-dir/\n\tEOF\n   mkdir src &&\n   touch file.txt src/code.txt &&\n   git add . &&\n   git commit -m 'initial commit' &&\n   touch file-a.ignore src/file-b.ignore &&\n   echo \"hello\" >src/code.txt &&\n   mkdir ignore-dir &&\n   touch ignore-dir/{file.ignore,file.txt} &&\n   git status &&\n   git stash --all &&\n   git status || echo 'FAILURE'\n\n> So it quite explicitly states \"Not removing ignore-dir/\".\n\nThat message is from git-clean, and it is the real problem.\n\n> How do I\n> make sure it also stashes the ignore-dir directory?\n\nIt actually did stash the ignore-dir, it just didn't remove it from\nthe working directory at the end.  Try deleting the ignore-dir by\nhand and then applying the stash, ignore-dir and its content should\nbe recreated.\n\nSomething like this is probably the appropriate fix:\n\ndiff --git a/git-stash.sh b/git-stash.sh\nindex f4e6f05..a2d4b4d 100755\n--- a/git-stash.sh\n+++ b/git-stash.sh\n@@ -240,7 +240,7 @@ save_stash () {\n                test \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION\n                if test -n \"$untracked\"\n                then\n-                       git clean --force --quiet $CLEAN_X_OPTION\n+                       git clean --force --quiet -d $CLEAN_X_OPTION\n                fi\n \n                if test \"$keep_index\" = \"t\" && test -n $i_tree\n\nNeeds tests.\n\n-Brandon\n"},{"id":"174032","messageId":"CAE1pOi2OnHpu+kBj8Z47nb7C-MHFpUMAc8ArG3haWpncEDQ-jA@mail.gmail.com","threadId":"28186","inReplyTo":"euT1_KmfLWaxwFqOd8u_Zv-flc6Wr9rvg1tf_39P-YMaH8T-tpKl94WG8yCIAmW0AMLjdqnjA3I2uGRQf9YpY513-Io-lue5aNPuVDv8Qp8@cipher.nrlssc.navy.mil","subject":"Re: [Git 1.7.6.557.gcee4] git stash","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2011-08-22T18:43:25Z","receivedAt":"2011-08-22T18:43:25Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 22 August 2011 10:15, Brandon Casey\n<brandon.casey.ctr@nrlssc.navy.mil> wrote:\n> On 08/22/2011 01:01 AM, Hilco Wijbenga wrote:\n>> Hi David,\n>>\n>> I noticed your very timely change to git stash in the current master\n>> branch. I tried it but it doesn't behave as I was expecting/hoping.\n>\n> It looks like it is actually creating the stash correctly, but it's\n> just not deleting the ignored directory.\n>\n> But, there is a small problem with your command sequence...\n>\n>> hilco@centaur ~/tmp/repo repo$ git --version\n>> git version 1.7.6.557.gcee4\n>> hilco@centaur ~/tmp/repo repo$ git init\n>> Initialized empty Git repository in /home/hilco/tmp/repo/.git/\n>> hilco@centaur ~/tmp/repo repo (master #)$ cat >>.gitignore <<- EOF\n>>>         *.ignore\n>>>         ignore-dir/\n>>> EOF\n>> hilco@centaur ~/tmp/repo repo (master #%)$ mkdir src\n>> hilco@centaur ~/tmp/repo repo (master #%)$ touch file.txt src/code.txt\n>> hilco@centaur ~/tmp/repo repo (master #%)$ git add -A .\n>> hilco@centaur ~/tmp/repo repo (master #)$ git commit -m '1'\n>> [master (root-commit) 0fb4106] 1\n>>  1 files changed, 2 insertions(+), 0 deletions(-)\n>>  create mode 100644 .gitignore\n>>  create mode 100644 file.txt\n>>  create mode 100644 src/code.txt\n>> hilco@centaur ~/tmp/repo repo (master)$ touch file-a.ignore src/file-b.ignore\n>> hilco@centaur ~/tmp/repo repo (master %)$ echo \"hello\">src/code.txt\n>> hilco@centaur ~/tmp/repo repo (master *%)$ mkdir ignore-dir\n>> hilco@centaur ~/tmp/repo repo (master *%)$ touch\n>> ignore-dir/{file.ignore,file.txt}\n>> hilco@centaur ~/tmp/repo repo (master *%)$ git status\n>> # On branch master\n>> # Changes not staged for commit:\n>> #   (use \"git add <file>...\" to update what will be committed)\n>> #   (use \"git checkout -- <file>...\" to discard changes in working directory)\n>> #\n>> #       modified:   src/code.txt\n>> #\n>> # Untracked files:\n>> #   (use \"git add <file>...\" to include in what will be committed)\n>> #\n>> #       file-a.ignore\n>> #       ignore-dir/\n>> #       src/file-b.ignore\n>          ^^^^^^^^^^^^^^^^^\n> Why are these entries here?\n\nMy bad. I had a script that ran the commands but I decided to try run\nthem on the CL so I copy-pasted them. That changed the tabs to spaces\nand ruined .gitignore.\n\n>> no changes added to commit (use \"git add\" and/or \"git commit -a\")\n>\n> if your .gitignore file looks like this:\n>\n>   $ cat .gitignore\n>   *.ignore\n>   ignore-dir/\n>\n> then why are those items showing up under \"Untracked files:\" in the call\n> to git status above?  /methinks something is wrong with your .gitignore\n> file.  It doesn't matter in this case, since --all will cause stash to\n> stash the untracked files regardless of whether they are ignored.\n>\n>> hilco@centaur ~/tmp/repo repo (master *%)$ git stash --no-keep-index --all\n>> Saved working directory and index state WIP on master: 0fb4106 1\n>> HEAD is now at 0fb4106 1\n>> Not removing ignore-dir/\n>> hilco@centaur ~/tmp/repo repo (master $%)$ git status\n>> # On branch master\n>> # Untracked files:\n>> #   (use \"git add <file>...\" to include in what will be committed)\n>> #\n>> #       ignore-dir/\n>> nothing added to commit but untracked files present (use \"git add\" to track)\n>\n> Also, in the future it would be nicer if you provided your list of\n> commands separately, at the beginning, linked together with &&.\n> This makes it easier to copy/paste into my terminal, rather than\n> having to extract the commands out from within the body.\n> Like this (slightly simplified):\n>\n>   git --version &&\n>   git init &&\n>   cat <<-\\EOF >.gitignore &&\n>        *.ignore\n>        ignore-dir/\n>        EOF\n>   mkdir src &&\n>   touch file.txt src/code.txt &&\n>   git add . &&\n>   git commit -m 'initial commit' &&\n>   touch file-a.ignore src/file-b.ignore &&\n>   echo \"hello\" >src/code.txt &&\n>   mkdir ignore-dir &&\n>   touch ignore-dir/{file.ignore,file.txt} &&\n>   git status &&\n>   git stash --all &&\n>   git status || echo 'FAILURE'\n\nNoted. Will do.\n\n>> So it quite explicitly states \"Not removing ignore-dir/\".\n>\n> That message is from git-clean, and it is the real problem.\n>\n>> How do I\n>> make sure it also stashes the ignore-dir directory?\n>\n> It actually did stash the ignore-dir, it just didn't remove it from\n> the working directory at the end.  Try deleting the ignore-dir by\n> hand and then applying the stash, ignore-dir and its content should\n> be recreated.\n>\n> Something like this is probably the appropriate fix:\n>\n> diff --git a/git-stash.sh b/git-stash.sh\n> index f4e6f05..a2d4b4d 100755\n> --- a/git-stash.sh\n> +++ b/git-stash.sh\n> @@ -240,7 +240,7 @@ save_stash () {\n>                test \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION\n>                if test -n \"$untracked\"\n>                then\n> -                       git clean --force --quiet $CLEAN_X_OPTION\n> +                       git clean --force --quiet -d $CLEAN_X_OPTION\n>                fi\n>\n>                if test \"$keep_index\" = \"t\" && test -n $i_tree\n>\n> Needs tests.\n\nI just tried it with the extra -d and it all seems to work\nbeautifully. Should your patch be sent anywhere?\n"},{"id":"174038","messageId":"fbFntd6r8tmN4NcET9Ya3OWDfsrxz1tfPv7GaddGfwwdirG8AgjrG8ARoR2-ZhadzpRI2DU2ZtTGdWAUGJeUZuBXmxWX5eSmT16u5cBjtec@cipher.nrlssc.navy.mil","threadId":"28186","inReplyTo":"CAE1pOi2OnHpu+kBj8Z47nb7C-MHFpUMAc8ArG3haWpncEDQ-jA@mail.gmail.com","subject":"Re: [Git 1.7.6.557.gcee4] git stash","fromName":"Brandon Casey","fromEmail":"brandon.casey.ctr@nrlssc.navy.mil","sentAt":"2011-08-22T19:58:20Z","receivedAt":"2011-08-22T19:58:20Z","isPatch":false,"sender":{"key":"brandon.casey.ctr@nrlssc.navy.mil","avatar":null},"body":"On 08/22/2011 01:43 PM, Hilco Wijbenga wrote:\n> On 22 August 2011 10:15, Brandon Casey\n> <brandon.casey.ctr@nrlssc.navy.mil> wrote:\n>> On 08/22/2011 01:01 AM, Hilco Wijbenga wrote:\n>>> Hi David,\n>>>\n>>> I noticed your very timely change to git stash in the current master\n>>> branch. I tried it but it doesn't behave as I was expecting/hoping.\n>>\n>> It looks like it is actually creating the stash correctly, but it's\n>> just not deleting the ignored directory.\n\n>> Something like this is probably the appropriate fix:\n>>\n>> diff --git a/git-stash.sh b/git-stash.sh\n>> index f4e6f05..a2d4b4d 100755\n>> --- a/git-stash.sh\n>> +++ b/git-stash.sh\n>> @@ -240,7 +240,7 @@ save_stash () {\n>>                test \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION\n>>                if test -n \"$untracked\"\n>>                then\n>> -                       git clean --force --quiet $CLEAN_X_OPTION\n>> +                       git clean --force --quiet -d $CLEAN_X_OPTION\n>>                fi\n>>\n>>                if test \"$keep_index\" = \"t\" && test -n $i_tree\n>>\n>> Needs tests.\n> \n> I just tried it with the extra -d and it all seems to work\n> beautifully. Should your patch be sent anywhere?\n\nIt needs a couple of tests added to t/t3905-stash-include-untracked.sh\nto demonstrate that this functionality works correctly and to ensure\nthat it doesn't break in the future.\n\nNeed tests at least for:\n\n   --all stashes untracked / ignored in subdirectory\n   --include-untracked stashes untracked in subdirectory, leaves ignored alone\n\nDo we currently test that stash leaves untracked / ignored alone when\n--all or --include-untracked are not supplied?\n\nAnd it needs a commit message following the guidelines in\nDocumentation/SubmittingPatches.  Then it can be submitted to this list\nusing format-patch and send-email.  Interested??? :)  otherwise I'll try\nto get to it later tonight.\n\n-Brandon\n"},{"id":"174041","messageId":"CAE1pOi1Et9e1g8cKUPZBykV-Y2-4UMRuxHvcDjRjEg7WxF=i1A@mail.gmail.com","threadId":"28186","inReplyTo":"fbFntd6r8tmN4NcET9Ya3OWDfsrxz1tfPv7GaddGfwwdirG8AgjrG8ARoR2-ZhadzpRI2DU2ZtTGdWAUGJeUZuBXmxWX5eSmT16u5cBjtec@cipher.nrlssc.navy.mil","subject":"Re: [Git 1.7.6.557.gcee4] git stash","fromName":"Hilco Wijbenga","fromEmail":"hilco.wijbenga@gmail.com","sentAt":"2011-08-22T20:15:33Z","receivedAt":"2011-08-22T20:15:33Z","isPatch":false,"sender":{"key":"hilco.wijbenga@gmail.com","avatar":null},"body":"On 22 August 2011 12:58, Brandon Casey\n<brandon.casey.ctr@nrlssc.navy.mil> wrote:\n> On 08/22/2011 01:43 PM, Hilco Wijbenga wrote:\n>> On 22 August 2011 10:15, Brandon Casey\n>> <brandon.casey.ctr@nrlssc.navy.mil> wrote:\n>>> On 08/22/2011 01:01 AM, Hilco Wijbenga wrote:\n>>>> Hi David,\n>>>>\n>>>> I noticed your very timely change to git stash in the current master\n>>>> branch. I tried it but it doesn't behave as I was expecting/hoping.\n>>>\n>>> It looks like it is actually creating the stash correctly, but it's\n>>> just not deleting the ignored directory.\n>\n>>> Something like this is probably the appropriate fix:\n>>>\n>>> diff --git a/git-stash.sh b/git-stash.sh\n>>> index f4e6f05..a2d4b4d 100755\n>>> --- a/git-stash.sh\n>>> +++ b/git-stash.sh\n>>> @@ -240,7 +240,7 @@ save_stash () {\n>>>                test \"$untracked\" = \"all\" && CLEAN_X_OPTION=-x || CLEAN_X_OPTION\n>>>                if test -n \"$untracked\"\n>>>                then\n>>> -                       git clean --force --quiet $CLEAN_X_OPTION\n>>> +                       git clean --force --quiet -d $CLEAN_X_OPTION\n>>>                fi\n>>>\n>>>                if test \"$keep_index\" = \"t\" && test -n $i_tree\n>>>\n>>> Needs tests.\n>>\n>> I just tried it with the extra -d and it all seems to work\n>> beautifully. Should your patch be sent anywhere?\n>\n> It needs a couple of tests added to t/t3905-stash-include-untracked.sh\n> to demonstrate that this functionality works correctly and to ensure\n> that it doesn't break in the future.\n>\n> Need tests at least for:\n>\n>   --all stashes untracked / ignored in subdirectory\n>   --include-untracked stashes untracked in subdirectory, leaves ignored alone\n>\n> Do we currently test that stash leaves untracked / ignored alone when\n> --all or --include-untracked are not supplied?\n>\n> And it needs a commit message following the guidelines in\n> Documentation/SubmittingPatches.  Then it can be submitted to this list\n> using format-patch and send-email.  Interested??? :)  otherwise I'll try\n> to get to it later tonight.\n\nInterested? Sure. Do I have the time? Unfortunately not. I'm\noverworked as it is. :-( Well, maybe in the weekend. But this would be\na major operation for me because it's all new.\n"}]}