From: Jeff King <peff@peff.net>
To: Michal Sojka <sojka@os.inf.tu-dresden.de>
Cc: git@vger.kernel.org, paulus@samba.org
Subject: Re: [PATCH v3] gitk: Allow commit editing
Date: Thu, 25 Aug 2011 13:30:19 -0400 [thread overview]
Message-ID: <20110825173018.GA519@sigill.intra.peff.net> (raw)
In-Reply-To: <87bovdvdhd.fsf@steelpick.2x.cz>
On Thu, Aug 25, 2011 at 03:15:42PM +0200, Michal Sojka wrote:
> I implemented something like you ontlined above (see below). Instead of
> rev-listing HEAD, I use the commit id to be edited. This way I don't
> have to find the commit in the returned list, but I only check whether
> the list is empty or not.
Yeah, that makes sense. Technically you are also rewriting every commit
_after_ the commit in question, so you want to be sure that those aren't
included elsewhere, too. But by definition, any ref which includes them
must also include the commit in question, so I think your test is
sufficient.
> Additionally, besides skiping HEAD ref, I also skip refs/stash. Rebasing
> before stash should not (I hope) cause any problems and therefore it is
> not necessary to warn the user.
Yes, that makes sense to me, too.
> > Speaking of which, notice that I used HEAD here. What happens with your
> > patch if I do:
> >
> > $ git checkout foo
> > $ gitk bar
> >
> > and select a commit to edit that is not in "foo"?
>
> I added a check for this. If this is detected, error message is
> displayed and no edit is possible.
I was going to suggest that we could actually do the rebase on "bar",
but that is probably too much complexity hiding behind the user's back
(not to mention that there are lots of corner cases where figuring out
the right branch is tough, like "gitk <sha1>").
> The other changes in this version are:
> - added --no-autosquash to rebase invocation
Yeah, that is probably a good idea.
> + # Check whether some other refs contain the commit to be edited
> + if {[exec git rev-list --stdin $id << $otherrefsneg] eq {}} {
> + if { [confirm_popup [mc "The commit you are going to edit is contained in another, possibly non-local, ref (e.g. branch or tag).\
> + It is a bad idea to change a ref that is possibly used by other people. See git-rebase(1) for details.\n\n\
> + Do you want to continue?"]]} {
> + return 1
Minor micro-optimization: this can be "git rev-list -1". You only care
if it produces the one commit, so that's sufficient. Without "-1", git
will keep reporting commits all the way down to the merge base with some
other ref.
Another question I had while thinking about whether or not this whole
idea is sane: what happens with conflicts in later commits that are
caused by your amended changes? Rebase will complain to the terminal,
no? Which the user may or may not even see, depending on how they
started gitk.
-Peff
next prev parent reply other threads:[~2011-08-25 17:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-17 19:56 [PATCH RFC] gitk: Allow commit editing Michal Sojka
2011-08-18 22:33 ` Jeff King
2011-08-19 11:44 ` Chris Packham
2011-08-19 13:34 ` Michal Sojka
2011-08-19 14:40 ` Michal Sojka
2011-08-19 12:23 ` Michal Sojka
2011-08-19 12:25 ` [PATCH] " Michal Sojka
2011-08-25 3:14 ` Jeff King
2011-08-25 13:15 ` [PATCH v3] " Michal Sojka
2011-08-25 17:30 ` Jeff King [this message]
2011-08-27 12:31 ` [PATCH v4] " Michal Sojka
2011-09-07 20:10 ` Jeff King
2011-09-08 20:59 ` Paul Mackerras
2011-09-13 23:11 ` Michal Sojka
2011-08-25 3:07 ` [PATCH RFC] " Jeff King
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=20110825173018.GA519@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=paulus@samba.org \
--cc=sojka@os.inf.tu-dresden.de \
/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).