git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Björn Steinbrink" <B.Steinbrink@gmx.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: Julian Phillips <julian@quantumfyre.co.uk>,
	Daniel Barkalow <barkalow@iabervon.org>,
	James Pickens <jepicken@gmail.com>, Jeff King <peff@peff.net>,
	Nicolas Pitre <nico@fluxnic.net>,
	Jay Soffian <jaysoffian@gmail.com>,
	git@vger.kernel.org
Subject: Re: [PATCH] Proof-of-concept patch to remember what the detached HEAD was
Date: Mon, 19 Oct 2009 10:44:07 +0200	[thread overview]
Message-ID: <20091019084407.GA2796@atjola.homenet> (raw)
In-Reply-To: <7vws2snwum.fsf@alter.siamese.dyndns.org>

On 2009.10.18 15:47:13 -0700, Junio C Hamano wrote:
> Björn Steinbrink <B.Steinbrink@gmx.de> writes:
> > On 2009.10.17 02:04:02 -0700, Junio C Hamano wrote:
> >  1) No uncommitted changes => No problem
> >  2) Uncommitted changes merge cleanly => No problem
> >  3) Uncommitted changes causes conflicts =>
> >    - User can resolve
> >    - User can start over (git update --retry)
> >    - User can give up (git update --abort)
> 
> By "--abort", if you meant to discard the local change, that is only
> suitable for people who would say "what I was doing was minor anyway, and
> I'll redo them based on the updated upstream", and may not be so useful, I
> think.  The user may want to pretend that he did not even start "update"
> (i.e. not pulled while he was still working on something) at this point,
> and if you meant by "give up" (aka --abort) to "reset --hard @{1} &&
> unstash", I think it makes quite a lot of sense.  Then the user has an
> option to fork a topic at that point:
> 
>     git update --abort
>     git checkout -b topic
>     work on more with committing
>     git checkout master
>     git update

Yes, I meant the latter. The former would just be "git reset --hard" and
is pointless to be rewrapped in "git update --abort". Maybe "abort" is
the wrong word there? I'm not a native speaker and basically took that
from "git rebase", which returns you to your (unchanged) branch head,
i.e. the state you were in before you started the rebase.

> But then this starts to look more like an enhanced failure recovery mode
> for "git pull" command.

Yeah, I notice that, also while working on my "proof-of-concept"
implementation. Currently, I simply suggest "git pull" to the user when
the update is not a fast-forward one.

I'm probably influenced by a latent hatred for "git pull"... Explaining
that it is fetch+merge/rebase and uses defaults from the config which
are automagically setup is probably something my fingers can do on
their own by now. Confusion about "git pull" probably beats
misunderstandings about HEAD.

If it wasn't so inconvenient for people that actually commit, I'd even
dare to suggest:

git update
 - FF update only, using branch.<name>.{remote,merge}
 - suggests "git update --merge" or "git update --rebase" if non-ff

git update --merge
 - Does a merge

git update --rebase
 - Does a rebase

And "git pull" would stop using branch.<name>.{remote,merge} and require
command line arguments.

That would at least raise awareness that "git update --merge" is doing a
merge, unlike "git pull", which many new users simply treat as magic,
not realizing what actually happens (and thus they create butt-ugly
criss-cross merge histories). Of course, I can't tell whether being
aware that a merge happens actually makes the user realize that they
shouldn't update/pull/merge 50 times a day.

But passing --merge all the time seems just too inconvenient. And having
a config option to make --merge or --rebase the default would probably
end up with --merge as the "default default", ultimately turning "git
update" into "git pull".

Anyway, I'm probably getting quite far off the track here.

> In addition, I think that you would internally implement the "save" step
> with "stash" (which would be a sane thing to do), but then you would need
> to worry about the case where the user was in the middle of a merge (or
> "revert", "cherry-pick", "checkout -m") that did not complete.  "git pull"
> fails upfront, says why and tells users what to do.  "git update" should
> do the same.

Yup, got the same check in my PoC

