From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric S. Raymond" Newsgroups: gmane.emacs.devel Subject: Re: Referring to revisions in the git future Date: Thu, 30 Oct 2014 06:13:36 -0400 Organization: Eric Conspiracy Secret Labs Message-ID: <20141030101336.GA4860@thyrsus.com> References: <87bnouapiy.fsf@fencepost.gnu.org> <20141029150600.GA5701@thyrsus.com> <20141029141216.7abbbc0d@anarchist.wooz.org> <20141029222946.GA13673@thyrsus.com> <545178BE.2050505@cs.ucla.edu> <87k33i9fgi.fsf_-_@violet.siamics.net> <20141030083156.GA2683@thyrsus.com> Reply-To: esr@thyrsus.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="u3/rZRmxL6MmkK24" X-Trace: ger.gmane.org 1414664072 32251 80.91.229.3 (30 Oct 2014 10:14:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 Oct 2014 10:14:32 +0000 (UTC) Cc: Ivan Shmakov , emacs-devel@gnu.org To: Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 30 11:14:26 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XjmkJ-00020w-RU for ged-emacs-devel@m.gmane.org; Thu, 30 Oct 2014 11:14:23 +0100 Original-Received: from localhost ([::1]:51841 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjmkJ-00068Q-DN for ged-emacs-devel@m.gmane.org; Thu, 30 Oct 2014 06:14:23 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XjmkC-00067K-6t for emacs-devel@gnu.org; Thu, 30 Oct 2014 06:14:20 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xjmk3-0005Ke-JD for emacs-devel@gnu.org; Thu, 30 Oct 2014 06:14:16 -0400 Original-Received: from static-71-162-243-5.phlapa.fios.verizon.net ([71.162.243.5]:39052 helo=snark.thyrsus.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xjmk3-0005KU-G2 for emacs-devel@gnu.org; Thu, 30 Oct 2014 06:14:07 -0400 Original-Received: by snark.thyrsus.com (Postfix, from userid 1000) id 26FA33833CA; Thu, 30 Oct 2014 06:13:37 -0400 (EDT) Content-Disposition: inline In-Reply-To: X-Eric-Conspiracy: There is no conspiracy User-Agent: Mutt/1.5.21 (2010-09-15) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 71.162.243.5 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:176064 Archived-At: --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Andreas Schwab : > > I have a little script called "editcomment" that does this. > > How is that different from git commit --amend? It works on any revision, not just the current branch tip. But it invalidates all the downsttream hashes. Copy enclosed for your inspection. -- Eric S. Raymond --u3/rZRmxL6MmkK24 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=editcomment #!/bin/sh # Give this a commit-ID specification. It will edit the associated comment. # Usual caveats apply; the edited one and all commits after will change IDs, # and pushing them to a repo with the old commits will wreak havoc. # Note also that this cavalierly overwrites refs/original. # # This script by Eric S. Raymond, March 2010, all rites perverted. It's based # on an idea by thiago from #git, but debugged and with a safety check. # It contains porcelain and porcelain byproducts. topdir=`git rev-parse --show-cdup` test -n "$topdir" && cd "$topdir" my_commit=`git rev-parse $1` || exit $? # Run a safety check before edits that could hose remotes. if test -n "`git branch -r --contains $mycommit`" then echo -n "Commit has been pushed. Really edit? " read yn if test "$yn" != 'y' then exit 0 fi fi my_file=COMMIT_EDITMSG test -d .git && myfile=.git/COMMIT_EDITMSG # This effort to invoke the user's normal editor fails. # the problem is that anything the editor writes to stdout on the # controlling terminal becomes part of the commit message. So # the editor needs to actually run inside another window. #test -z "$GIT_EDITOR" && GIT_EDITOR=$EDITOR #test -z "$GIT_EDITOR" && GIT_EDITOR=vi #my_editor=$GIT_EDITOR # xterm -e vi should also work. my_editor=emacsclient export my_file my_commit my_editor exec git filter-branch -f --tag-name-filter cat --msg-filter ' if test "$GIT_COMMIT" = "$my_commit"; then cat > $my_file; $my_editor $my_file >/dev/null; cat $my_file else cat fi' "$1~.." # End --u3/rZRmxL6MmkK24--