{"thread":{"id":"8788","subject":"Re: [PATCH (3rd try)] Add git-stash script","startedAt":"2007-07-01T00:16:11Z","lastAt":"2007-07-01T00:16:11Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"46135","messageId":"Pine.LNX.4.64.0707010111340.4438@racer.site","threadId":"8788","inReplyTo":"200706302327.l5UNRMtc027974@mi0.bluebottle.com","subject":"Re: [PATCH (3rd try)] Add git-stash script","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-01T00:16:11Z","receivedAt":"2007-07-01T00:16:11Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sun, 1 Jul 2007, しらいしななこ wrote:\n\n> Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>:\n> \n> > On Sat, 30 Jun 2007, しらいしななこ wrote:\n> >\n> >> diff --git a/git-stash.sh b/git-stash.sh\n> >> [...]\n> >> +\tprintf >&2 'Saved WIP on %s\\n' \"$msg\"\n> >\n> > You have an awful lot of printfs in the code. Why not just use echos?\n> \n> I just imitated other scripts.  I can change it to\n> \n> echo >&2 \"Saved WIP on $msg\"\n> \n> but after reading Junio's comments, I think I probably should not.\n\nYou can leave them as-are, but I am actually more used to reading \nsomething like\n\n\techo \"Saved WIP on $msg\" >&2\n\n> >> +list_stash () {\n> >> +\tgit-log --pretty=oneline -g \"$@\" $ref_stash |\n> >\n> > Wouldn't you want \"--default $ref_stash\" here?\n> \n> I do not know, and I'm sorry I do not understand Junio's comments.\n> \n> What does --default do in this case?\n\nI had the impression that\n\n\tgit stash list stash@{3}\n\nwould make sense. Probably I was mistaken.\n\n> >> +apply_stash () {\n> >> +\tgit-diff-files --quiet ||\n> >> +\t\tdie 'Cannot restore on top of a dirty state'\n> >\n> > You meant \"no_changes\", right? I think you miss changes in the index \n> > otherwise.\n> \n> After I read exchanges between you and Junio I do not know which way is \n> preferred.\n\nWell, there are two differing, and contradicting, preferences: Junio's and \nmine.\n\nNow you can have a third preference, but in the end what weighs most is \nthe opinion of the person implementing it.\n\n> Using no_changes does not forbid me from doing that, but I think Junio's \n> example will be forbidden.  The original scenario was that I apply a \n> stashed change to an unmodified state, and there is no problem either \n> way.\n\nOh, but there is. Imagine this:\n\nFile \"f\" contains \"1\" in HEAD, \"2\" in the index and \"3\" in the working \ndirectory. Now you say \"git stash\". Okay, file \"f\" now contains \"1\" in all \nthree, and the working directory is clean. Suppose you decide the stash \nwas a mistake. \"git stash apply\". File \"f\" contains \"1\" in _both_ the HEAD \nand the index, and \"3\" in the working directory.\n\nNow, you might say that it does not matter. But then we should not even \nsave the index.\n\nCan I make one further request? Add \"git stash save\" to do the same as \n\"git stash\"?\n\nCiao,\nDscho\n"}]}