* Unneeded branch history
From: Luca Siciliano Viglieri @ 2008-12-10 11:13 UTC (permalink / raw)
To: git
Hi,
i have tried to find a solution to my problem, but i couldn't find
anything on the documentation.
I have created from master branch a development branch. I keep the master
branch regularly uptodate from the server and in the development branch i
commit my code. When i merge the two branches i obtain a commit with two
parents and when i push my master branch to the server, all my development
history it is also saved in the server.
Can i avoid saving my develoment history, at least on the server, so that
the master branch has only one parent commits?
Thanks
Luca Siciliano
^ permalink raw reply
* Re: Recovering from epic fail (deleted .git/objects/pack)
From: Johannes Sixt @ 2008-12-10 11:39 UTC (permalink / raw)
To: R. Tyler Ballance; +Cc: Junio C Hamano, git
In-Reply-To: <1228903606.4445.53.camel@starfruit.local>
R. Tyler Ballance schrieb:
> On Tue, 2008-12-09 at 16:19 -0800, Junio C Hamano wrote:
>> See if "fsck --full" complains after that. If the repository was not
>> repacked during that period, all objects created by the activity by the
>> unfortunate developer would be loose, so ...
>
> tyler@ccnet:~/source/slide/brian_main> time git fsck --full
> Segmentation fault
Please make a backup (tarball) of the repository that shows this segfault.
'git fsck' is not supposed to segfault, no matter what garbage is thrown
at it.
Can you make a backtrace of this failing 'git fsck --full' invocation?
-- Hannes
^ permalink raw reply
* Re: Recovering from epic fail (deleted .git/objects/pack)
From: R. Tyler Ballance @ 2008-12-10 10:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vd4g051ax.fsf@gitster.siamese.dyndns.org>
[-- Attachment #1: Type: text/plain, Size: 1517 bytes --]
On Tue, 2008-12-09 at 16:19 -0800, Junio C Hamano wrote:
> I do not know about "feasible" and "properly", but ...
>
> (0) take backup of the repository of this unfortunate developer.
>
> (1) make a fresh clone of the central repository that this unfortunate
> developer's work started out from.
>
> (2) copy the contents of the .git/objects/pack/ of that clone to the
> developer's .git/objects/pack/.
This approach "sort of" worked, i.e. it worked insofar that I was able
to use the repository enough to generate a series of patch files for the
developer's work from the last two weeks to be applied to their new
clone of the central repository. Why I did this is answered below ;)
>
> See if "fsck --full" complains after that. If the repository was not
> repacked during that period, all objects created by the activity by the
> unfortunate developer would be loose, so ...
tyler@ccnet:~/source/slide/brian_main> time git fsck --full
Segmentation fault
real 27m2.187s
user 10m3.238s
sys 0m16.609s
tyler@ccnet:~/source/slide/brian_main>
Oh well, your approach worked *enough* to get the important data out,
and that's what's most important.
Moving forward we're likely going to implement an automated process of
walking through developers' repositories and pushing any unpushed refs
to a backup repository just to make sure something like this doesn't
happen again.
Appreciate the help :)
Cheers
--
-R. Tyler Ballance
Slide, Inc.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Alex Riesen @ 2008-12-10 9:36 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nicolas Pitre, Junio C Hamano, Git Mailing List
In-Reply-To: <493F71B7.60804@viscovery.net>
2008/12/10 Johannes Sixt <j.sixt@viscovery.net>:
> Nicolas Pitre schrieb:
>> Especially on Windows where an opened file cannot be replaced, make
>> sure pack-objects always close packs it is about to replace. Even on
>> non Windows systems, this could save potential bad results if ever
>> objects were to be read from the new pack file using offset from the old
>> index.
>>
>> This should fix t5303 on Windows.
> ...
>> OK, here it is at last. Please confirm it works on Windows before Junio
>> merges it.
>
> I can confirm that this patch fixes t5303 on Windows (MinGW).
>
And it does that for me, FWIW.
^ permalink raw reply
* [PATCH] rebase: improve error messages about dirty state
From: Jeff King @ 2008-12-10 9:25 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
If you have unstaged changes in your working tree and try to
rebase, you will get the cryptic "foo: needs update"
message, but nothing else. If you have staged changes, you
get "your index is not up-to-date".
Let's improve this situation in two ways:
- for unstaged changes, let's also tell them we are
canceling the rebase, and why (in addition to the "needs
update" lines)
- for the staged changes case, let's use language that is a
little more clear to the user: their index contains
uncommitted changes
Signed-off-by: Jeff King <peff@peff.net>
---
I am cleaning up some old branches, and I think this is worth applying.
It came out of a "rebase's error message is confusing" thread back in
April:
http://thread.gmane.org/gmane.comp.version-control.git/78698
It would be nice also to say "foo: locally modified" instead of "foo:
needs update" but the REFRESH_SAY_CHANGED functionality isn't exposed
via the command line.
git-rebase.sh | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/git-rebase.sh b/git-rebase.sh
index ea7720d..ebd4df3 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -332,11 +332,14 @@ else
fi
# The tree must be really really clean.
-git update-index --ignore-submodules --refresh || exit
+if ! git update-index --ignore-submodules --refresh; then
+ echo >&2 "cannot rebase: you have unstaged changes"
+ exit 1
+fi
diff=$(git diff-index --cached --name-status -r --ignore-submodules HEAD --)
case "$diff" in
-?*) echo "cannot rebase: your index is not up-to-date"
- echo "$diff"
+?*) echo >&2 "cannot rebase: your index contains uncommitted changes"
+ echo >&2 "$diff"
exit 1
;;
esac
--
1.6.1.rc2.15.g7752a
^ permalink raw reply related
* Re: [PATCH 1/2] diff: fix handling of binary rewrite diffs
From: Jeff King @ 2008-12-10 9:04 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vvdts1l92.fsf@gitster.siamese.dyndns.org>
On Wed, Dec 10, 2008 at 12:34:49AM -0800, Junio C Hamano wrote:
> > + for j in 1 2 3 4 5 6 7 9 10; do
> Hmm... "1 2 3 4 5 6 7 9 10"?
Heh. Oops.
I see you fixed this up as 1 through 9. My intent was 1 through 10, but
it really doesn't matter. The point is just to hit the minimum break
size, and I left a lot of leeway in case it ever gets increased later.
-Peff
^ permalink raw reply
* Re: [PATCH 2/2] diff: respect textconv in rewrite diffs
From: Jeff King @ 2008-12-10 9:02 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7v3agw2zu5.fsf@gitster.siamese.dyndns.org>
On Wed, Dec 10, 2008 at 12:34:26AM -0800, Junio C Hamano wrote:
> > +cat >dump <<'EOF'
> > +#!/bin/sh
> > +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> > +EOF
>
> I'll squash in a change to make this part use $SHELL_PATH for
> consistency. Thanks.
It was cut-and-paste from t4030, so if we care, it might be worth
changing there, too (and naming it "dump" instead of "hexdump", because
it actually dumps in decimal :) ).
But more importantly, the fixup you just pushed seems to have an extra
">dump":
> +{
> + echo "#!$SHELL_PATH"
> + cat >dump <<'EOF'
> +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> +EOF
> +} >dump
> +chmod +x dump
-Peff
^ permalink raw reply
* [PATCH] git-gui: Fixed typos in Swedish translation.
From: Peter Krefting @ 2008-12-10 8:50 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0812091623590.31023@ds9.cixit.se>
[-- Attachment #1: Type: TEXT/PLAIN, Size: 189 bytes --]
> Patch to the Swedish translation is attached gzipped.
Thanks for applying it. I found two typos, which are corrected by the
attached patch.
--
\\// Peter - http://www.softwolves.pp.se/
[-- Attachment #2: [PATCH] git-gui: Fixed typos in Swedish translation. --]
[-- Type: APPLICATION/octet-stream, Size: 757 bytes --]
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Junio C Hamano @ 2008-12-10 8:35 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git
In-Reply-To: <ghn8jv$hg9$1@ger.gmane.org>
Jakub Narebski <jnareb@gmail.com> writes:
> Jakub Narebski wrote:
>
> I'm sorry, there should be
>
> + my $ftype = "blob";
>> if (!defined $hash) {
>> $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
>> or die_error(404, "Error looking up file");
>> + } else {
>> + $ftype = git_get_type($hash);
>> + if ($ftype !~ "blob") {
>> + die_error(400, "Object is not a blob");
>> + }
I will squash in the following and queue [1/3] and [3/3] to 'pu', as there
seem to be a few comments on [2/3] that look worth addressing.
gitweb/gitweb.perl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git c/gitweb/gitweb.perl w/gitweb/gitweb.perl
index d491a1d..ccbf5d4 100755
--- c/gitweb/gitweb.perl
+++ w/gitweb/gitweb.perl
@@ -4585,11 +4585,12 @@ sub git_blame {
die_error(404, "Couldn't find base commit") unless $hash_base;
my %co = parse_commit($hash_base)
or die_error(404, "Commit not found");
+ my $ftype = "blob";
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
or die_error(404, "Error looking up file");
} else {
- my $ftype = git_get_type($hash);
+ $ftype = git_get_type($hash);
if ($ftype !~ "blob") {
die_error(400, "Object is not a blob");
}
@@ -4637,7 +4638,8 @@ HTML
$metainfo{$full_rev} = {};
}
my $meta = $metainfo{$full_rev};
- while (my $data = <$fd>) {
+ my $data;
+ while ($data = <$fd>) {
chomp $data;
last if ($data =~ s/^\t//); # contents of line
if ($data =~ /^(\S+) (.*)$/) {
^ permalink raw reply related
* Re: [PATCH 1/2] diff: fix handling of binary rewrite diffs
From: Junio C Hamano @ 2008-12-10 8:34 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20081209081227.GA19626@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Instead, if we have binary files, then let's just skip emit_rewrite_diff
> altogether. We will already have shown the "dissimilarity index" line,
> so it is really about the diff contents. If binary diffs are turned off,
> the "Binary files a/file and b/file differ" message should be the same
> in either case. If we do have binary patches turned on, there isn't much
> point in making a less-efficient binary patch that does a total rewrite;
> no human is going to read it, and since binary patches don't apply with
> any fuzz anyway, the result of application should be the same.
Makes sense.
> diff.c | 4 ++-
> t/t4031-diff-rewrite-binary.sh | 42 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 1 deletions(-)
> create mode 100755 t/t4031-diff-rewrite-binary.sh
>
> diff --git a/diff.c b/diff.c
> index f644947..ea958a2 100644
> --- a/diff.c
> +++ b/diff.c
> @@ -1376,7 +1376,9 @@ static void builtin_diff(const char *name_a,
> */
> if ((one->mode ^ two->mode) & S_IFMT)
> goto free_ab_and_return;
> - if (complete_rewrite) {
> + if (complete_rewrite &&
> + !diff_filespec_is_binary(one) &&
> + !diff_filespec_is_binary(two)) {
> emit_rewrite_diff(name_a, name_b, one, two, o);
> o->found_changes = 1;
> goto free_ab_and_return;
And looks correct.
> diff --git a/t/t4031-diff-rewrite-binary.sh b/t/t4031-diff-rewrite-binary.sh
> new file mode 100755
> index 0000000..4b522f7
> --- /dev/null
> +++ b/t/t4031-diff-rewrite-binary.sh
> @@ -0,0 +1,42 @@
> +#!/bin/sh
> +
> +test_description='rewrite diff on binary file'
> +
> +. ./test-lib.sh
> +
> +# We must be large enough to meet the MINIMUM_BREAK_SIZE
> +# requirement.
> +make_file() {
> + for i in 1 2 3 4 5 6 7 8 9 10; do
> + for j in 1 2 3 4 5 6 7 9 10; do
> + for k in 1 2 3 4 5; do
> + printf "$1\n"
> + done
> + done
> + done >file
> +}
> +
> +test_expect_success 'create binary file with changes' '
> + make_file "\\0" &&
> + git add file &&
> + make_file "\\01"
> +'
Hmm... "1 2 3 4 5 6 7 9 10"?
^ permalink raw reply
* Re: [PATCH 2/2] diff: respect textconv in rewrite diffs
From: Junio C Hamano @ 2008-12-10 8:34 UTC (permalink / raw)
To: Jeff King; +Cc: git
In-Reply-To: <20081209081321.GA19707@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
> Currently we just skip rewrite diffs for binary files; this patch makes
> an exception for files which will be textconv'd, and actually performs
> the textconv before generating the diff.
>
> Conceptually, rewrite diffs should be in the exact same format as the a
> non-rewrite diff, except that we refuse to share any context. Thus it
> makes very little sense for "git diff" to show a textconv'd diff, but
> for "git diff -B" to show "Binary files differ".
Makes sense.
> +cat >dump <<'EOF'
> +#!/bin/sh
> +perl -e '$/ = undef; $_ = <>; s/./ord($&)/ge; print $_' < "$1"
> +EOF
I'll squash in a change to make this part use $SHELL_PATH for
consistency. Thanks.
^ permalink raw reply
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Junio C Hamano @ 2008-12-10 8:27 UTC (permalink / raw)
To: Johannes Sixt; +Cc: Nicolas Pitre, Alex Riesen, Git Mailing List
In-Reply-To: <493F71B7.60804@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
> Nicolas Pitre schrieb:
>> Especially on Windows where an opened file cannot be replaced, make
>> sure pack-objects always close packs it is about to replace. Even on
>> non Windows systems, this could save potential bad results if ever
>> objects were to be read from the new pack file using offset from the old
>> index.
>>
>> This should fix t5303 on Windows.
> ...
>> OK, here it is at last. Please confirm it works on Windows before Junio
>> merges it.
>
> I can confirm that this patch fixes t5303 on Windows (MinGW).
Thanks; it is a bit too late for tonight, but it will appear in tomorrow's
'master'.
^ permalink raw reply
* Re: git fsck segmentation fault
From: Martin Koegler @ 2008-12-10 7:53 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Simon Hausmann, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091408560.14328@xanadu.home>
Maybe something like this could help:
>From 32be177cbb0825fc019200b172f3d79117b28140 Mon Sep 17 00:00:00 2001
From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
Date: Wed, 10 Dec 2008 08:42:08 +0100
Subject: [PATCH] fsck: use fewer stack
This patch moves the state while traversing the tree
from the stack to the heap.
Not-really-tested-by: Martin Koegler
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
builtin-fsck.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/builtin-fsck.c b/builtin-fsck.c
index afded5e..8184699 100644
--- a/builtin-fsck.c
+++ b/builtin-fsck.c
@@ -36,6 +36,9 @@ static int verbose;
#define DIRENT_SORT_HINT(de) ((de)->d_ino)
#endif
+static int objectstack_nr, objectstack_alloc;
+struct object **objectstack;
+
static void objreport(struct object *obj, const char *severity,
const char *err, va_list params)
{
@@ -66,9 +69,7 @@ static int fsck_error_func(struct object *obj, int type, const char *err, ...)
static int mark_object(struct object *obj, int type, void *data)
{
- struct tree *tree = NULL;
struct object *parent = data;
- int result;
if (!obj) {
printf("broken link from %7s %s\n",
@@ -95,6 +96,15 @@ static int mark_object(struct object *obj, int type, void *data)
}
return 1;
}
+ ALLOC_GROW(objectstack, objectstack_nr + 1, objectstack_alloc);
+ objectstack[objectstack_nr++] = obj;
+ return 0;
+}
+
+static int mark_child_object(struct object *obj)
+{
+ struct tree *tree = NULL;
+ int result;
if (obj->type == OBJ_TREE) {
obj->parsed = 0;
@@ -116,6 +126,11 @@ static int mark_object(struct object *obj, int type, void *data)
static void mark_object_reachable(struct object *obj)
{
mark_object(obj, OBJ_ANY, 0);
+ while (objectstack_nr > 0) {
+ struct object *obj = objectstack[--objectstack_nr];
+ if (mark_child_object(obj) < 0)
+ break;
+ }
}
static int mark_used(struct object *obj, int type, void *data)
--
1.6.1.rc2.283.g32be1
^ permalink raw reply related
* Re: [PATCH] make sure packs to be replaced are closed beforehand
From: Johannes Sixt @ 2008-12-10 7:37 UTC (permalink / raw)
To: Nicolas Pitre; +Cc: Alex Riesen, Junio C Hamano, Git Mailing List
In-Reply-To: <alpine.LFD.2.00.0812091414030.14328@xanadu.home>
Nicolas Pitre schrieb:
> Especially on Windows where an opened file cannot be replaced, make
> sure pack-objects always close packs it is about to replace. Even on
> non Windows systems, this could save potential bad results if ever
> objects were to be read from the new pack file using offset from the old
> index.
>
> This should fix t5303 on Windows.
...
> OK, here it is at last. Please confirm it works on Windows before Junio
> merges it.
I can confirm that this patch fixes t5303 on Windows (MinGW).
-- Hannes
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Luben Tuikov @ 2008-12-10 6:24 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224814.28106.83387.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:48 PM
> Among others:
> * move variable declaration closer to the place it is set
> and used,
> if possible,
> * uniquify and simplify coding style a bit, which includes
> removing
> unnecessary '()'.
> * check type only if $hash was defined, as otherwise from
> the way
> git_get_hash_by_path() is called (and works), we know
> that it is
> a blob,
> * use modern calling convention for git-blame,
> * remove unused variable,
> * don't use implicit variables ($_),
> * add some comments
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Looks good.
> ---
> Not stricly necessary... but the code looked not very nice
>
> gitweb/gitweb.perl | 65
> ++++++++++++++++++++++++++++++----------------------
> 1 files changed, 37 insertions(+), 28 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 916396a..68aa3f8 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4575,28 +4575,32 @@ sub git_tag {
> }
>
> sub git_blame {
> - my $fd;
> - my $ftype;
> -
> + # permissions
> gitweb_check_feature('blame')
> - or die_error(403, "Blame view not
> allowed");
> + or die_error(403, "Blame view not allowed");
>
> + # error checking
> die_error(400, "No file name given") unless
> $file_name;
> $hash_base ||= git_get_head_hash($project);
> - die_error(404, "Couldn't find base commit")
> unless ($hash_base);
> + die_error(404, "Couldn't find base commit")
> unless $hash_base;
> my %co = parse_commit($hash_base)
> or die_error(404, "Commit not found");
> if (!defined $hash) {
> $hash = git_get_hash_by_path($hash_base, $file_name,
> "blob")
> or die_error(404, "Error looking up file");
> + } else {
> + my $ftype = git_get_type($hash);
> + if ($ftype !~ "blob") {
> + die_error(400, "Object is not a blob");
> + }
> }
> - $ftype = git_get_type($hash);
> - if ($ftype !~ "blob") {
> - die_error(400, "Object is not a blob");
> - }
> - open ($fd, "-|", git_cmd(), "blame",
> '-p', '--',
> - $file_name, $hash_base)
> +
> + # run git-blame --porcelain
> + open my $fd, "-|", git_cmd(),
> "blame", '-p',
> + $hash_base, '--', $file_name
> or die_error(500, "Open git-blame failed");
> +
> + # page header
> git_header_html();
> my $formats_nav =
> $cgi->a({-href =>
> href(action=>"blob", -replay=>1)},
> @@ -4610,40 +4614,43 @@ sub git_blame {
> git_print_page_nav('','',
> $hash_base,$co{'tree'},$hash_base, $formats_nav);
> git_print_header_div('commit',
> esc_html($co{'title'}), $hash_base);
> git_print_page_path($file_name, $ftype, $hash_base);
> - my @rev_color = (qw(light2 dark2));
> +
> + # page body
> + my @rev_color = qw(light2 dark2);
> my $num_colors = scalar(@rev_color);
> my $current_color = 0;
> - my $last_rev;
> + my %metainfo = ();
> +
> print <<HTML;
> <div class="page_body">
> <table class="blame">
>
> <tr><th>Commit</th><th>Line</th><th>Data</th></tr>
> HTML
> - my %metainfo = ();
> - while (1) {
> - $_ = <$fd>;
> - last unless defined $_;
> + LINE:
> + while (my $line = <$fd>) {
> + chomp $line;
> + # the header: <SHA-1> <src lineno> <dst
> lineno> [<lines in group>]
> + # no <lines in group> for subsequent lines in
> group of lines
> my ($full_rev, $orig_lineno, $lineno, $group_size) =
> - /^([0-9a-f]{40}) (\d+) (\d+)(?:
> (\d+))?$/;
> + ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?:
> (\d+))?$/);
> if (!exists $metainfo{$full_rev}) {
> $metainfo{$full_rev} = {};
> }
> my $meta = $metainfo{$full_rev};
> - while (<$fd>) {
> - last if (s/^\t//);
> - if (/^(\S+) (.*)$/) {
> + while (my $data = <$fd>) {
> + chomp $data;
> + last if ($data =~ s/^\t//); # contents of line
> + if ($data =~ /^(\S+) (.*)$/) {
> $meta->{$1} = $2;
> }
> }
> - my $data = $_;
> - chomp $data;
> - my $rev = substr($full_rev, 0, 8);
> + my $short_rev = substr($full_rev, 0, 8);
> my $author = $meta->{'author'};
> - my %date = parse_date($meta->{'author-time'},
> - $meta->{'author-tz'});
> + my %date =
> + parse_date($meta->{'author-time'},
> $meta->{'author-tz'});
> my $date = $date{'iso-tz'};
> if ($group_size) {
> - $current_color = ++$current_color % $num_colors;
> + $current_color = ($current_color + 1) % $num_colors;
> }
> print "<tr id=\"l$lineno\"
> class=\"$rev_color[$current_color]\">\n";
> if ($group_size) {
> @@ -4654,7 +4661,7 @@ HTML
> print $cgi->a({-href =>
> href(action=>"commit",
> hash=>$full_rev,
>
> file_name=>$file_name)},
> - esc_html($rev));
> + esc_html($short_rev));
> print "</td>\n";
> }
> my $parent_commit;
> @@ -4683,6 +4690,8 @@ HTML
> print "</div>";
> close $fd
> or print "Reading blob failed\n";
> +
> + # page footer
> git_footer_html();
> }
^ permalink raw reply
* Re: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Luben Tuikov @ 2008-12-10 6:20 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224622.28106.89325.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:48 PM
> Luben Tuikov changed 'lineno' link from leading to
> commit which lead
> to current version of given block of lines, to leading to
> parent of
> this commit in 244a70e (Blame "linenr" link jumps
> to previous state at
> "orig_lineno"). This supposedly made data mining
> possible (or just
> better).
Before 244a70e, clicking on linenr links would display
the same commit id as displayed to the left, which is no
different than the block of lines displayed, thus data
mining was impossible, i.e. I had to manually (commands)
go back in history to see how this line or block of lines
developed and/or changed.
244a70e didn't make data mining perfect, just possible.
> This patch attempts to migitate issue a bit by caching
> $parent_commit
> info in %metainfo, which makes gitweb to call git-rev-parse
> only once
> per unique commit in blame output.
Have you tested this patch that it gives the same commit chain
as before it?
Luben
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
> ---
> That is what I have noticed during browsing git_blame()
> code.
What?
> We can change it to even more effective implementation
> (like the ones
> proposed above in the commit message) later.
Where?
>
> Indenting is cause for artifically large diff
>
> gitweb/gitweb.perl | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 1b800f4..916396a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4657,11 +4657,17 @@ HTML
> esc_html($rev));
> print "</td>\n";
> }
> - open (my $dd, "-|", git_cmd(),
> "rev-parse", "$full_rev^")
> - or die_error(500, "Open git-rev-parse
> failed");
> - my $parent_commit = <$dd>;
> - close $dd;
> - chomp($parent_commit);
> + my $parent_commit;
> + if (!exists $meta->{'parent'}) {
> + open (my $dd, "-|", git_cmd(),
> "rev-parse", "$full_rev^")
> + or die_error(500, "Open git-rev-parse
> failed");
> + $parent_commit = <$dd>;
> + close $dd;
> + chomp($parent_commit);
> + $meta->{'parent'} = $parent_commit;
> + } else {
> + $parent_commit = $meta->{'parent'};
> + }
> my $blamed = href(action => 'blame',
> file_name =>
> $meta->{'filename'},
> hash_base => $parent_commit);
^ permalink raw reply
* Re: [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
From: Luben Tuikov @ 2008-12-10 5:55 UTC (permalink / raw)
To: git, Jakub Narebski
In-Reply-To: <20081209224330.28106.18301.stgit@localhost.localdomain>
--- On Tue, 12/9/08, Jakub Narebski <jnareb@gmail.com> wrote:
> From: Jakub Narebski <jnareb@gmail.com>
> Subject: [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
> To: git@vger.kernel.org
> Cc: "Luben Tuikov" <ltuikov@yahoo.com>, "Jakub Narebski" <jnareb@gmail.com>
> Date: Tuesday, December 9, 2008, 2:46 PM
> Move l<line number> ID from <a> link element
> inside table row (inside
> cell element for column with line numbers), to encompassing
> <tr> table
> row element. It was done to make it easier to manipulate
> result HTML
> with DOM, and to be able write 'blame_incremental'
> view with the same,
> or nearly the same result.
>
> Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: Luben Tuikov <ltuikov@yahoo.com>
Luben
> ---
> For blame_incremental I need easy way to manipulate rows of
> blame
> table, to add information about blamed commits as it
> arrives.
>
> So there it is.
>
> gitweb/gitweb.perl | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 6eb370d..1b800f4 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -4645,7 +4645,7 @@ HTML
> if ($group_size) {
> $current_color = ++$current_color % $num_colors;
> }
> - print "<tr
> class=\"$rev_color[$current_color]\">\n";
> + print "<tr id=\"l$lineno\"
> class=\"$rev_color[$current_color]\">\n";
> if ($group_size) {
> print "<td
> class=\"sha1\"";
> print " title=\"". esc_html($author)
> . ", $date\"";
> @@ -4667,7 +4667,6 @@ HTML
> hash_base => $parent_commit);
> print "<td
> class=\"linenr\">";
> print $cgi->a({ -href =>
> "$blamed#l$orig_lineno",
> - -id => "l$lineno",
> -class => "linenr" },
> esc_html($lineno));
> print "</td>";
^ permalink raw reply
* Re: [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Nanako Shiraishi @ 2008-12-10 3:49 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Luben Tuikov
In-Reply-To: <20081209224622.28106.89325.stgit@localhost.localdomain>
Quoting Jakub Narebski <jnareb@gmail.com>:
> Unfortunately the implementation in 244a70e used one call for
> git-rev-parse to find parent revision per line in file, instead of
> using long lived "git cat-file --batch-check" (which might not existed
> then), or changing validate_refname to validate_revision and made it
> accept <rev>^, <rev>^^, <rev>^^^ etc. syntax.
Could you substantiate why this is "Unfortunate"? Is the new implementation faster? By how much?
When "previous" commit information is available in the output from "git blame", can you make use of it?
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply
* Re: [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Jakub Narebski @ 2008-12-10 2:13 UTC (permalink / raw)
To: git
In-Reply-To: <20081209224814.28106.83387.stgit@localhost.localdomain>
Jakub Narebski wrote:
I'm sorry, there should be
+ my $ftype = "blob";
> if (!defined $hash) {
> $hash = git_get_hash_by_path($hash_base, $file_name, "blob")
> or die_error(404, "Error looking up file");
> + } else {
> + $ftype = git_get_type($hash);
> + if ($ftype !~ "blob") {
> + die_error(400, "Object is not a blob");
> + }
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Recovering from epic fail (deleted .git/objects/pack)
From: Junio C Hamano @ 2008-12-10 0:19 UTC (permalink / raw)
To: R. Tyler Ballance; +Cc: git
In-Reply-To: <1228867861.14165.19.camel@starfruit.local>
"R. Tyler Ballance" <tyler@slide.com> writes:
> I really wish I didn't have to ask this question, as we discussed in
> #git early this morning, whiskey is the likely answer.
>
> For unexplainable reasons one of our sysadmins got trigger-happy when he
> tried to prune a temp_pack file generated and left in a
> developer's .git/ directory after a git operation aborted (disk quota
> exceeded)
>
> As a result, the sysadmin killed the developers
> entire .git/objects/pack/ directory. (insert copious amounts of whiskey
> here)
>
> He did not however delete all the other contents of .git/objects (00/,
> 01/, etc)
>
> Is there a feasible way that I can properly recover
> the .git/objects/pack directory such that the developer who had their
> last two weeks of local work thrashed can get it back?
I do not know about "feasible" and "properly", but ...
(0) take backup of the repository of this unfortunate developer.
(1) make a fresh clone of the central repository that this unfortunate
developer's work started out from.
(2) copy the contents of the .git/objects/pack/ of that clone to the
developer's .git/objects/pack/.
See if "fsck --full" complains after that. If the repository was not
repacked during that period, all objects created by the activity by the
unfortunate developer would be loose, so ...
^ permalink raw reply
* Recovering from epic fail (deleted .git/objects/pack)
From: R. Tyler Ballance @ 2008-12-10 0:11 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
I really wish I didn't have to ask this question, as we discussed in
#git early this morning, whiskey is the likely answer.
For unexplainable reasons one of our sysadmins got trigger-happy when he
tried to prune a temp_pack file generated and left in a
developer's .git/ directory after a git operation aborted (disk quota
exceeded)
As a result, the sysadmin killed the developers
entire .git/objects/pack/ directory. (insert copious amounts of whiskey
here)
He did not however delete all the other contents of .git/objects (00/,
01/, etc)
Is there a feasible way that I can properly recover
the .git/objects/pack directory such that the developer who had their
last two weeks of local work thrashed can get it back?
Anything that can help (other than pummeling the sysadmin) would be
appreciated
Cheers
--
-R. Tyler Ballance
Slide, Inc.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply
* start with none of your own money
From: Jason Corley @ 2008-12-09 23:44 UTC (permalink / raw)
To: git
go to http://investors2009.com/ to learn to buy residential and commercial real estate with none of your own money.
This email was sent from the Real Estate Investment Academy. To be removed please type your email address on the following site http://investors2009.com/remove/
--------------------------------------------
.
^ permalink raw reply
* [PATCH 3/3] gitweb: A bit of code cleanup in git_blame()
From: Jakub Narebski @ 2008-12-09 22:48 UTC (permalink / raw)
To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>
Among others:
* move variable declaration closer to the place it is set and used,
if possible,
* uniquify and simplify coding style a bit, which includes removing
unnecessary '()'.
* check type only if $hash was defined, as otherwise from the way
git_get_hash_by_path() is called (and works), we know that it is
a blob,
* use modern calling convention for git-blame,
* remove unused variable,
* don't use implicit variables ($_),
* add some comments
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
Not stricly necessary... but the code looked not very nice
gitweb/gitweb.perl | 65 ++++++++++++++++++++++++++++++----------------------
1 files changed, 37 insertions(+), 28 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 916396a..68aa3f8 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4575,28 +4575,32 @@ sub git_tag {
}
sub git_blame {
- my $fd;
- my $ftype;
-
+ # permissions
gitweb_check_feature('blame')
- or die_error(403, "Blame view not allowed");
+ or die_error(403, "Blame view not allowed");
+ # error checking
die_error(400, "No file name given") unless $file_name;
$hash_base ||= git_get_head_hash($project);
- die_error(404, "Couldn't find base commit") unless ($hash_base);
+ die_error(404, "Couldn't find base commit") unless $hash_base;
my %co = parse_commit($hash_base)
or die_error(404, "Commit not found");
if (!defined $hash) {
$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
or die_error(404, "Error looking up file");
+ } else {
+ my $ftype = git_get_type($hash);
+ if ($ftype !~ "blob") {
+ die_error(400, "Object is not a blob");
+ }
}
- $ftype = git_get_type($hash);
- if ($ftype !~ "blob") {
- die_error(400, "Object is not a blob");
- }
- open ($fd, "-|", git_cmd(), "blame", '-p', '--',
- $file_name, $hash_base)
+
+ # run git-blame --porcelain
+ open my $fd, "-|", git_cmd(), "blame", '-p',
+ $hash_base, '--', $file_name
or die_error(500, "Open git-blame failed");
+
+ # page header
git_header_html();
my $formats_nav =
$cgi->a({-href => href(action=>"blob", -replay=>1)},
@@ -4610,40 +4614,43 @@ sub git_blame {
git_print_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
git_print_header_div('commit', esc_html($co{'title'}), $hash_base);
git_print_page_path($file_name, $ftype, $hash_base);
- my @rev_color = (qw(light2 dark2));
+
+ # page body
+ my @rev_color = qw(light2 dark2);
my $num_colors = scalar(@rev_color);
my $current_color = 0;
- my $last_rev;
+ my %metainfo = ();
+
print <<HTML;
<div class="page_body">
<table class="blame">
<tr><th>Commit</th><th>Line</th><th>Data</th></tr>
HTML
- my %metainfo = ();
- while (1) {
- $_ = <$fd>;
- last unless defined $_;
+ LINE:
+ while (my $line = <$fd>) {
+ chomp $line;
+ # the header: <SHA-1> <src lineno> <dst lineno> [<lines in group>]
+ # no <lines in group> for subsequent lines in group of lines
my ($full_rev, $orig_lineno, $lineno, $group_size) =
- /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/;
+ ($line =~ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/);
if (!exists $metainfo{$full_rev}) {
$metainfo{$full_rev} = {};
}
my $meta = $metainfo{$full_rev};
- while (<$fd>) {
- last if (s/^\t//);
- if (/^(\S+) (.*)$/) {
+ while (my $data = <$fd>) {
+ chomp $data;
+ last if ($data =~ s/^\t//); # contents of line
+ if ($data =~ /^(\S+) (.*)$/) {
$meta->{$1} = $2;
}
}
- my $data = $_;
- chomp $data;
- my $rev = substr($full_rev, 0, 8);
+ my $short_rev = substr($full_rev, 0, 8);
my $author = $meta->{'author'};
- my %date = parse_date($meta->{'author-time'},
- $meta->{'author-tz'});
+ my %date =
+ parse_date($meta->{'author-time'}, $meta->{'author-tz'});
my $date = $date{'iso-tz'};
if ($group_size) {
- $current_color = ++$current_color % $num_colors;
+ $current_color = ($current_color + 1) % $num_colors;
}
print "<tr id=\"l$lineno\" class=\"$rev_color[$current_color]\">\n";
if ($group_size) {
@@ -4654,7 +4661,7 @@ HTML
print $cgi->a({-href => href(action=>"commit",
hash=>$full_rev,
file_name=>$file_name)},
- esc_html($rev));
+ esc_html($short_rev));
print "</td>\n";
}
my $parent_commit;
@@ -4683,6 +4690,8 @@ HTML
print "</div>";
close $fd
or print "Reading blob failed\n";
+
+ # page footer
git_footer_html();
}
^ permalink raw reply related
* [PATCH 2/3] gitweb: Cache $parent_commit info in git_blame()
From: Jakub Narebski @ 2008-12-09 22:48 UTC (permalink / raw)
To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>
Luben Tuikov changed 'lineno' link from leading to commit which lead
to current version of given block of lines, to leading to parent of
this commit in 244a70e (Blame "linenr" link jumps to previous state at
"orig_lineno"). This supposedly made data mining possible (or just
better).
Unfortunately the implementation in 244a70e used one call for
git-rev-parse to find parent revision per line in file, instead of
using long lived "git cat-file --batch-check" (which might not existed
then), or changing validate_refname to validate_revision and made it
accept <rev>^, <rev>^^, <rev>^^^ etc. syntax.
This patch attempts to migitate issue a bit by caching $parent_commit
info in %metainfo, which makes gitweb to call git-rev-parse only once
per unique commit in blame output.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
That is what I have noticed during browsing git_blame() code.
We can change it to even more effective implementation (like the ones
proposed above in the commit message) later.
Indenting is cause for artifically large diff
gitweb/gitweb.perl | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 1b800f4..916396a 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4657,11 +4657,17 @@ HTML
esc_html($rev));
print "</td>\n";
}
- open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
- or die_error(500, "Open git-rev-parse failed");
- my $parent_commit = <$dd>;
- close $dd;
- chomp($parent_commit);
+ my $parent_commit;
+ if (!exists $meta->{'parent'}) {
+ open (my $dd, "-|", git_cmd(), "rev-parse", "$full_rev^")
+ or die_error(500, "Open git-rev-parse failed");
+ $parent_commit = <$dd>;
+ close $dd;
+ chomp($parent_commit);
+ $meta->{'parent'} = $parent_commit;
+ } else {
+ $parent_commit = $meta->{'parent'};
+ }
my $blamed = href(action => 'blame',
file_name => $meta->{'filename'},
hash_base => $parent_commit);
^ permalink raw reply related
* [PATCH 1/3] gitweb: Move 'lineno' id from link to row element in git_blame
From: Jakub Narebski @ 2008-12-09 22:46 UTC (permalink / raw)
To: git; +Cc: Luben Tuikov, Jakub Narebski
In-Reply-To: <20081209223703.28106.29198.stgit@localhost.localdomain>
Move l<line number> ID from <a> link element inside table row (inside
cell element for column with line numbers), to encompassing <tr> table
row element. It was done to make it easier to manipulate result HTML
with DOM, and to be able write 'blame_incremental' view with the same,
or nearly the same result.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
For blame_incremental I need easy way to manipulate rows of blame
table, to add information about blamed commits as it arrives.
So there it is.
gitweb/gitweb.perl | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index 6eb370d..1b800f4 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -4645,7 +4645,7 @@ HTML
if ($group_size) {
$current_color = ++$current_color % $num_colors;
}
- print "<tr class=\"$rev_color[$current_color]\">\n";
+ print "<tr id=\"l$lineno\" class=\"$rev_color[$current_color]\">\n";
if ($group_size) {
print "<td class=\"sha1\"";
print " title=\"". esc_html($author) . ", $date\"";
@@ -4667,7 +4667,6 @@ HTML
hash_base => $parent_commit);
print "<td class=\"linenr\">";
print $cgi->a({ -href => "$blamed#l$orig_lineno",
- -id => "l$lineno",
-class => "linenr" },
esc_html($lineno));
print "</td>";
^ permalink raw reply related
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