From: Junio C Hamano <junkio@cox.net>
To: Linus Torvalds <torvalds@osdl.org>
Cc: git@vger.kernel.org
Subject: Re: "git revert" (Re: pci_update_resource() getting called on sparc64)
Date: Mon, 08 Aug 2005 13:47:09 -0700 [thread overview]
Message-ID: <7vd5oo40mq.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <Pine.LNX.4.58.0508081257190.3258@g5.osdl.org> (Linus Torvalds's message of "Mon, 8 Aug 2005 12:57:44 -0700 (PDT)")
Linus Torvalds <torvalds@osdl.org> writes:
>> It may not have the nicest error messages: if you try to revert a merge
>> (which won't have a diff), git-apply will say something like
>>
>> fatal: No changes
>>
>> which isn't exactly being helpful. And the revert message could be made
>> more interesting (like putting the first line of the description of what
>> we reverted into the message instead of just the revision number).
> Comments?
>
> Linus
I like the general idea, and if we had a commit pretty format
"oneline", then something like this would make it look nicer.
Totally untested. I acquired your habit of coding in my e-mail
client ;-).
#!/bin/sh
. git-sh-setup-script || die "Not a git archive"
rev=$(git-rev-parse --verify --revs-only "$@") &&
commit=$(git-rev-parse --verify --revs-only "$commit^0") || exit
if git-diff-tree -R -p $commit | git-apply --index &&
msg=$(git-rev-list --pretty=oneline --max-count=1 $commit)
then
{
echo "Revert $msg"
echo
echo "This reverts $commit commit."
test "$rev" = "$commit" ||
echo "(original 'git revert' arguments: $@)"
} | git commit
else
# Now why did it fail?
parents=`git-cat-file commit "$commit" 2>/dev/null |
sed -ne '/^$/q;/^parent /p' |
wc -l`
case $parents in
0) die "Cannot revert the root commit nor non commit-ish" ;;
1) die "The patch does not apply" ;;
*) die "Cannot revert a merge commit" ;;
esac
fi
next prev parent reply other threads:[~2005-08-08 20:47 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050808.103304.55507512.davem@davemloft.net>
[not found] ` <Pine.LNX.4.58.0508081131540.3258@g5.osdl.org>
[not found] ` <20050808160846.GA7710@kroah.com>
[not found] ` <20050808.123209.59463259.davem@davemloft.net>
[not found] ` <20050808194249.GA6729@kroah.com>
[not found] ` <Pine.LNX.4.58.0508081249110.3258@g5.osdl.org>
2005-08-08 19:57 ` "git revert" (Re: pci_update_resource() getting called on sparc64) Linus Torvalds
2005-08-08 20:47 ` Junio C Hamano [this message]
2005-08-08 20:59 ` Linus Torvalds
2005-08-08 21:23 ` Junio C Hamano
2005-08-08 21:30 ` git-commit-script, was " Johannes Schindelin
2005-08-08 21:47 ` Junio C Hamano
2005-08-08 22:01 ` Linus Torvalds
2005-08-08 22:57 ` Junio C Hamano
2005-08-08 21:58 ` Linus Torvalds
2005-08-08 22:47 ` Junio C Hamano
2005-08-09 0:03 ` Johannes Schindelin
2005-08-09 0:13 ` Johannes Schindelin
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=7vd5oo40mq.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=git@vger.kernel.org \
--cc=torvalds@osdl.org \
/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).