From: Linus Torvalds <torvalds@osdl.org>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: Shawn Pearce <spearce@spearce.org>, git@vger.kernel.org
Subject: Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
Date: Thu, 2 Mar 2006 15:27:24 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0603021521250.22647@g5.osdl.org> (raw)
In-Reply-To: <20060302220930.GE6183@steel.home>
On Thu, 2 Mar 2006, Alex Riesen wrote:
> Shawn Pearce, Thu, Mar 02, 2006 17:55:10 +0100:
>
> > I've been using the Cygwin Perl with GIT without any problems
> > whatsoever. Including the open(I, "-|")... exec(@argv) code that
> > doesn't work correctly in ActiveState and started this whole thread.
>
> Unfortunately...
Here's a stupid first cut at git-fmt-merge-msg in C using the new revlist
library interface.
It's not actually doing exactly the same thing, because I'm a lazy
bastard, but some things it does better.
For example, afaik, when merging multiple branches that had partially been
merged already (ie they had overlapping new stuff), if I read the old perl
code correctly, it would talk about the new stuff multiple times. This one
doesn't.
The things it doesn't do:
- the old one had a limit of 20, the new one has a limit of 10 commits
reported
- the old one was tested, the new one is written by me.
- the old one honored the "merge.summary" git config option. The new one
doesn't.
- the old one did some formatting of the branch message that I don't
follow because I'm not a perl user. The new one just takes the
explanatory message for the branch merging as-is.
But hey, this is all part of my cunning plan to make people get involved
with the new rev-list libification, by giving them things that _almost_
work, but might need some tweaking.
Linus
--- snip snip for "fmt-merge-msg.c" snip snip---
/*
* fmt-merge-msg.c
*
* Magic auto-generation of merge messages.
*
* Copyright (C) 2006 Linus Torvalds and his army of programming ferrets
*/
#include "cache.h"
#include "commit.h"
#include "revision.h"
static void show_commit(struct commit *commit)
{
char buffer[256];
pretty_print_commit(CMIT_FMT_ONELINE, commit, ~0, buffer, sizeof(buffer), 0);
printf(" * %s\n", buffer);
}
int main(int argc, char **argv)
{
struct rev_info revs;
struct commit *commit;
unsigned char sha1[20];
char buffer[256];
setup_revisions(0, NULL, &revs, NULL);
if (get_sha1("HEAD", sha1) < 0)
die("no HEAD revision");
commit = lookup_commit_reference(sha1);
if (!commit)
die("no HEAD revision");
commit->object.flags |= UNINTERESTING;
insert_by_date(commit, &revs.commits);
revs.topo_order = 1;
revs.limited = 1;
while (fgets(buffer, sizeof(buffer), stdin)) {
int max;
char *marker;
if (get_sha1_hex(buffer, sha1) < 0)
continue;
commit = lookup_commit_reference(sha1);
if (!commit)
continue;
/*
* Format after the SHA1:
* <tab>marker<tab><type>'<name>' of <src>'
*
* where string is "not-for-merge" if
* we're not interested in this one,
* and empty otherwise.
*/
marker = buffer + 40;
if (*marker++ != '\t')
continue;
if (*marker++ != '\t')
continue;
printf("Merge %s", marker);
insert_by_date(commit, &revs.commits);
prepare_revision_walk(&revs);
max = 10;
while ((commit = get_revision(&revs)) != NULL) {
int n = --max;
if (n > 0)
show_commit(commit);
else if (!n)
printf(" ...");
}
}
}
next prev parent reply other threads:[~2006-03-02 23:27 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-02 16:44 [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6 Christopher Faylor
2006-03-02 16:55 ` Shawn Pearce
2006-03-02 22:09 ` Alex Riesen
2006-03-02 23:27 ` Linus Torvalds [this message]
2006-03-03 0:34 ` Junio C Hamano
2006-03-03 0:49 ` Linus Torvalds
2006-03-03 1:25 ` Junio C Hamano
2006-03-03 1:52 ` Linus Torvalds
2006-03-03 0:14 ` Christopher Faylor
2006-03-02 17:33 ` Johannes Schindelin
-- strict thread matches above, loose matches on Subject: below --
2006-02-20 18:37 Should we support Perl 5.6? Johannes Schindelin
2006-02-20 19:10 ` Eric Wong
2006-02-20 22:05 ` [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6 Junio C Hamano
2006-02-21 17:30 ` Alex Riesen
2006-02-21 20:36 ` Sam Vilain
2006-02-21 21:57 ` Alex Riesen
2006-02-21 22:19 ` Johannes Schindelin
2006-02-21 22:35 ` Eric Wong
2006-02-21 22:38 ` Shawn Pearce
2006-02-21 23:00 ` Martin Langhoff
2006-02-21 22:38 ` Sam Vilain
2006-02-22 16:35 ` Alex Riesen
2006-02-22 19:44 ` Johannes Schindelin
2006-02-22 19:51 ` Sam Vilain
2006-02-22 19:54 ` Junio C Hamano
2006-02-22 22:00 ` Johannes Schindelin
2006-02-22 22:25 ` Junio C Hamano
2006-02-23 8:00 ` Alex Riesen
2006-02-23 8:45 ` Junio C Hamano
2006-02-23 9:35 ` Alex Riesen
2006-02-23 9:41 ` Alex Riesen
2006-02-23 9:48 ` Andreas Ericsson
2006-02-23 10:10 ` Alex Riesen
2006-02-23 13:29 ` Andreas Ericsson
2006-02-23 14:07 ` Alex Riesen
2006-02-23 14:22 ` Andreas Ericsson
2006-02-23 17:13 ` Linus Torvalds
2006-02-23 19:32 ` Junio C Hamano
2006-02-23 19:38 ` Johannes Schindelin
2006-02-23 19:54 ` Linus Torvalds
2006-02-23 20:19 ` Johannes Schindelin
2006-02-23 19:51 ` Linus Torvalds
2006-02-23 20:31 ` Sam Vilain
2006-02-24 6:43 ` Linus Torvalds
2006-02-23 21:43 ` Alex Riesen
2006-02-26 19:55 ` Christopher Faylor
2006-02-26 20:18 ` Linus Torvalds
2006-02-26 20:40 ` Christopher Faylor
2006-03-02 14:18 ` Alex Riesen
2006-03-02 15:18 ` Mark Wooding
2006-03-02 16:11 ` Alex Riesen
2006-03-02 15:22 ` Christopher Faylor
2006-03-02 16:20 ` Alex Riesen
2006-03-02 14:10 ` Alex Riesen
2006-03-02 15:00 ` Christopher Faylor
2006-03-02 16:10 ` Alex Riesen
2006-03-02 17:39 ` Andreas Ericsson
2006-03-02 22:01 ` Alex Riesen
2006-02-26 20:33 ` Christopher Faylor
2006-02-24 12:02 ` Eric Wong
2006-02-24 13:44 ` Johannes Schindelin
2006-02-24 16:14 ` Linus Torvalds
2006-02-21 20:56 ` Eric Wong
2006-02-21 22:04 ` Alex Riesen
[not found] ` <1cf1c57a0602211412r1988b14ao435edd29207dc0d0@mail.gmail.com>
2006-02-21 22:13 ` Ron Parker
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=Pine.LNX.4.64.0603021521250.22647@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=git@vger.kernel.org \
--cc=raa.lkml@gmail.com \
--cc=spearce@spearce.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 read-only IMAP folder(s) and NNTP newsgroup(s).