From: Johan Herland <johan@herland.net>
To: git@vger.kernel.org
Subject: [RFC?] Telling git about more complex relationships between commits (Was: Re: FFmpeg considering GIT)
Date: Fri, 04 May 2007 09:21:29 +0200 [thread overview]
Message-ID: <200705040921.33443.johan@herland.net> (raw)
In-Reply-To: <200705040242.46156.jnareb@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4036 bytes --]
On Friday 04 May 2007, Jakub Narebski wrote:
> Besides I think it would be better to teach blame to ignore reversion
> commits (for example based on first line of commit message) than to
> mess with the history.
I'm starting to see a pattern where people would like to tell git about
more complicated relationships between commits, so that git can make
more intelligent decisions when doing merge, blame, pickaxe, etc.
Adding these relationships as part of the commit message seems like a
really stupid idea because git suddenly has to make sense of something
it has never parsed before, thus making all future and former git
commit messages a potential target for pattern (mis)matching by git.
Also, we seem to forget that we already have the perfect place to put
such information: The header fields preceding the commit message.
I therefore propose adding header field names to commit objects that
illustrate the relationships people want to tell git about. Examples
include:
1. "Reverts": Mark a commit as reverting another commit. This could be
used by git-log to cancel out pairs of commits, resulting in a cleaner
view of history. It can help blame/annotate. There are probably other
tools that can benefit from this information also.
2. "Cherry-Pick": When cherry-picking a commit onto another branch, you
should be able to tell git which commit you are cherry-picking
(git-cherry-pick would of course do this automatically). This could
enable git to make smarter decisions when merging the two branches: If
the cherry-picked commit would cause a conflict with the original
commit, git can either skip it (since it knows that one version of this
patch is already present), or it can at least present the conflict to
the user with some more context than what is available today. Not to
mention how this information could be used by blame/annotate.
3. "Rebased-From": This one can be filled in automatically by
git-rebase, but when I think about it, it may be too similar
to "Cherry-Pick" to warrant a separate field.
4. "Rebased-To": When doing a rebase like the following:
A---B---C---D---E <--- branch
(Hmm. C is broken. Rebase D and E onto B)
A---B---C---D---E
\
\--D'--E' <--- branch
git-rebase could now add a dummy commit F* to E with "Rebased-To:
{Commit ID of D'}", thus making:
A---B---C---D---E---F*..
\ ,............: (yes, this is a poorly drawn meta-arrow)
\ v
\--D'--E' <--- branch
This would make it easier for git to do the Right Thing when someone
following the old branch tries to pull after the rebase.
5. Heck, while we're at it, move "Signed-off-by" into the header fields,
where git can make more use of it.
6. Finally, allow people to add custom header fields prefixed by "X-"
(like in HTTP), and make it easy for them to extend git tools to use
these custom fields in various ways. If some of them end up being
really useful, we can import them into git (and lose the "X-" prefix).
Now, in order to let people specify these fields we probably want to
make these fields names settable from the command line. It should also
be possible to use a template when doing the commit message in an
editor. Something like:
==========
Optional headers fields (fill in if applicable)
Cherry-Pick: ________
Reverts: ________
Signed-Off-By: ________
Your commit message goes here:
________________________________
==========
Of course, git would have to verify/sanitize these fields when input, so
they probably need some type information associated with them.
Furthermore we might want to think about the possibility of allowing
annotations to previous commits, in order to allow these fields to be
set after the commit has happened, but that's a topic for a
whole 'nother discussion.
Have fun!
...Johan
--
Johan Herland, <johan@herland.net>
www.herland.net
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2007-05-04 7:21 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-02 9:29 FFmpeg considering GIT Panagiotis Issaris
2007-05-02 23:48 ` Jakub Narebski
2007-05-03 1:03 ` Petr Baudis
2007-05-04 0:42 ` Jakub Narebski
2007-05-04 7:21 ` Johan Herland [this message]
2007-05-04 9:36 ` [RFC?] Telling git about more complex relationships between commits (Was: Re: FFmpeg considering GIT) Alex Riesen
2007-05-04 11:39 ` Andy Parkins
2007-05-04 12:06 ` Andrew Ruder
2007-05-04 12:30 ` Johan Herland
2007-05-04 11:53 ` Johan Herland
2007-05-04 22:11 ` Alex Riesen
2007-05-05 12:49 ` Johan Herland
2007-05-05 18:03 ` Alex Riesen
2007-05-05 16:13 ` Johan Herland
2007-05-04 11:10 ` Petr Baudis
2007-05-04 12:22 ` Johan Herland
2007-05-03 1:48 ` FFmpeg considering GIT Martin Langhoff
2007-05-03 18:00 ` Uwe Kleine-König
2007-05-03 20:00 ` Petr Baudis
2007-05-03 20:05 ` david
2007-05-03 20:13 ` Petr Baudis
2007-05-04 13:46 ` Michael Niedermayer
2007-05-04 15:53 ` Andy Parkins
2007-05-04 16:09 ` Johannes Sixt
2007-05-04 17:23 ` Florian Weimer
2007-05-04 16:40 ` Nicolas Pitre
2007-05-04 18:17 ` Carl Worth
2007-05-04 18:25 ` Johan Herland
2007-05-04 20:24 ` Michael Niedermayer
2007-05-05 4:15 ` Linus Torvalds
2007-05-05 13:35 ` Karl Hasselström
2007-05-05 17:26 ` Linus Torvalds
2007-05-05 22:18 ` Linus Torvalds
2007-05-05 22:30 ` Linus Torvalds
2007-05-06 7:49 ` Junio C Hamano
2007-05-07 12:13 ` Paul Mackerras
2007-05-07 12:30 ` Karl Hasselström
2007-05-07 12:50 ` Johan Herland
2007-05-07 12:56 ` Alex Riesen
2007-05-08 6:30 ` Marco Costalba
2007-05-09 4:28 ` Paul Mackerras
2007-05-09 6:38 ` Marco Costalba
2007-05-09 18:17 ` Robin Rosenberg
2007-05-09 18:28 ` Jan Hudec
2007-05-09 21:09 ` Fredrik Kuivinen
2007-05-09 21:36 ` Jan Hudec
2007-05-10 11:20 ` Marco Costalba
2007-05-10 16:52 ` Jan Hudec
2007-05-07 17:52 ` Jan Hudec
2007-05-07 22:10 ` Gábor Farkas
2007-05-07 23:21 ` Randal L. Schwartz
[not found] ` <fcaeb9bf0705080707x7ad28afelf98ecd93276042d1@mail.gmail.com>
2007-05-08 15:53 ` Gábor Farkas
2007-05-07 19:10 ` Junio C Hamano
2007-05-08 2:03 ` Shawn O. Pearce
2007-05-08 7:26 ` Jeff King
2007-05-06 7:56 ` Karl Hasselström
2007-05-06 10:19 ` Karl Hasselström
2007-05-06 16:38 ` Linus Torvalds
2007-05-06 8:15 ` Marco Costalba
2007-05-06 11:14 ` Karl Hasselström
2007-05-06 12:19 ` Marco Costalba
2007-05-06 12:33 ` Karl Hasselström
2007-05-06 12:33 ` Marco Costalba
2007-05-06 12:59 ` Karl Hasselström
2007-05-06 13:03 ` Karl Hasselström
2007-05-09 22:30 ` Pavel Roskin
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=200705040921.33443.johan@herland.net \
--to=johan@herland.net \
--cc=git@vger.kernel.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).