> > I do see problems with a "stash around merge" thing ("stash" around
> > rebase seems easier, as that could just create a commit and reset later,
> > but I'm not exactly sure that such smartness is a good idea). As soon as
> > the merge has conflicts, you need to know that you have to unstash after
> > committing the merge, but what I have in mind is fast-forward only (or
> > possibly reset, when upstream was rewritten).  Primarily for users that
> > don't commit at all, but just look at things [*1*].
> 
> Ok.  If you have a clean way to guarantee that "update" users won't
> commit, I think the above would sort of make sense and my earlier worries
> about (1) a user who wish he did not fetch and (2) a user who was doing
> something more complex and had conflicts already would go away.

Currently it's just:
test -z "$(git rev-list -1 $upstream..)"

As a "is a fast-forward" check, suggesting the user to use "git pull"
instead of "git update", if it is not. Maybe I should use "git
merge-base" there instead? Is that better? Not sure whether history
simplication might break the rev-list based test...

> If the sole target audience is "minor changes only, never committing"
> people, then I would even rescind my earlier suggestion on --abort; it
> should mean "remove the minor changes and get pristine copy of the
> upstream---the user will redo the minor changes to adjust to the updated
> upstream from scratch", to keep the end user experience simpler and
> clearer.

Hmhm... If the user can't resolve the conflict, but still keep those
changes, he might want to ask someone else for help. And then he might
want to present his changes to that other person, so I think allowing
the user to go back to the old commit with his changes on top is better.
Maybe "git update --drop" could do the "drop the user's changes", if the
user wants to do so. No support for going back is what's bad about "svn
update" (and, I guess, "git checkout --merge").

> I am undecided if it is a good thing to divide the userbase into two
> classes, "update" people and "work-commit-fetch-merge-resolve" people.

I expect that there are already two userbases. Developers in one
userbase and users that just want the latest code in the other. And
these users might have some uncommitted stuff (either self-made or
possibly found somewhere, or maybe a bit of both).

I just wonder what's easier/better: to cater to each one or trying to
unify them by trying to educate the one that actually doesn't care.

Björn

  reply	other threads:[~2009-10-19  8:44 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-14  4:44 [PATCH] Proof-of-concept patch to remember what the detached HEAD was Daniel Barkalow
2009-10-14  5:07 ` Junio C Hamano
2009-10-14  5:08 ` Jeff King
2009-10-14 10:33   ` Johannes Schindelin
2009-10-14 15:39     ` Jeff King
2009-10-14 18:34       ` Junio C Hamano
2009-10-14 18:40         ` Jeff King
2009-10-14 15:56   ` Daniel Barkalow
2009-10-14 18:56 ` Jay Soffian
2009-10-14 19:15   ` Daniel Barkalow
2009-10-14 20:18     ` Nicolas Pitre
2009-10-14 20:37       ` Daniel Barkalow
2009-10-14 20:42       ` Junio C Hamano
2009-10-14 20:48         ` Nicolas Pitre
2009-10-14 22:34           ` Junio C Hamano
2009-10-14 23:09             ` Jeff King
2009-10-14 23:34               ` Nicolas Pitre
2009-10-15  0:56                 ` Junio C Hamano
2009-10-15  1:47                   ` Jeff King
2009-10-15  3:08                     ` Nicolas Pitre
2009-10-15  4:21                       ` Jeff King
2009-10-16  1:04                       ` Johannes Schindelin
2009-10-16  1:36                         ` Nicolas Pitre
2009-10-16  2:07                           ` Johannes Schindelin
2009-10-16  2:45                             ` Nicolas Pitre
2009-10-16  2:56                             ` Junio C Hamano
2009-10-17  7:24                             ` Sean Estabrooks
2009-10-26 22:22                               ` Johannes Schindelin
2009-10-27  3:41                                 ` Nanako Shiraishi
2009-10-27 10:33                                   ` Making Git easy to use -- without RTFM, was " Johannes Schindelin
2009-10-27 17:58                                     ` Avery Pennarun
2009-10-16  0:53                   ` Johannes Schindelin
2009-10-16  3:00                     ` Junio C Hamano
2009-10-15  7:36               ` James Pickens
2009-10-15 12:54                 ` Jakub Narebski
2009-10-15 14:11                   ` Björn Steinbrink
2009-10-15 19:03                   ` Nicolas Pitre
2009-10-15 15:36                 ` Daniel Barkalow
2009-10-15 16:29                   ` Michael J Gruber
2009-10-15 19:07                   ` Nicolas Pitre
2009-10-15 19:22                     ` Daniel Barkalow
2009-10-15 22:56                       ` Thomas Rast
2009-10-15 18:51                 ` Nicolas Pitre
2009-10-15 19:52                   ` Junio C Hamano
2009-10-15 21:26                     ` Jeff King
2009-10-15 21:54                       ` Junio C Hamano
2009-10-15 22:08                         ` Junio C Hamano
2009-10-15 23:16                           ` Nicolas Pitre
2009-10-15 23:47                           ` James Pickens
2009-10-16  0:34                             ` Nicolas Pitre
2009-10-16  0:43                             ` Johannes Schindelin
2009-10-16  5:03                             ` Björn Steinbrink
2009-10-15 22:16                         ` Jeff King
2009-10-15 22:17                           ` Jeff King
2009-10-16  4:29                         ` Björn Steinbrink
2009-10-16  6:02                           ` Daniel Barkalow
2009-10-16  8:27                             ` Björn Steinbrink
2009-10-16 15:44                             ` Nicolas Pitre
2009-10-15 19:31                 ` Daniel Barkalow
2009-10-15 20:34                   ` Junio C Hamano
2009-10-15 21:35                     ` Daniel Barkalow
2009-10-15 21:48                       ` Nicolas Pitre
2009-10-16 12:15                   ` Julian Phillips
2009-10-16 14:30                     ` Björn Steinbrink
2009-10-16 17:31                       ` Julian Phillips
2009-10-16 18:29                         ` Daniel Barkalow
2009-10-16 19:05                         ` Junio C Hamano
2009-10-16 19:48                           ` Julian Phillips
2009-10-16 20:19                             ` Nicolas Pitre
2009-10-17 15:15                               ` Julian Phillips
2009-10-17 17:04                                 ` Björn Steinbrink
2009-10-17 17:35                                   ` Julian Phillips
2009-10-17 17:48                                     ` Björn Steinbrink
2009-10-17 22:28                                       ` Julian Phillips
2009-10-16 20:19                             ` Junio C Hamano
2009-10-17 15:32                               ` Julian Phillips
2009-10-17 17:43                                 ` Junio C Hamano
2009-10-17 22:19                                   ` Julian Phillips
2009-10-17  7:55                         ` Björn Steinbrink
2009-10-17  8:11                           ` Junio C Hamano
2009-10-17  8:40                             ` Björn Steinbrink
2009-10-17  9:04                               ` Junio C Hamano
2009-10-17 17:07                                 ` James Pickens
2009-10-17 19:41                                 ` Björn Steinbrink
2009-10-18 22:47                                   ` Junio C Hamano
2009-10-19  8:44                                     ` Björn Steinbrink [this message]
2009-10-17 15:02                           ` Julian Phillips
2009-10-14 23:52         ` Eric Raible
2009-10-16 22:36 ` Christoph Bartoschek
2009-10-17  7:43   ` Junio C Hamano
2009-10-17  8:19     ` Björn Steinbrink
2009-10-17 17:42       ` Junio C Hamano
2009-10-17 20:35     ` Daniel Barkalow

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=20091019084407.GA2796@atjola.homenet \
    --to=b.steinbrink@gmx.de \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jaysoffian@gmail.com \
    --cc=jepicken@gmail.com \
    --cc=julian@quantumfyre.co.uk \
    --cc=nico@fluxnic.net \
    --cc=peff@peff.net \
    /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).