* Re: git-svn and Author files question
From: Rutger Nijlunsing @ 2006-04-15 9:25 UTC (permalink / raw)
To: Seth Falcon; +Cc: git
In-Reply-To: <m21wvzx5e6.fsf@ziti.fhcrc.org>
On Fri, Apr 14, 2006 at 01:34:57PM -0700, Seth Falcon wrote:
> Hi all,
>
> I've been using git to manually track changes to a project that uses
> svn as its primary SCM.
>
> git-svn looks like it can help me streamline my workflow, but I'm
> getting stuck with the following:
>
> mkdir foo
> cd foo
> git-svn init $URL <--- the svn URL
> git-svn fetch
> Author: dfcimm3 not defined in file
>
> :-(
>
> Can someone point me to the file and the place that describes what I
> should put in it? There are many committers to the svn project. I'm
> hoping that I will not have to enumerate all of their names in some
> file.
I'm not familiar with git-svn, but the $GIT_DIR/svn-authors file used
by git-svnimport.perl and
http://www.wingding.demon.nl/git-svnconvert.rb contains lines like:
svn-author = Full Name <email@domain>
And yes, you've got to enumerate the names you want
transformed. Another option is to give no authors, but then the SVN
author names will be used (with email 'unknown' or something).
--
Rutger Nijlunsing ---------------------------------- eludias ed dse.nl
never attribute to a conspiracy which can be explained by incompetence
----------------------------------------------------------------------
^ permalink raw reply
* [PATCH] diff-options: add --patch-with-stat
From: Johannes Schindelin @ 2006-04-15 11:41 UTC (permalink / raw)
To: git, junkio
With this option, git prepends a diffstat in front of the patch.
Since I really, really do not know what a diffstat of a combined diff
("merge diff") should look like, the diffstat is not generated for these.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
Buggeth, and you shall be given.
BTW I really would like to have a diffstat for combined diffs.
Any ideas?
Documentation/diff-options.txt | 3 +++
diff.c | 17 ++++++++++++++++-
diff.h | 3 +++
3 files changed, 22 insertions(+), 1 deletions(-)
c06cf94fe5a2f0b004e7b46c0322554e7ec4ff99
diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
index 447e522..c183dc9 100644
--- a/Documentation/diff-options.txt
+++ b/Documentation/diff-options.txt
@@ -10,6 +10,9 @@
--stat::
Generate a diffstat instead of a patch.
+--patch-with-stat::
+ Generate patch and prepend its diffstat.
+
-z::
\0 line termination on output
diff --git a/diff.c b/diff.c
index f1b672d..1b33465 100644
--- a/diff.c
+++ b/diff.c
@@ -1049,6 +1049,10 @@ int diff_opt_parse(struct diff_options *
}
else if (!strcmp(arg, "--stat"))
options->output_format = DIFF_FORMAT_DIFFSTAT;
+ else if (!strcmp(arg, "--patch-with-stat")) {
+ options->output_format = DIFF_FORMAT_PATCH;
+ options->with_stat = 1;
+ }
else if (!strcmp(arg, "-z"))
options->line_termination = 0;
else if (!strncmp(arg, "-l", 2))
@@ -1518,7 +1522,7 @@ void diff_flush(struct diff_options *opt
int diff_output_format = options->output_format;
struct diffstat_t *diffstat = NULL;
- if (diff_output_format == DIFF_FORMAT_DIFFSTAT) {
+ if (diff_output_format == DIFF_FORMAT_DIFFSTAT || options->with_stat) {
diffstat = xcalloc(sizeof (struct diffstat_t), 1);
diffstat->xm.consume = diffstat_consume;
}
@@ -1530,6 +1534,17 @@ void diff_flush(struct diff_options *opt
}
putchar(options->line_termination);
}
+ if (options->with_stat) {
+ for (i = 0; i < q->nr; i++) {
+ struct diff_filepair *p = q->queue[i];
+ flush_one_pair(p, DIFF_FORMAT_DIFFSTAT, options,
+ diffstat);
+ }
+ show_stats(diffstat);
+ free(diffstat);
+ diffstat = NULL;
+ putchar(options->line_termination);
+ }
for (i = 0; i < q->nr; i++) {
struct diff_filepair *p = q->queue[i];
flush_one_pair(p, diff_output_format, options, diffstat);
diff --git a/diff.h b/diff.h
index 2f8aff2..f783bae 100644
--- a/diff.h
+++ b/diff.h
@@ -25,6 +25,7 @@ struct diff_options {
const char *pickaxe;
unsigned recursive:1,
with_raw:1,
+ with_stat:1,
tree_in_recursive:1,
full_index:1;
int break_opt;
@@ -120,6 +121,8 @@ #define COMMON_DIFF_OPTIONS_HELP \
" --patch-with-raw\n" \
" output both a patch and the diff-raw format.\n" \
" --stat show diffstat instead of patch.\n" \
+" --patch-with-stat\n" \
+" output a patch and prepend its diffstat.\n" \
" --name-only show only names of changed files.\n" \
" --name-status show names and status of changed files.\n" \
" --full-index show full object name on index lines.\n" \
--
1.3.0.rc4.ga1167e-dirty
^ permalink raw reply related
* Re: Recent unresolved issues
From: Johannes Schindelin @ 2006-04-15 11:46 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk69ri5cp.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 15 Apr 2006, Junio C Hamano wrote:
> Honestly, the longer I look at it, the more I feel that this way
> might break more things than it fixes. I haven't even looked at
> blame.c or http-push.c to see what's broken yet.
I do not have time to look at this closely, but it sounds to me like you
need a two-stage approach:
setup_diff_options(&options);
[... set defaults ...]
handle_cmdline_arguments(&options);
[... possibly check if the user overrode some defaults ...]
I think that the unified option parsing is the right approach.
Ciao,
Dscho
^ permalink raw reply
* Re: [WISH] prepend diffstat in front of the patch
From: Johannes Schindelin @ 2006-04-15 11:48 UTC (permalink / raw)
To: Marco Costalba; +Cc: git
In-Reply-To: <e5bfff550604150207h6fdb0042x3a9bbfa63269a8c8@mail.gmail.com>
Hi,
On Sat, 15 Apr 2006, Marco Costalba wrote:
> Perhaps I missed something, but I would like to see --stat and -p as
> _cumulative_ options .
>
> Would be great if git-diff-tree -r -c --stat -p 84981f9 prepends
> diffstat in front of the patch as Junio suggested some days ago.
>
> Is it already planned?
We are a little impatient, aren't we?
Anyway, as you probably saw already, I sent out a patch which does that. I
wanted to wait a little to introduce it, because I had the feeling that
the option parsing would be volatile for a few days.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] diff-options: add --patch-with-stat
From: Marco Costalba @ 2006-04-15 11:50 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git, junkio
In-Reply-To: <Pine.LNX.4.63.0604151340210.24303@wbgn013.biozentrum.uni-wuerzburg.de>
On 4/15/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> With this option, git prepends a diffstat in front of the patch.
>
Thanks! qgit will set this as default!
>
> Buggeth, and you shall be given.
>
> BTW I really would like to have a diffstat for combined diffs.
> Any ideas?
>
Well..hem..why do not count the (shifted) + and - in the combined diffs ouput?
I suspect this can be a total idiocy, but now I'm missing why. :-)
Marco
^ permalink raw reply
* Re: [WISH] prepend diffstat in front of the patch
From: Johannes Schindelin @ 2006-04-15 11:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vejzzi4ft.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 15 Apr 2006, Junio C Hamano wrote:
> [... speaking about --patch-with-stat ...]
>
> It is also what I want, but there is only 24 hours in a day and
> there is this thing called day-job.
I want to add that there is a real life also, and that in a few parts of
this lovely world, there is Easter right now.
And most importantly: an itch like that is a great opportunity for
non-veterans to get involved with git.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] diff-options: add --patch-with-stat
From: Johannes Schindelin @ 2006-04-15 11:56 UTC (permalink / raw)
To: Marco Costalba; +Cc: git
In-Reply-To: <e5bfff550604150450u37ce1660u2db4f6e97c586e13@mail.gmail.com>
Hi,
On Sat, 15 Apr 2006, Marco Costalba wrote:
> On 4/15/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > BTW I really would like to have a diffstat for combined diffs.
> > Any ideas?
>
> Well..hem..why do not count the (shifted) + and - in the combined diffs
> ouput?
This does not help. The combined diff is so useful, because it contains
the information as to which parent has this difference, and which parent
has not.
By just counting the plusses and minusses, this information is filtered
out.
Ciao,
Dscho
^ permalink raw reply
* log/diff option parsing unification
From: Junio C Hamano @ 2006-04-15 12:04 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
Linus,
I kept your log/diff option parsing stuff with a few fixups for
about 3 hours in the "next" branch, but dropped and replaced
them with an alternative with lesser impact. I freely admit
that what you write is nicer and cleaner than what I do 99.9% of
the time, but I think this time it is justified. We have been
telling people that their scripts can expect certain output
format out of the lowest level Plumbing such as rev-list and
diff-tree. I just do not want to break it, and doing things
with very unified way seemed to be too much hassle to keep
everything compatible.
On the other hand, I am much more relaxed if 'git-log' and
'git-whatchanged' output are not bit-for-bit identical to their
shell script versions. You (not "Linus, you" but figuratively
you) would be crazy if you have been feeding their output to
your own scripts with such an expectation. The rule-of-thumb I
apply here is that anything that has built-in pager is primarily
for human consumption, and the stability of its output format is
a fair game, especially when the modified behaviour results in
better output for humans.
I might regret this later when we try to do the internal "git
diff", but it is already tomorrow morning now, so I'll crash
first.
This option parsing unification will be post 1.3.0, but it is
important enough that I suspect it will be the first topic to be
merged and disrupt the "master" branch for a while after 1.3.0.
^ permalink raw reply
* Re: [WISH] prepend diffstat in front of the patch
From: Junio C Hamano @ 2006-04-15 12:12 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0604151346270.25269@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> Anyway, as you probably saw already, I sent out a patch which does that. I
> wanted to wait a little to introduce it, because I had the feeling that
> the option parsing would be volatile for a few days.
Thanks for the consideration, but that's what topic branches are
for ;-).
Seriously, even the unified one (either Linus's or mine) handed
diff option parsing to an established function that is identical
to the "master" version, so the --patch-with-stat is probably a
no-impact merge.
JC "What's Easter" Hamano ;-)
^ permalink raw reply
* Re: [WISH] prepend diffstat in front of the patch
From: Johannes Schindelin @ 2006-04-15 12:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vfykfghqs.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 15 Apr 2006, Junio C Hamano wrote:
> JC "What's Easter" Hamano ;-)
Just for the record: According to Douglas Adams, nearly two thousand years
ago, one man has been nailed to a tree for saying how great it would be to
be nice to people for a change. That's what Christians try to remember on
Easter.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] diff-options: add --patch-with-stat
From: Junio C Hamano @ 2006-04-15 12:33 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0604151340210.24303@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> BTW I really would like to have a diffstat for combined diffs.
> Any ideas?
While I think combined diffs are somewhat overrated, I think
what makes some sense would be to count --cc output for each
parent's column, and show something like this:
Makefile | +- +-
debian/changelog | ++++++ ++++++++++++++++++++
2 files changed, 7 and 91 insertions(+), 1 and 0 deletions(-)
This is for "diff-tree --cc v1.0.0"; the hand-merge (or evil
merge) changed from first parent 7(+),1(-) and from second
parent 91(+),0(-) respectively.
Count the maximum change per each parent (the above example the
second file has the max for both parents but that may not always
be the case), add them up to determine how many columns to
allocate for each parent (while taking one column gap between
each parent into account) and draw normally.
The code that counted this (I did not write code to draw it) is
like this:
-- >8 --
#!/usr/bin/perl
use strict;
my $filename;
my $num_parents = -1;
my %stat;
while (<>) {
chomp;
if (/^diff --cc (.*)$/) {
$filename = $1;
$stat{$filename} = undef;
next;
}
if (/^(\@+) [-+0-9, ]* \1$/) {
$num_parents = length($1) - 1;
next;
}
next unless (/^([- +]{$num_parents})/);
my @pfx = split('', $1);
if (!defined $stat{$filename}) {
$stat{$filename} = [];
for (my $i = 0; $i < $num_parents; $i++) {
push @{$stat{$filename}}, [0, 0];
}
}
for (my $i = 0; $i < $num_parents; $i++) {
if ($pfx[$i] eq '+') {
$stat{$filename}[$i][0]++;
}
if ($pfx[$i] eq '-') {
$stat{$filename}[$i][1]++;
}
}
}
for my $filename (sort keys %stat) {
print "$filename ";
for (my $i = 0; $i < $num_parents; $i++) {
printf " +%d/-%d",
$stat{$filename}[$i][0], $stat{$filename}[$i][1];
}
print "\n";
}
^ permalink raw reply
* Re: [PATCH] diff-options: add --patch-with-stat
From: Johannes Schindelin @ 2006-04-15 12:37 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v64lbggrd.fsf@assigned-by-dhcp.cox.net>
Hi,
On Sat, 15 Apr 2006, Junio C Hamano wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > BTW I really would like to have a diffstat for combined diffs.
> > Any ideas?
>
> While I think combined diffs are somewhat overrated, I think
> what makes some sense would be to count --cc output for each
> parent's column, and show something like this:
>
> Makefile | +- +-
> debian/changelog | ++++++ ++++++++++++++++++++
> 2 files changed, 7 and 91 insertions(+), 1 and 0 deletions(-)
Okay. That is a start, altough it will look funny with 12 parents...
I'll do some hacking while you're sleeping.
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] diff-options: add --patch-with-stat
From: Marco Costalba @ 2006-04-15 13:01 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0604151436280.6147@wbgn013.biozentrum.uni-wuerzburg.de>
On 4/15/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Sat, 15 Apr 2006, Junio C Hamano wrote:
>
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> > > BTW I really would like to have a diffstat for combined diffs.
> > > Any ideas?
> >
Just another idea, from current git:
$ git-diff-tree -r -m --stat 4da8cbc23
4da8cbc234177d6a8cf749d4ef60bd05ec843898
---
blame.c | 20 ++++++++++++++------
diff-tree.c | 2 +-
diff.h | 6 +++++-
git.c | 15 +++++++++++++--
http-push.c | 1 +
rev-list.c | 1 +
revision.c | 26 ++++++++++++--------------
revision.h | 7 +++++--
tree-diff.c | 46 +++++++++++++++++++++++++---------------------
9 files changed, 77 insertions(+), 47 deletions(-)
4da8cbc234177d6a8cf749d4ef60bd05ec843898
---
Documentation/diff-options.txt | 3 +
Documentation/git-apply.txt | 8 ++-
Makefile | 14 ++++-
apply.c | 123 ++++++++++++++++++++++++++++++++++------
combine-diff.c | 12 ++++
diff.c | 83 ++++++++++++++++-----------
diff.h | 3 +
http-fetch.c | 8 +--
http-push.c | 6 +-
9 files changed, 199 insertions(+), 61 deletions(-)
$ git-diff-tree -r -c 4da8cbc23
4da8cbc234177d6a8cf749d4ef60bd05ec843898
::100644 100644 100644 c5372b984a457d0e5bddcf0b334a1a3cdc149cec
cc7cc627c88d135c3f8d814449813e73c1ea3430
236095fc9a1a6ffc056be8616c0f83e4e8c7ec2f MM diff.h
::100644 100644 100644 994ee90035c4ae5e055df79cea8621d294190a3f
aa0bc1f6f6a51fb39d54dc81b93805f86d19aa46
19a0f772e7bf729755c66ab38f5dfb64ae784f00 MM http-push.c
PROPOSED OUTPUT:
$ git-diff-tree -r -c --stat 4da8cbc23
4da8cbc234177d6a8cf749d4ef60bd05ec843898
---
diff.h | 6 +++++-
http-push.c | 1 +
2 files changed, 6 insertions(+), 1 deletions(-)
4da8cbc234177d6a8cf749d4ef60bd05ec843898
---
diff.h | 3 +++
http-push.c | 6 +++---
2 files changed, 6 insertions(+), 3 deletions(-)
I agree Junio ouput is nicer, this one is perhaps more consistent with
git-diff-tree -m --stat output.
Marco
^ permalink raw reply
* [RFC/PATCH] pager: do not fork a pager if environment variable PAGER is set to NONE
From: Johannes Schindelin @ 2006-04-15 13:16 UTC (permalink / raw)
To: git
This helps debugging tremendously.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
| 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
a91a9371e117555a03cfe7d24515787fb13005b6
--git a/pager.c b/pager.c
index 1364e15..1136adf 100644
--- a/pager.c
+++ b/pager.c
@@ -5,9 +5,8 @@ #include "cache.h"
* something different on Windows, for example.
*/
-static void run_pager(void)
+static void run_pager(const char *prog)
{
- const char *prog = getenv("PAGER");
if (!prog)
prog = "less";
setenv("LESS", "-S", 0);
@@ -16,10 +15,11 @@ static void run_pager(void)
void setup_pager(void)
{
+ const char *prog = getenv("PAGER");
pid_t pid;
int fd[2];
- if (!isatty(1))
+ if (!isatty(1) || (prog != NULL && !strcmp(prog, "NONE")))
return;
if (pipe(fd) < 0)
return;
@@ -43,6 +43,6 @@ void setup_pager(void)
close(fd[0]);
close(fd[1]);
- run_pager();
+ run_pager(prog);
exit(255);
}
--
1.3.0.rc4.g667c
^ permalink raw reply related
* Re: Test fails on ubuntu breezy
From: Aneesh Kumar @ 2006-04-15 15:43 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbqv3jo77.fsf@assigned-by-dhcp.cox.net>
On 4/15/06, Junio C Hamano <junkio@cox.net> wrote:
> "Aneesh Kumar" <aneesh.kumar@gmail.com> writes:
>
> > I am still having failure with the top of the tree. I guess it is
> > because git rm exit with status 0.
>
> Please don't guess, but validate (I know you are capable of
> doing so).
>
>
I did :). I sent another mail explaining it is xargs in breezy. I also
filed a bug. But they are not going to fix it in breezy. The below is
the response i got.
"As Ubuntu Breezy is a released probuct, only security-related fixes
are accepted. If you think this fix is important enough, you could
discuss the issue with the maintainers of Ubuntu backports, and see if
they are interested in making a backport available: "
Right now i am commenting out the test case to build the .deb file.
-aneesh
^ permalink raw reply
* Help please :-)
From: Paolo Ciarrocchi @ 2006-04-15 16:08 UTC (permalink / raw)
To: Git Mailing List
Hi all,
I'm used to keep updated my linux tree with cg-status,
I did that this morning but now I see the following:
paolo@Italia:~/linux-2.6$ cg-status
Heads:
>master 2c5362007bc0a46461a9d94958cdd53bb027004c
R origin 2c5362007bc0a46461a9d94958cdd53bb027004c
? arch/i386/kernel/smpboot.c.rej
? drivers/md/dm-stripe.c.rej
? drivers/net/chelsio/sge.c.rej
? drivers/net/e100.c.rej
? drivers/net/e1000/e1000_main.c.rej
? fs/9p/vfs_dir.c.rej
? fs/nfsctl.c.rej
? kernel/fork.c.rej
? kernel/posix-timers.c.rej
? kernel/timer.c.rej
? mm/memory.c.rej
? mm/mempolicy.c.rej
? mm/swap.c.rej
? net/ieee80211/ieee80211_crypt_ccmp.c.rej
? net/ieee80211/ieee80211_rx.c.rej
? scripts/kconfig/lkc_defs.h
? scripts/mod/modpost.c.rej
paolo@Italia:~/linux-2.6$ cg-diff
I'm a bit lost, the tree is correctly updated, no error message but
why I see all these .rej?
And how can I fix this problem?
git reset and cg-reset don't help...
Thanks!
--
Paolo
http://paolociarrocchi.googlepages.com
^ permalink raw reply
* Re: Recent unresolved issues
From: Linus Torvalds @ 2006-04-15 16:59 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vk69ri5cp.fsf@assigned-by-dhcp.cox.net>
On Sat, 15 Apr 2006, Junio C Hamano wrote:
>
> Pain
>
> "git log" wants default abbrev (to show Merge: lines and
> "whatchanged -r" output compactly) while "git diff-tree -r" by
> default wants to show full SHA1 unless asked, which means
> "memset(revs, 0, sizeof(*revs))" in revision.c::init_revisions()
> needs to be defeated by the caller.
I'd suggest just moving the call to "init_revisions()" out from
"setup_revisions()" entirely.
So the calling sequence would be something like this:
init_revisions(&rev);
.. any localized setup ..
setup_revisions(&rev);
which isn't really all that painful, and allows us maximal flexibility for
different defaults etc.
Linus
^ permalink raw reply
* Re: Recent unresolved issues
From: Linus Torvalds @ 2006-04-15 17:17 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0604150958140.3701@g5.osdl.org>
On Sat, 15 Apr 2006, Linus Torvalds wrote:
>
> So the calling sequence would be something like this:
>
> init_revisions(&rev);
> .. any localized setup ..
> setup_revisions(&rev);
Btw, I can certainly understand if you don't want to do this before 1.3.x.
Since there's no actual user-visible advantage to it, it's probably worth
dropping for now.
Linus
^ permalink raw reply
* [WIP/PATCH] Combined diffstat
From: Johannes Schindelin @ 2006-04-15 18:08 UTC (permalink / raw)
To: git, junkio
I ended up implementing both proposals for merge diffstats:
Junio)
pack-objects.c | 923 ++++++++----- ++++++++++++++++++++++++++++------ +++--
rev-list.c | 5
send-pack.c | 86 +- +
upload-pack.c | 7
4 files changed, 786 insertions(+), 235 deletions(-)
Marco)
pack-objects.c | 22 ++++++++++++++--------
rev-list.c | 0
send-pack.c | 0
upload-pack.c | 0
4 files changed, 156 insertions(+), 86 deletions(-)
pack-objects.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++---------
send-pack.c | 4 +++-
upload-pack.c | 0
3 files changed, 532 insertions(+), 103 deletions(-)
pack-objects.c | 9 ++++++---
rev-list.c | 0
send-pack.c | 4 +++-
upload-pack.c | 0
4 files changed, 98 insertions(+), 46 deletions(-)
For the moment, I like Junio's better, if only because it was more difficult
to implement.
If you want to try it, I suggest using this as a test case:
git log --stat f0b0af1b04
To get the output with separate diffstats for each parent, just define the
environment variable NO_COMBINED_DIFFSTAT before calling git.
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
---
combine-diff.c | 271 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
diff.h | 1
log-tree.c | 6 +
3 files changed, 278 insertions(+), 0 deletions(-)
9e802df5d029d44938568060d4d567a4fd130d79
diff --git a/combine-diff.c b/combine-diff.c
index 9bd27f8..b82ee8c 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -148,6 +148,15 @@ static void append_lost(struct sline *sl
sline->lost_tail = &lline->next;
}
+struct diffstat_t {
+ struct diffstat_file {
+ char *name;
+ struct diffstat_parent {
+ unsigned int added, deleted;
+ } *parent;
+ } *files, *current;
+};
+
struct combine_diff_state {
struct xdiff_emit_state xm;
@@ -557,6 +566,35 @@ static void dump_sline(struct sline *sli
}
}
+static void diffstat_sline(struct diffstat_t *diffstat,
+ struct sline *sline, unsigned long cnt, int num_parent)
+{
+ struct diffstat_parent *data = diffstat->current->parent;
+ unsigned long interesting = (1UL<<num_parent);
+ int lno;
+ for (lno = 0; lno <= cnt; lno++) {
+ struct sline *sl = sline + lno;
+ struct lline *ll;
+ int j;
+
+ if (!(sl->flag & interesting))
+ continue;
+
+
+ for (ll = sl->lost_head; ll; ll = ll->next)
+ for (j = 0; j < num_parent; j++)
+ if (ll->parent_map & (1UL<<j))
+ data[j].deleted++;
+
+ if (cnt < lno)
+ break;
+
+ for (j = 0; j < num_parent; j++)
+ if (sl->flag & (1UL<<j))
+ data[j].added++;
+ }
+}
+
static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
int i, int j)
{
@@ -596,6 +634,7 @@ static int show_patch_diff(struct combin
int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
mmfile_t result_file;
+ struct diffstat_t *diffstat = opt->diffstat;
/* Read the result of merge first */
if (!working_tree_file)
@@ -686,6 +725,12 @@ static int show_patch_diff(struct combin
show_hunks = make_hunks(sline, cnt, num_parent, dense);
+ if (diffstat) {
+ diffstat->current->name = strdup(elem->path);
+ diffstat_sline(diffstat, sline, cnt, num_parent);
+ show_hunks = 0;
+ }
+
if (show_hunks || mode_differs || working_tree_file) {
const char *abb;
@@ -826,11 +871,213 @@ int show_combined_diff(struct combine_di
return 1;
default:
+ case DIFF_FORMAT_DIFFSTAT:
case DIFF_FORMAT_PATCH:
return show_patch_diff(p, num_parent, dense, header, opt);
}
}
+static const char pluses[] = "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++";
+static const char minuses[]= "----------------------------------------------------------------------";
+
+static void show_stats(struct diffstat_t *diffstat,
+ int num_paths, int num_parent)
+{
+ int show_combined_diffstat = (getenv("NO_COMBINED_DIFFSTAT") == NULL);
+ int i, j;
+ int max_length = 0, max_change = 0;
+ int *parent_max_change;
+ char *prefix = "";
+ int len, add, del, total, adds, dels, total_files, max;
+
+ if (num_paths == 0)
+ return;
+
+ parent_max_change = xcalloc(sizeof(int), num_parent);
+
+ for (i = 0; i < num_paths; i++) {
+ int len;
+ char *name = diffstat->files[i].name;
+ if (0 < (len = quote_c_style(name, NULL, NULL, 0))) {
+ char *qname = xmalloc(len + 1);
+ quote_c_style(name, qname, NULL, 0);
+ free(name);
+ diffstat->files[i].name = name = qname;
+ } else
+ len = strlen(name);
+
+ if (max_length < len)
+ max_length = len;
+
+ for (j = 0; j < num_parent; j++) {
+ struct diffstat_parent *data =
+ diffstat->files[i].parent + j;
+ int change = data->added + data->deleted;
+ if (parent_max_change[j] < change) {
+ parent_max_change[j] = change;
+ if (max_change < change)
+ max_change = change;
+ }
+ }
+ }
+
+ if (max_change == 0)
+ return;
+
+ printf("---\n");
+
+ if (show_combined_diffstat) {
+ char buffer[80];
+ max_change = 0;
+ for (j = 0; j < num_parent; j++)
+ max_change += parent_max_change[j];
+
+ prefix = "";
+ total_files = num_paths;
+ adds = dels = 0;
+
+ for (i = 0; i < num_paths; i++) {
+ int offset;
+ char *name = diffstat->files[i].name;
+
+ /*
+ * "scale" the filename
+ */
+ len = strlen(name);
+ max = max_length;
+ if (max > 50)
+ max = 50;
+ if (len > max) {
+ char *slash;
+ prefix = "...";
+ max -= 3;
+ name += len - max;
+ slash = strchr(name, '/');
+ if (slash)
+ name = slash;
+ }
+ len = max;
+
+ /*
+ * scale the add/delete
+ */
+ max = max_change + num_parent - 1;
+ if (max + len > 70)
+ max = 70 - len;
+
+ memset(buffer, ' ', 70);
+ buffer[max + 1] = 0;
+
+ max -= num_parent - 1;
+ offset = add = del = 0;
+ for (j = 0; j < num_parent; j++) {
+ struct diffstat_parent *data =
+ diffstat->files[i].parent + j;
+ int a, d, size;
+
+ size = max * parent_max_change[j] / max_change;
+ if (size == 0)
+ size = 1;
+
+ a = data->added;
+ d = a + data->deleted;
+
+ a = a * size / parent_max_change[j];
+ d = d * size / parent_max_change[j];
+
+ memset(buffer + offset, '+', a);
+ memset(buffer + offset + a, '-', d - a);
+
+ add += data->added;
+ del += data->deleted;
+
+ offset += size + 1;
+ }
+
+ if (add + del == 0) {
+ total_files--;
+ continue;
+ }
+
+ adds += add;
+ dels += del;
+
+ printf(" %s%-*s |%5d %s\n", prefix, len, name,
+ add + del, buffer);
+ }
+ printf(" %d files changed, %d insertions(+), %d deletions(-)\n",
+ total_files, adds, dels);
+ } else {
+ for (j = 0; j < num_parent; j++) {
+ prefix = "";
+ total_files = num_paths;
+ adds = dels = 0;
+
+ for (i = 0; i < num_paths; i++) {
+ char *name = diffstat->files[i].name;
+ struct diffstat_parent *data =
+ diffstat->files[i].parent + j;
+
+ /*
+ * "scale" the filename
+ */
+ len = strlen(name);
+ max = max_length;
+ if (max > 50)
+ max = 50;
+ if (len > max) {
+ char *slash;
+ prefix = "...";
+ max -= 3;
+ name += len - max;
+ slash = strchr(name, '/');
+ if (slash)
+ name = slash;
+ }
+ len = max;
+
+ /*
+ * scale the add/delete
+ */
+ max = max_change;
+ if (max + len > 70)
+ max = 70 - len;
+
+ add = data->added;
+ del = data->deleted;
+
+ if (add + del == 0) {
+ total_files--;
+ continue;
+ }
+
+ total = add + del;
+ adds += add;
+ dels += del;
+
+ if (max_change > 0) {
+ total = (total * max + max_change / 2) / max_change;
+ add = (add * max + max_change / 2) / max_change;
+ del = total - add;
+ }
+ printf(" %s%-*s |%5d %.*s%.*s\n", prefix,
+ len, name, add + del,
+ add, pluses, del, minuses);
+ }
+ printf(" %d files changed, %d insertions(+), %d deletions(-)\n\n",
+ total_files, adds, dels);
+ }
+ }
+
+ for (i = 0; i < num_paths; i++) {
+ free(diffstat->files[i].parent);
+ free(diffstat->files[i].name);
+ }
+ free(diffstat->files);
+ diffstat->files = NULL;
+ free(parent_max_change);
+}
+
const char *diff_tree_combined_merge(const unsigned char *sha1,
const char *header, int dense,
struct diff_options *opt)
@@ -840,6 +1087,11 @@ const char *diff_tree_combined_merge(con
struct commit_list *parents;
struct combine_diff_path *p, *paths = NULL;
int num_parent, i, num_paths;
+ struct diffstat_t *diffstat = NULL;
+
+ if (opt->output_format == DIFF_FORMAT_DIFFSTAT)
+ opt->diffstat = diffstat =
+ xcalloc(sizeof(struct diffstat_t), 1);
diffopts = *opt;
diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
@@ -870,6 +1122,15 @@ const char *diff_tree_combined_merge(con
num_paths++;
}
if (num_paths) {
+ if (diffstat) {
+ diffstat->files = xcalloc(sizeof(struct diffstat_file),
+ num_paths);
+ for (i = 0; i < num_paths; i++)
+ diffstat->files[i].parent =
+ xcalloc(sizeof(struct diffstat_parent),
+ num_parent);
+ diffstat->current = diffstat->files;
+ }
if (opt->with_raw) {
int saved_format = opt->output_format;
opt->output_format = DIFF_FORMAT_RAW;
@@ -882,12 +1143,22 @@ const char *diff_tree_combined_merge(con
putchar(opt->line_termination);
}
for (p = paths; p; p = p->next) {
+ if (p->len == 0)
+ continue;
if (show_combined_diff(p, num_parent, dense,
header, opt))
header = NULL;
+ if (diffstat)
+ diffstat->current++;
}
}
+ if (diffstat) {
+ show_stats(diffstat, num_paths, num_parent);
+ free(diffstat);
+ opt->diffstat = diffstat = NULL;
+ }
+
/* Clean things up */
while (paths) {
struct combine_diff_path *tmp = paths;
diff --git a/diff.h b/diff.h
index f783bae..26e3c02 100644
--- a/diff.h
+++ b/diff.h
@@ -45,6 +45,7 @@ struct diff_options {
int *pathlens;
change_fn_t change;
add_remove_fn_t add_remove;
+ struct diffstat_t *diffstat;
};
extern void diff_tree_setup_paths(const char **paths, struct diff_options *);
diff --git a/log-tree.c b/log-tree.c
index cb0d0b1..bb46f06 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -232,6 +232,12 @@ int parse_whatchanged_opt(int ac, const
opt->diffopt.output_format = DIFF_FORMAT_PATCH;
if (opt->diffopt.output_format == DIFF_FORMAT_PATCH)
opt->diffopt.recursive = 1;
+ if (opt->diffopt.output_format == DIFF_FORMAT_DIFFSTAT) {
+ opt->ignore_merges = 0;
+ opt->combine_merges = 1;
+ opt->dense_combined_merges = 1;
+ opt->diffopt.recursive = 1;
+ }
if (!wcopt->full_diff && rev->prune_data)
diff_tree_setup_paths(rev->prune_data, &opt->diffopt);
diff_setup_done(&opt->diffopt);
--
1.3.0.rc4.g667c
^ permalink raw reply related
* Support "git cmd --help" syntax
From: Linus Torvalds @ 2006-04-15 18:13 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
The "--help" argument is special, in that it is (along with "--version")
in that is taken by the "git" program itself rather than the sub-command,
and thus we've had the syntax "git --help cmd".
However, as anybody who has ever used CVS or some similar devil-spawn
program, it's confusing as h*ll when options before the sub-command act
differently from options after the sub-command, so this quick hack just
makes it acceptable to do "git cmd --help" instead, and get the exact same
result.
It may be hacky, but it's simple and does the trick.
Of course, this does not help if you use one of the non-builtin commands
without using the "git" helper. Ie you won't be getting a man-page just
because you do "git-rev-list --help". Don't expect us to be quite _that_
helpful.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
diff --git a/git.c b/git.c
index 78ed403..13c6d51 100644
--- a/git.c
+++ b/git.c
@@ -411,6 +411,12 @@ static void handle_internal_command(int
};
int i;
+ /* Turn "git cmd --help" into "git help cmd" */
+ if (argc > 1 && !strcmp(argv[1], "--help")) {
+ argv[1] = argv[0];
+ argv[0] = cmd = "help";
+ }
+
for (i = 0; i < ARRAY_SIZE(commands); i++) {
struct cmd_struct *p = commands+i;
if (strcmp(p->cmd, cmd))
^ permalink raw reply related
* Git web broken, or Linus' kernel tree in odd state
From: Tony Luck @ 2006-04-15 18:55 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
Git web is showing the "master" tag four commits back from HEAD on
the summary page for Linus' kernel tree, which is unusual (isn't it?).
I don't think that it is a mirror problem (it's been like it at least
an hour, and
shows the same at both www1 & www2.kernel.org)
http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=summary
-Tony
^ permalink raw reply
* Re: Git web broken, or Linus' kernel tree in odd state
From: Linus Torvalds @ 2006-04-15 19:03 UTC (permalink / raw)
To: Tony Luck; +Cc: Git Mailing List
In-Reply-To: <12c511ca0604151155j40c68a21qf684f77d2476605b@mail.gmail.com>
On Sat, 15 Apr 2006, Tony Luck wrote:
>
> Git web is showing the "master" tag four commits back from HEAD on
> the summary page for Linus' kernel tree, which is unusual (isn't it?).
Seems to be some gitweb caching problem.
> I don't think that it is a mirror problem (it's been like it at least
> an hour, and shows the same at both www1 & www2.kernel.org)
It's not a mirroring issue, because if you actually look at the "heads"
down at the same page, the "master" head points to the right commit (the
top one). As you can see just from the time ("17 hours ago" right now),
but also if you just go to the log through there.
Linus
^ permalink raw reply
* Tentative built-in "git show"
From: Linus Torvalds @ 2006-04-15 19:09 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
This uses the "--no-walk" flag that I never actually implemented (but I'm
sure I mentioned it) to make "git show" be essentially the same thing as
"git whatchanged --no-walk".
It just refuses to add more interesting parents to the revision walking
history, so you don't actually get any history, you just get the commit
you asked for.
I was going to add "--no-walk" as a real argument flag to git-rev-list
too, but I'm not sure anybody actually needs it. Although it might be
useful for porcelain, so I left the door open.
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
---
This is obviously against Junio's current "next" branch, which has the
log/whatchanged unification.
That special-case of
if (!strcmp(av[0], "show"...
is truly ugly, but it needs to happen after setup_revisions(), for all the
same reasons that I suggested it might be a good idea to split up
"init_revisions()" out of setup_revisions().
diff --git a/git.c b/git.c
index 939a34c..c87accf 100644
--- a/git.c
+++ b/git.c
@@ -363,6 +363,20 @@ static int cmd_whatchanged(int ac, const
return cmd_log_wc(ac, av, ep, &wcopt);
}
+static int cmd_show(int ac, const char **av, char **ep)
+{
+ struct whatchanged_opt wcopt;
+
+ memset(&wcopt, 0, sizeof(wcopt));
+ wcopt.do_diff = 1;
+ init_log_tree_opt(&wcopt.logopt);
+ wcopt.logopt.ignore_merges = 0;
+ wcopt.logopt.combine_merges = 1;
+ wcopt.logopt.dense_combined_merges = 1;
+ wcopt.logopt.diffopt.recursive = 1;
+ return cmd_log_wc(ac, av, ep, &wcopt);
+}
+
static void handle_internal_command(int argc, const char **argv, char **envp)
{
const char *cmd = argv[0];
@@ -373,6 +387,7 @@ static void handle_internal_command(int
{ "version", cmd_version },
{ "help", cmd_help },
{ "log", cmd_log },
+ { "show", cmd_show },
{ "whatchanged", cmd_whatchanged },
};
int i;
diff --git a/log-tree.c b/log-tree.c
index cb0d0b1..17e976a 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -182,6 +182,8 @@ int parse_whatchanged_opt(int ac, const
int left = 1;
ac = setup_revisions(ac, av, rev, "HEAD");
+ if (!strcmp(av[0], "show"))
+ rev->no_walk = 1;
while (1 < ac) {
const char *arg = av[1];
if (!strncmp(arg, "--pretty", 8)) {
diff --git a/log-tree.h b/log-tree.h
diff --git a/revision.c b/revision.c
index 0505f3f..0c3c392 100644
--- a/revision.c
+++ b/revision.c
@@ -375,6 +375,9 @@ static void add_parents_to_list(struct r
if (revs->prune_fn)
revs->prune_fn(revs, commit);
+ if (revs->no_walk)
+ return;
+
parent = commit->parents;
while (parent) {
struct commit *p = parent->item;
@@ -714,6 +717,8 @@ int setup_revisions(int argc, const char
void prepare_revision_walk(struct rev_info *revs)
{
+ if (revs->no_walk)
+ return;
sort_by_date(&revs->commits);
if (revs->limited)
limit_list(revs);
diff --git a/revision.h b/revision.h
index 8970b57..ff2a13e 100644
--- a/revision.h
+++ b/revision.h
@@ -26,6 +26,7 @@ struct rev_info {
/* Traversal flags */
unsigned int dense:1,
no_merges:1,
+ no_walk:1,
remove_empty_trees:1,
lifo:1,
topo_order:1,
^ permalink raw reply related
* Re: Help please :-)
From: Petr Baudis @ 2006-04-15 19:10 UTC (permalink / raw)
To: Paolo Ciarrocchi; +Cc: Git Mailing List
In-Reply-To: <4d8e3fd30604150908m565e8aaat8ef9846a85c4036e@mail.gmail.com>
Hello,
Dear diary, on Sat, Apr 15, 2006 at 06:08:01PM CEST, I got a letter
where Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> said that...
> I'm used to keep updated my linux tree with cg-status,
> I did that this morning but now I see the following:
> paolo@Italia:~/linux-2.6$ cg-status
> Heads:
> >master 2c5362007bc0a46461a9d94958cdd53bb027004c
> R origin 2c5362007bc0a46461a9d94958cdd53bb027004c
>
> ? arch/i386/kernel/smpboot.c.rej
> ? drivers/md/dm-stripe.c.rej
> ? drivers/net/chelsio/sge.c.rej
> ? drivers/net/e100.c.rej
> ? drivers/net/e1000/e1000_main.c.rej
> ? fs/9p/vfs_dir.c.rej
> ? fs/nfsctl.c.rej
> ? kernel/fork.c.rej
> ? kernel/posix-timers.c.rej
> ? kernel/timer.c.rej
> ? mm/memory.c.rej
> ? mm/mempolicy.c.rej
> ? mm/swap.c.rej
> ? net/ieee80211/ieee80211_crypt_ccmp.c.rej
> ? net/ieee80211/ieee80211_rx.c.rej
> ? scripts/kconfig/lkc_defs.h
> ? scripts/mod/modpost.c.rej
> paolo@Italia:~/linux-2.6$ cg-diff
>
> I'm a bit lost, the tree is correctly updated, no error message but
> why I see all these .rej?
you apparently had local changes in your working tree, did cg-update
and then the local changes conflicted with the new changes in Linus'
tree. cg-update should have told you further details.
> And how can I fix this problem?
> git reset and cg-reset don't help...
cg-clean can remove files not recognized by git.
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Right now I am having amnesia and deja-vu at the same time. I think
I have forgotten this before.
^ permalink raw reply
* Re: Git web broken, or Linus' kernel tree in odd state
From: Junio C Hamano @ 2006-04-15 19:15 UTC (permalink / raw)
To: Tony Luck; +Cc: git, Linus Torvalds
In-Reply-To: <12c511ca0604151155j40c68a21qf684f77d2476605b@mail.gmail.com>
"Tony Luck" <tony.luck@intel.com> writes:
> Git web is showing the "master" tag four commits back from HEAD on
> the summary page for Linus' kernel tree, which is unusual (isn't it?).
I suspect it is related to this:
http://article.gmane.org/gmane.comp.version-control.git/14366
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox