From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: しらいしななこ <nanako3@bluebottle.com>
Cc: Junio C Hamano <gitster@pobox.com>, GIT <git@vger.kernel.org>
Subject: Re: [PATCH (3rd try)] Add git-stash script
Date: Sun, 1 Jul 2007 01:16:11 +0100 (BST) [thread overview]
Message-ID: <Pine.LNX.4.64.0707010111340.4438@racer.site> (raw)
In-Reply-To: <200706302327.l5UNRMtc027974@mi0.bluebottle.com>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2267 bytes --]
Hi,
On Sun, 1 Jul 2007, しらいしななこ wrote:
> Quoting Johannes Schindelin <Johannes.Schindelin@gmx.de>:
>
> > On Sat, 30 Jun 2007, しらいしななこ wrote:
> >
> >> diff --git a/git-stash.sh b/git-stash.sh
> >> [...]
> >> + printf >&2 'Saved WIP on %s\n' "$msg"
> >
> > You have an awful lot of printfs in the code. Why not just use echos?
>
> I just imitated other scripts. I can change it to
>
> echo >&2 "Saved WIP on $msg"
>
> but after reading Junio's comments, I think I probably should not.
You can leave them as-are, but I am actually more used to reading
something like
echo "Saved WIP on $msg" >&2
> >> +list_stash () {
> >> + git-log --pretty=oneline -g "$@" $ref_stash |
> >
> > Wouldn't you want "--default $ref_stash" here?
>
> I do not know, and I'm sorry I do not understand Junio's comments.
>
> What does --default do in this case?
I had the impression that
git stash list stash@{3}
would make sense. Probably I was mistaken.
> >> +apply_stash () {
> >> + git-diff-files --quiet ||
> >> + die 'Cannot restore on top of a dirty state'
> >
> > You meant "no_changes", right? I think you miss changes in the index
> > otherwise.
>
> After I read exchanges between you and Junio I do not know which way is
> preferred.
Well, there are two differing, and contradicting, preferences: Junio's and
mine.
Now you can have a third preference, but in the end what weighs most is
the opinion of the person implementing it.
> Using no_changes does not forbid me from doing that, but I think Junio's
> example will be forbidden. The original scenario was that I apply a
> stashed change to an unmodified state, and there is no problem either
> way.
Oh, but there is. Imagine this:
File "f" contains "1" in HEAD, "2" in the index and "3" in the working
directory. Now you say "git stash". Okay, file "f" now contains "1" in all
three, and the working directory is clean. Suppose you decide the stash
was a mistake. "git stash apply". File "f" contains "1" in _both_ the HEAD
and the index, and "3" in the working directory.
Now, you might say that it does not matter. But then we should not even
save the index.
Can I make one further request? Add "git stash save" to do the same as
"git stash"?
Ciao,
Dscho
next parent reply other threads:[~2007-07-01 0:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200706302327.l5UNRMtc027974@mi0.bluebottle.com>
2007-07-01 0:16 ` Johannes Schindelin [this message]
2007-06-30 2:05 [PATCH (2nd try)] Add git-stash script Johannes Schindelin
2007-06-30 5:37 ` [PATCH (3rd " しらいしななこ
2007-06-30 6:12 ` Jeff King
2007-06-30 6:25 ` Junio C Hamano
2007-06-30 15:41 ` Johannes Schindelin
2007-06-30 17:19 ` Junio C Hamano
2007-06-30 23:27 ` しらいしななこ
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0707010111340.4438@racer.site \
--to=johannes.schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=nanako3@bluebottle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).