Git development
 help / color / mirror / Atom feed
* :), mother-in-law
From: Rafael Mead @ 2006-07-23  4:00 UTC (permalink / raw)
  To: git-commits-head-owner

Genuine Swiss made Role3x repilcas are as close to the real thing 
as a repilca watch can be. Sometimes even the professional jewelers 
are unable to tell the difference from the real RoleJx watch.

Why spend thousands of dollars on the real deal when 
a repilca watch looks so much alike that only an expert could tell the difference...
And you only pay a fractoin of the price.

VISIT US, AND GET OUR SPECIL 370% DIS1COUNT OFER!

http://4PAQO3Rn3sgaotdbtbgo553a5nlsnn5.madwortmj.com/

=====
in his eye. "Me  leading?  What  do  you  mean,  me  leading?  You're  the
one with acid, squash it  under a press, or  melt it in an oven. And then he
     "No, Jonathan, there is no such place. Heaven is not a place, and  it
hundred feet of clear space either on your left or your right. So, we can go
and it was time to go home.
and ordered a flying boot. I looked over his map to see what  was  on it. It

extended into the wind, and fell into a vertical dive.
was sick and he had gone for the doctor. Apologized for being late. Well, we

^ permalink raw reply

* Re: Random Git Issues/Wishlist
From: Shawn Pearce @ 2006-07-23  4:27 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git
In-Reply-To: <20060722195502.GS13776@pasky.or.cz>

Petr Baudis <pasky@suse.cz> wrote:
>   (iii) Lazy clone, shallow clone, whatever you call it. This has
> several possible degrees of implementation:

I'd love to work on this, but I just don't have time.  :-(
 
>   (vi) Renames - should we follow them in logs? Will we? When? How
> exactly in the interesting cases?

I thought this has been settled as ``we will not record renames
directly, but instead rely on after-the-fact comparsions to identify
renames and copies based on content similarity''.

The rename identification code in diffcore isn't the fastest, but
I think someone suggested caching the results of rename comparsions
under .git as a way of speeding that up.  Unfortunately nobody has
stepped forward with a reasonable caching implementation, and I
think it was also debated that caching is probably not worthwhile
due to the high number of permutations people would typically be
asking for from diffcore.
 
>   (viii) Patches versioning in StGit - many people I've told about StGit
> complained that it doesn't version patches (and possibly moved to mq?).
> We should have some scheme for doing meta-history (especially
> interesting when/if we aim to make altering history easy).

Doesn't StGit now have a single ref for every patch commit?
What about turning on reflog support on those refs and reading the
reflog for the ``history'' of that patch?  Granted the reflog isn't
prune proof but it is a history of that ref's values over time.

You can already go back in that history with the @{yesterday}
syntax (e.g. "HEAD@{yesterday}") anywhere a sha1 expression is
valid (e.g. git-log) but StGit doesn't take advantage of it.
 
>   (xii) Special merging - I now maintian the SuSE glibc package in git
> and I'd like to use something more sensible than diff3 merger for
> merging the changelogs from various branches; it's trivially solvable
> conflicts all the time

I've been waiting for the C based recursive merger to get stable
before I take a crack at parameterizing the `merge` invocation.
I much prefer using patch reject files for conflict resolution,
but that's just me.  (Besides opening a single patch process and
shoving a stream of all diffs at it is faster on Cygwin than forking
30+ merge processes for 30 files with conflicts.)

I take it you are really asking for a way to parameterize the 3 way
merge tool on a file-by-file basis, e.g. adding to the config file:

	[mergetool "default"]
		program = merge %real %stage1 %stage3
		real = stage2

	[mergetool "ChangeLog"]
		program = change-log-merger %stage1 %stage2 %stage3 %real

	[mergetool "some/bad/binary-file"]
		program = cp %stage2 %real

An issue with storing this data in the config file is what happens
if the stuff stored at the path "some/bad/binary-file" changes such
that simply using `cp` (as above) is horribly wrong.  Another is how
do you pass these "reasonable defaults" off to other team members
on a repository-by-repository basis, assuming you all have access
to the same tools (e.g. the change-log-merger mentioned above).

-- 
Shawn.

^ permalink raw reply

* Re: Makefile checks for DarwinPorts / Fink
From: Shawn Pearce @ 2006-07-23  5:45 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Stefan Pfetzing, git
In-Reply-To: <20060722161914.GA10754@spearce.org>

This is a slightly cleaner version of my prior patch.  :-)

-->8--
Disable linking with Fink or DarwinPorts.

It may be desirable for the compiler to disable linking against Fink
or DarwinPorts, especially if both are installed on the system and
the user wants GIT to be linked specifically to only one of them.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Makefile |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/Makefile b/Makefile
index a1666e2..99a84cc 100644
--- a/Makefile
+++ b/Makefile
@@ -267,15 +267,17 @@ ifeq ($(uname_S),Darwin)
 	NEEDS_SSL_WITH_CRYPTO = YesPlease
 	NEEDS_LIBICONV = YesPlease
 	NO_STRLCPY = YesPlease
-	## fink
-	ifeq ($(shell test -d /sw/lib && echo y),y)
-		BASIC_CFLAGS += -I/sw/include
-		BASIC_LDFLAGS += -L/sw/lib
+	ifndef NO_FINK
+		ifeq ($(shell test -d /sw/lib && echo y),y)
+			BASIC_CFLAGS += -I/sw/include
+			BASIC_LDFLAGS += -L/sw/lib
+		endif
 	endif
-	## darwinports
-	ifeq ($(shell test -d /opt/local/lib && echo y),y)
-		BASIC_CFLAGS += -I/opt/local/include
-		BASIC_LDFLAGS += -L/opt/local/lib
+	ifndef NO_DARWIN_PORTS
+		ifeq ($(shell test -d /opt/local/lib && echo y),y)
+			BASIC_CFLAGS += -I/opt/local/include
+			BASIC_LDFLAGS += -L/opt/local/lib
+		endif
 	endif
 endif
 ifeq ($(uname_S),SunOS)
-- 
1.4.2.rc1.ge711

^ permalink raw reply related

* [PATCH] pack-objects: check pack.window for default window size
From: Jeff King @ 2006-07-23  5:50 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Signed-off-by: Jeff King <peff@peff.net>
---
For some repositories, deltas simply don't make sense. One can disable
them for git-repack by adding --window, but git-push insists on making
the deltas which can be very CPU-intensive for little benefit.

 Documentation/config.txt |    4 ++++
 pack-objects.c           |   13 ++++++++++++-
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 0b434c1..bc43da8 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -193,6 +193,10 @@ merge.summary::
 	Whether to include summaries of merged commits in newly created
 	merge commit messages. False by default.
 
+pack.window::
+	The size of the window used by gitlink:git-pack-objects[1] when no
+	window size is given on the command line. Defaults to 10.
+
 pull.octopus::
 	The default merge strategy to use when pulling multiple branches
 	at once.
diff --git a/pack-objects.c b/pack-objects.c
index 04a48b9..861c7f0 100644
--- a/pack-objects.c
+++ b/pack-objects.c
@@ -63,6 +63,7 @@ static const char *base_name;
 static unsigned char pack_file_sha1[20];
 static int progress = 1;
 static volatile sig_atomic_t progress_update = 0;
+static int window = 10;
 
 /*
  * The object names in objects array are hashed with this hashtable,
@@ -1216,16 +1217,26 @@ static void setup_progress_signal(void)
 	setitimer(ITIMER_REAL, &v, NULL);
 }
 
+static int git_pack_config(const char *k, const char *v)
+{
+	if(!strcmp(k, "pack.window")) {
+		window = git_config_int(k, v);
+		return 0;
+	}
+	return git_default_config(k, v);
+}
+
 int main(int argc, char **argv)
 {
 	SHA_CTX ctx;
 	char line[40 + 1 + PATH_MAX + 2];
-	int window = 10, depth = 10, pack_to_stdout = 0;
+	int depth = 10, pack_to_stdout = 0;
 	struct object_entry **list;
 	int num_preferred_base = 0;
 	int i;
 
 	setup_git_directory();
+	git_config(git_pack_config);
 
 	progress = isatty(2);
 	for (i = 1; i < argc; i++) {
-- 
1.4.2.rc1.ge7a0-dirty

^ permalink raw reply related

* Re: Git BOF notes
From: Alex Riesen @ 2006-07-23  7:38 UTC (permalink / raw)
  To: Nguyễn Thái Ngọc Duy; +Cc: Petr Baudis, J. Bruce Fields, git
In-Reply-To: <fcaeb9bf0607221312k2088658bqa45e622b7fe244e4@mail.gmail.com>

Nguyễn Thái Ngọc Duy, Sat, Jul 22, 2006 22:12:07 +0200:
> >> I don't know if there's a point in being so paranoid - it already makes
> >> things more painful than necessary. In the tracking branch, you just
> >> want to have what the other side has anyway, and if the other side
> >> decided to jump around, why would you care otherwise?
> >
> >But for the ones who do care, it is much harder to notice. Even if it is
> >a warning (it gets lost in crontab logs).
>
> Then create some lost+found branches for them?

if you copy files from ext3 to vfat, do you expect them to be found in
lost+found? Usually not, I believe. It should either fail or copy.

^ permalink raw reply

* Re: Random Git Issues/Wishlist
From: Paolo Ciarrocchi @ 2006-07-23  8:18 UTC (permalink / raw)
  To: Martin Langhoff; +Cc: Petr Baudis, git
In-Reply-To: <46a038f90607221712gadae5b3tde2de4653fcc9e69@mail.gmail.com>

On 7/23/06, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> > Martin, can you upload the survey to  survey.net.nz as we privately discussed?
>
> Done. this is what it looks like:
>
> http://www.survey.net.nz/survey.php?b5659bb2a599d0649871f56b59819c50
>
> I'll send you the login details to modify it. I've changed a few
> things ever so slightly so it made sense when boiled down to an array
> of radio buttons and text boxes. Survey.net doesn't quite support
> "section titles" so I added the section title to the first question of
> the set, hoping for a "conversational" approach to introducing the
> section to the user.
>
> The best way to edit it is by downloading the text file, editing in
> $EDITOR and posting it back. the format is trivial, and explained here
> http://survey.net.nz/index.php?page=faq under "Upload Survey".

Thanks a lot Martin! I will send out an announce in a few minutes.

regards,

-- 
Paolo
http://paolo.ciarrocchi.googlepages.com
http://picasaweb.google.com/paolo.ciarrocchi

^ permalink raw reply

* GIT user survey
From: Paolo Ciarrocchi @ 2006-07-23  8:23 UTC (permalink / raw)
  To: Git Mailing List

Hi all,
We would like to ask you a few questions about your use of the GIT
version control system. This survey is mainly to understand who is
using GIT, how and why.

The results will be published to the git wiki and discussed on the git
mailing list.

We'll close the survey in two weeks starting from today, 23rd of July.

Please devote a few minutes of your time to fill this simple
questionnaire, it will help a lot the git community to understand your
needs, what you like of git and of course what you don't like  of it.

The survey can be found here:
http://www.survey.net.nz/survey.php?b5659bb2a599d0649871f56b59819c50


Kind regards,
-- 
Paolo
http://paolo.ciarrocchi.googlepages.com
http://picasaweb.google.com/paolo.ciarrocchi

^ permalink raw reply

* Re: GIT user survey
From: Paolo Ciarrocchi @ 2006-07-23  8:45 UTC (permalink / raw)
  To: Git Mailing List
In-Reply-To: <4d8e3fd30607230123m459aa1cle2ab8c1c1dd0fcd2@mail.gmail.com>

On 7/23/06, Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:
[...]
>
> The survey can be found here:
> http://www.survey.net.nz/survey.php?b5659bb2a599d0649871f56b59819c50

If you know people using GIT please forward this message to them,
currently is has been sent to the following projects:
- u-boot
- wine
- cairo
- xmms2
-xcb

regards,
-- 
Paolo
http://paolo.ciarrocchi.googlepages.com
http://picasaweb.google.com/paolo.ciarrocchi

^ permalink raw reply

* [RFC] Colorize 'commit' lines in log ui
From: Jeff King @ 2006-07-23  9:24 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

When paging through the output of git-whatchanged, the color cues help to
visually navigate within a diff. However, it is difficult to notice when a
new commit starts, because the commit and log are shown in the "normal"
color. This patch colorizes the 'commit' line, customizable through
diff.colors.commit and defaulting to yellow.

As a side effect, some of the diff color engine (slot enum, get_color) has
become accessible outside of diff.c.

Signed-off-by: Jeff King <peff@peff.net>
---

I think the visual cue makes the git-whatchanged -p output much easier
to read.

I originally thought of making a "colorized commit" patch where you
could independently set commit.color and commit.color.*. However, it was
clearly much simpler to start by using the diff engine's code.
  1. Do people really want to colorize the commit outside of colorizing
     the diffs, anyway? It makes sense for the code to go together.
  2. Should we call it something other than diff_colors (since now it's
     handling the commit log, too)?

It currently just colorizes the 'commit' line. We could also do the
'Author' and 'Date' lines (either as the same color, or independently),
as well as the log text.

It colorizes all formats given to show_log() except CMIT_FMT_EMAIL (so,
e.g., the sha1's in CMIT_FMT_ONELINE will be yellow). Is that what we
want?

 diff.c     |   28 +++++++++++-----------------
 diff.h     |   11 +++++++++++
 log-tree.c |    5 ++++-
 3 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/diff.c b/diff.c
index 8b44756..6a71376 100644
--- a/diff.c
+++ b/diff.c
@@ -17,15 +17,6 @@ static int diff_detect_rename_default = 
 static int diff_rename_limit_default = -1;
 static int diff_use_color_default = 0;
 
-enum color_diff {
-	DIFF_RESET = 0,
-	DIFF_PLAIN = 1,
-	DIFF_METAINFO = 2,
-	DIFF_FRAGINFO = 3,
-	DIFF_FILE_OLD = 4,
-	DIFF_FILE_NEW = 5,
-};
-
 /* "\033[1;38;5;2xx;48;5;2xxm\0" is 23 bytes */
 static char diff_colors[][24] = {
 	"\033[m",	/* reset */
@@ -33,7 +24,8 @@ static char diff_colors[][24] = {
 	"\033[1m",	/* bold */
 	"\033[36m",	/* cyan */
 	"\033[31m",	/* red */
-	"\033[32m"	/* green */
+	"\033[32m",	/* green */
+	"\033[33m"	/* yellow */
 };
 
 static int parse_diff_color_slot(const char *var, int ofs)
@@ -48,6 +40,8 @@ static int parse_diff_color_slot(const c
 		return DIFF_FILE_OLD;
 	if (!strcasecmp(var+ofs, "new"))
 		return DIFF_FILE_NEW;
+	if (!strcasecmp(var+ofs, "commit"))
+		return DIFF_COMMIT;
 	die("bad config variable '%s'", var);
 }
 
@@ -370,7 +364,7 @@ struct emit_callback {
 	const char **label_path;
 };
 
-static inline const char *get_color(int diff_use_color, enum color_diff ix)
+const char *diff_get_color(int diff_use_color, enum color_diff ix)
 {
 	if (diff_use_color)
 		return diff_colors[ix];
@@ -381,8 +375,8 @@ static void fn_out_consume(void *priv, c
 {
 	int i;
 	struct emit_callback *ecbdata = priv;
-	const char *set = get_color(ecbdata->color_diff, DIFF_METAINFO);
-	const char *reset = get_color(ecbdata->color_diff, DIFF_RESET);
+	const char *set = diff_get_color(ecbdata->color_diff, DIFF_METAINFO);
+	const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
 
 	if (ecbdata->label_path[0]) {
 		printf("%s--- %s%s\n", set, ecbdata->label_path[0], reset);
@@ -397,7 +391,7 @@ static void fn_out_consume(void *priv, c
 		;
 	if (2 <= i && i < len && line[i] == ' ') {
 		ecbdata->nparents = i - 1;
-		set = get_color(ecbdata->color_diff, DIFF_FRAGINFO);
+		set = diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO);
 	}
 	else if (len < ecbdata->nparents)
 		set = reset;
@@ -410,7 +404,7 @@ static void fn_out_consume(void *priv, c
 			else if (line[i] == '+')
 				color = DIFF_FILE_NEW;
 		}
-		set = get_color(ecbdata->color_diff, color);
+		set = diff_get_color(ecbdata->color_diff, color);
 	}
 	if (len > 0 && line[len-1] == '\n')
 		len--;
@@ -767,8 +761,8 @@ static void builtin_diff(const char *nam
 	mmfile_t mf1, mf2;
 	const char *lbl[2];
 	char *a_one, *b_two;
-	const char *set = get_color(o->color_diff, DIFF_METAINFO);
-	const char *reset = get_color(o->color_diff, DIFF_RESET);
+	const char *set = diff_get_color(o->color_diff, DIFF_METAINFO);
+	const char *reset = diff_get_color(o->color_diff, DIFF_RESET);
 
 	a_one = quote_two("a/", name_a);
 	b_two = quote_two("b/", name_b);
diff --git a/diff.h b/diff.h
index a06f959..2cced53 100644
--- a/diff.h
+++ b/diff.h
@@ -69,6 +69,17 @@ struct diff_options {
 	add_remove_fn_t add_remove;
 };
 
+enum color_diff {
+	DIFF_RESET = 0,
+	DIFF_PLAIN = 1,
+	DIFF_METAINFO = 2,
+	DIFF_FRAGINFO = 3,
+	DIFF_FILE_OLD = 4,
+	DIFF_FILE_NEW = 5,
+	DIFF_COMMIT = 6,
+};
+const char *diff_get_color(int diff_use_color, enum color_diff ix);
+
 extern const char mime_boundary_leader[];
 
 extern void diff_tree_setup_paths(const char **paths, struct diff_options *);
diff --git a/log-tree.c b/log-tree.c
index 9d8d46f..b71cf9b 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -129,7 +129,8 @@ void show_log(struct rev_info *opt, cons
 			opt->diffopt.stat_sep = buffer;
 		}
 	} else {
-		printf("%s%s",
+		printf("%s%s%s",
+		       diff_get_color(opt->diffopt.color_diff, DIFF_COMMIT),
 		       opt->commit_format == CMIT_FMT_ONELINE ? "" : "commit ",
 		       diff_unique_abbrev(commit->object.sha1, abbrev_commit));
 		if (opt->parents)
@@ -139,6 +140,8 @@ void show_log(struct rev_info *opt, cons
 			       diff_unique_abbrev(parent->object.sha1,
 						  abbrev_commit));
 		putchar(opt->commit_format == CMIT_FMT_ONELINE ? ' ' : '\n');
+		printf("%s",
+		       diff_get_color(opt->diffopt.color_diff, DIFF_RESET));
 	}
 
 	/*
-- 
1.4.2.rc1.gc470-dirty

^ permalink raw reply related

* Re: [RFC] Colorize 'commit' lines in log ui
From: Jan-Benedict Glaw @ 2006-07-23 11:24 UTC (permalink / raw)
  To: Jeff King; +Cc: git, Junio C Hamano
In-Reply-To: <20060723092417.GA7547@coredump.intra.peff.net>

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

On Sun, 2006-07-23 05:24:18 -0400, Jeff King <peff@peff.net> wrote:
> @@ -33,7 +24,8 @@ static char diff_colors[][24] = {
>  	"\033[1m",	/* bold */
>  	"\033[36m",	/* cyan */
>  	"\033[31m",	/* red */
> -	"\033[32m"	/* green */
> +	"\033[32m",	/* green */
> +	"\033[33m"	/* yellow */
>  };
>  
>  static int parse_diff_color_slot(const char *var, int ofs)

If people only were used to *always* place a comma behind the last
array element, the diff would be shorter by one line each time...

MfG, JBG

-- 
       Jan-Benedict Glaw       jbglaw@lug-owl.de                +49-172-7608481
 Signature of:                     ...und wenn Du denkst, es geht nicht mehr,
 the second  :                            kommt irgendwo ein Lichtlein her.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: Makefile checks for DarwinPorts / Fink
From: Jakub Narebski @ 2006-07-23 13:00 UTC (permalink / raw)
  To: git
In-Reply-To: <20060723054531.GA12559@spearce.org>

Shawn Pearce wrote:

> This is a slightly cleaner version of my prior patch.  :-)
> 
> -->8--
> Disable linking with Fink or DarwinPorts.
> 
> It may be desirable for the compiler to disable linking against Fink
> or DarwinPorts, especially if both are installed on the system and
> the user wants GIT to be linked specifically to only one of them.
> 
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Could you _please_ document this option in commentary part in main Makefile?
TIA. 

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: GIT user survey
From: Jakub Narebski @ 2006-07-23 13:18 UTC (permalink / raw)
  To: git
In-Reply-To: <4d8e3fd30607230145i2480c20fxb06127c8b0187c98@mail.gmail.com>

Paolo Ciarrocchi wrote:

> If you know people using GIT please forward this message to them,
> currently is has been sent to the following projects:
> - u-boot
> - wine
> - cairo
> - xmms2
> - xcb

Check out http://git.or.cz/gitwiki/GitProjects

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Your money, orange-striped
From: Carla Herrington @ 2006-07-23 17:26 UTC (permalink / raw)
  To: git-commits-head-owner

Genuine Swiss made RoleKx repilcas are as close to the real thing 
as a repilca watch can be. Sometimes even the professional jewelers 
are unable to tell the difference from the real Role2x watch.

Why spend thousands of dollars on the real deal when 
a repilca watch looks so much alike that only an expert could tell the difference...
And you only pay a fractoin of the price.

VISIT US, AND GET OUR SPECIL 370% DISLCOUNT OFER!

http://23IJQJF1hou6k7r777ckjjz6j1zo1jj.unrhymedad.com/

==========
     "See here Jonathan " said his father not unkindly. "Winter isn't  far
the window, too.  The glass in our  windows is thick and leaded.  And beyond
something over two hundred miles per hour, into a cliff of solid granite.
crossed over the hillock  and moved  on and on toward us, right next  to the
     Jonathan stayed and worked with the new birds coming in, who were all
     I stepped inside  and went straight for the canisters.  I crouched over

globe and you  start firing bullets into it.  The bullet  holes would lie on
that the  rescue squad had climbed into  their helicopter, the firemen  were

^ permalink raw reply

* [PATCH] show-branch: Fix another performance problem.
From: Alexandre Julliard @ 2006-07-23 17:51 UTC (permalink / raw)
  To: git

When naming commits, stop walking the parent chain as soon as we find
a commit that already has a name. The parent chain of that commit will
be walked later on in any case (or may even have been walked already).
This avoids O(n^2) behavior; on a tree where show-branch displays 6800
commits, the total run time drops from 77 seconds to 5 seconds.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 builtin-show-branch.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/builtin-show-branch.c b/builtin-show-branch.c
index 3d240ca..82f75b7 100644
--- a/builtin-show-branch.c
+++ b/builtin-show-branch.c
@@ -89,6 +89,8 @@ static int name_first_parent_chain(struc
 			name_parent(c, p);
 			i++;
 		}
+		else
+			break;
 		c = p;
 	}
 	return i;
-- 
1.4.2.rc1.ge7a0

-- 
Alexandre Julliard
julliard@winehq.org

^ permalink raw reply related

* [PATCH 1/4] gitweb.cgi: Teach git_history() to read hash from $hash_base
From: Luben Tuikov @ 2006-07-23 20:26 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

Teach git_history() to take its hash argument from
the hb parameter, i.e. from $hash_base.  Also change
all "a=history" actions to pass "hb=" instead of "h=".

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 2795696785-p1.patch --]
[-- Type: text/inline; name="p1.patch", Size: 5250 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2fd1e5f..d976d4a 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1687,7 +1687,7 @@ sub git_tree {
 			      "<td class=\"link\">" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
 #			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
-			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
+			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") .
 			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") .
 			      "</td>\n";
 		} elsif ($t_type eq "tree") {
@@ -1696,7 +1696,7 @@ #			      " | " . $cgi->a({-href => "$my
 			      "</td>\n" .
 			      "<td class=\"link\">" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$t_hash$base_key;f=$base$t_name")}, "tree") .
-			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash_base;f=$base$t_name")}, "history") .
+			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") .
 			      "</td>\n";
 		}
 		print "</tr>\n";
@@ -2041,7 +2041,7 @@ sub git_commit {
 			      "<td><span class=\"file_status deleted\">[deleted " . file_type($from_mode). "]</span></td>\n" .
 			      "<td class=\"link\">" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$from_id;hb=$hash;f=$file")}, "blob") .
-			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") .
+			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") .
 			      "</td>\n"
 		} elsif ($status eq "M" || $status eq "T") {
 			my $mode_chnge = "";
@@ -2072,7 +2072,7 @@ sub git_commit {
 			if ($to_id ne $from_id) {
 				print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff;h=$to_id;hp=$from_id;hb=$hash;f=$file")}, "diff");
 			}
-			print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$hash;f=$file")}, "history") . "\n";
+			print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash;f=$file")}, "history") . "\n";
 			print "</td>\n";
 		} elsif ($status eq "R") {
 			my ($from_file, $to_file) = split "\t", $file;
@@ -2293,10 +2293,10 @@ sub git_commitdiff_plain {
 }
 
 sub git_history {
-	if (!defined $hash) {
-		$hash = git_read_head($project);
+	if (!defined $hash_base) {
+		$hash_base = git_read_head($project);
 	}
-	my %co = git_read_commit($hash);
+	my %co = git_read_commit($hash_base);
 	if (!%co) {
 		die_error(undef, "Unknown commit object.");
 	}
@@ -2306,18 +2306,18 @@ sub git_history {
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
 	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
 	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
-	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
-	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff") .
-	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") .
+	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
+	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
+	      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") .
 	      "<br/><br/>\n" .
 	      "</div>\n";
 	print "<div>\n" .
-	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
+	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
 	      "</div>\n";
 	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
 
 	open my $fd, "-|",
-		"$GIT rev-list --full-history $hash -- \'$file_name\'";
+		"$GIT rev-list --full-history $hash_base -- \'$file_name\'";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
 	while (my $line = <$fd>) {
@@ -2345,8 +2345,7 @@ sub git_history {
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$commit")}, "commit") .
 			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$commit")}, "commitdiff") .
 			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=$commit;f=$file_name")}, "blob");
-			my $blob = git_get_hash_by_path($hash, $file_name);
+			my $blob = git_get_hash_by_path($hash_base, $file_name);
 			my $blob_parent = git_get_hash_by_path($commit, $file_name);
 			if (defined $blob && defined $blob_parent && $blob ne $blob_parent) {
 				print " | " .
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 2/4] gitweb.cgi: Include direct link to "raw" files from "history"
From: Luben Tuikov @ 2006-07-23 20:28 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 440 bytes --]

In "history" view, the "page_path" is now also a URL link to
the "raw" format of the file, which will always give you
the latest version in the repository.

This is helpful for externally linking files, such that
the latest version is always referenced and in "raw" format.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   35 +++++++++++++++++++++++++++++------
 1 files changed, 29 insertions(+), 6 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 3952834181-p2.patch --]
[-- Type: text/inline; name="p2.patch", Size: 3229 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index d976d4a..7a61de4 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1531,6 +1531,14 @@ sub git_blob_plain_mimetype {
 }
 
 sub git_blob_plain {
+	if (!defined $hash) {
+                if (defined $file_name) {
+                        my $base = $hash_base || git_read_head($project);
+                        $hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
+                } else {
+                        die_error(undef, "No file name defined.");
+                }
+        }
 	my $type = shift;
 	open my $fd, "-|", "$GIT cat-file blob $hash" or die_error("Couldn't cat $file_name, $hash");
 
@@ -1554,10 +1562,14 @@ sub git_blob_plain {
 }
 
 sub git_blob {
-	if (!defined $hash && defined $file_name) {
-		my $base = $hash_base || git_read_head($project);
-		$hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
-	}
+	if (!defined $hash) {
+                if (defined $file_name) {
+                        my $base = $hash_base || git_read_head($project);
+                        $hash = git_get_hash_by_path($base, $file_name, "blob") || die_error(undef, "Error lookup file.");
+                } else {
+                        die_error(undef, "No file name defined.");
+                }
+        }
 	my $have_blame = git_get_project_config_bool ('blame');
 	open my $fd, "-|", "$GIT cat-file blob $hash" or die_error(undef, "Open failed.");
 	my $mimetype = git_blob_plain_mimetype($fd, $file_name);
@@ -1687,7 +1699,7 @@ sub git_tree {
 			      "<td class=\"link\">" .
 			      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$t_hash$base_key;f=$base$t_name")}, "blob") .
 #			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$t_hash$base_key;f=$base$t_name")}, "blame") .
-			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;hb=$hash_base;f=$base$t_name")}, "history") .
+			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=history;h=$t_hash;hb=$hash_base;f=$base$t_name")}, "history") .
 			      " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$t_hash;f=$base$t_name")}, "raw") .
 			      "</td>\n";
 		} elsif ($t_type eq "tree") {
@@ -2314,8 +2326,18 @@ sub git_history {
 	print "<div>\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
 	      "</div>\n";
-	print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
+	if (defined $hash) {
+		my $ftype = git_get_type($hash);
+
+		if ($ftype =~ "blob") {
+		    print "<div class=\"page_path\"><b>/" .
+			$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;f=$file_name")}, esc_html($file_name)) . "</b><br/></div>\n";
+		} else {
+		    print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
+		}
+	} else {
+		print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
+	}
 
 	open my $fd, "-|",
 		"$GIT rev-list --full-history $hash_base -- \'$file_name\'";
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 3/4] gitweb.cgi: Show "raw" head of project link even when $hash is not defined
From: Luben Tuikov @ 2006-07-23 20:30 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 237 bytes --]

Some callers of git_history() do not set $hash of $file_name.
Add code to find it, if it is not defined.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 963471848-p3.patch --]
[-- Type: text/inline; name="p3.patch", Size: 537 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 7a61de4..c04283b 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -2326,7 +2326,9 @@ sub git_history {
 	print "<div>\n" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) . "\n" .
 	      "</div>\n";
+	if (!defined $hash && defined $file_name) {
+		$hash = git_get_hash_by_path($hash_base, $file_name);
+	}
 	if (defined $hash) {
 		my $ftype = git_get_type($hash);
 
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 4/4] gitweb.cgi: Centralize printing of the page path
From: Luben Tuikov @ 2006-07-23 20:31 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 322 bytes --]

Centralize printing of the page path so that
if the entity is a blob, we can set the page path
to be the link to the HEAD revision of the
"raw" blob.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   41 +++++++++++++++++++++--------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 2013183029-p4.patch --]
[-- Type: text/inline; name="p4.patch", Size: 3349 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index c04283b..4106cb8 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1199,6 +1199,20 @@ sub git_summary {
 	git_footer_html();
 }
 
+sub git_print_page_path {
+	my $name = shift;
+	my $type = shift;
+
+	if (!defined $name) {
+		print "<div class=\"page_path\"><b>/</b></div>\n";
+	} elsif ($type =~ "blob") {
+		print "<div class=\"page_path\"><b>" .
+			$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;f=$file_name")}, esc_html($name)) . "</b><br/></div>\n";
+	} else {
+		print "<div class=\"page_path\"><b>" . esc_html($name) . "</b><br/></div>\n";
+	}
+}
+
 sub git_tag {
 	my $head = git_read_head($project);
 	git_header_html();
@@ -1266,7 +1280,7 @@ sub git_blame {
 		"<div>" .
 		$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
 		"</div>\n";
-	print "<div class=\"page_path\"><b>" . esc_html($file_name) . "</b></div>\n";
+	git_print_page_path($file_name);
 	print "<div class=\"page_body\">\n";
 	print <<HTML;
 <table class="blame">
@@ -1604,9 +1618,7 @@ sub git_blob {
 		      "<br/><br/></div>\n" .
 		      "<div class=\"title\">$hash</div>\n";
 	}
-	if (defined $file_name) {
-		print "<div class=\"page_path\"><b>" . esc_html($file_name) . "</b></div>\n";
-	}
+	git_print_page_path($file_name, "blob");
 	print "<div class=\"page_body\">\n";
 	my $nr;
 	while (my $line = <$fd>) {
@@ -1671,10 +1683,8 @@ sub git_tree {
 	}
 	if (defined $file_name) {
 		$base = esc_html("$file_name/");
-		print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b></div>\n";
-	} else {
-		print "<div class=\"page_path\"><b>/</b></div>\n";
 	}
+	git_print_page_path($file_name);
 	print "<div class=\"page_body\">\n";
 	print "<table cellspacing=\"0\">\n";
 	my $alternate = 0;
@@ -2132,9 +2142,7 @@ sub git_blobdiff {
 		      "<br/><br/></div>\n" .
 		      "<div class=\"title\">$hash vs $hash_parent</div>\n";
 	}
-	if (defined $file_name) {
-		print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b></div>\n";
-	}
+	git_print_page_path($file_name, "blob");
 	print "<div class=\"page_body\">\n" .
 	      "<div class=\"diff_info\">blob:" .
 	      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash_parent;hb=$hash_base;f=$file_name")}, $hash_parent) .
@@ -2308,6 +2316,7 @@ sub git_history {
 	if (!defined $hash_base) {
 		$hash_base = git_read_head($project);
 	}
+	my $ftype;
 	my %co = git_read_commit($hash_base);
 	if (!%co) {
 		die_error(undef, "Unknown commit object.");
@@ -2330,18 +2339,9 @@ sub git_history {
 		$hash = git_get_hash_by_path($hash_base, $file_name);
 	}
 	if (defined $hash) {
-		my $ftype = git_get_type($hash);
-
-		if ($ftype =~ "blob") {
-		    print "<div class=\"page_path\"><b>/" .
-			$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;f=$file_name")}, esc_html($file_name)) . "</b><br/></div>\n";
-		} else {
-		    print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
-		}
-	} else {
-		print "<div class=\"page_path\"><b>/" . esc_html($file_name) . "</b><br/></div>\n";
+		$ftype = git_get_type($hash);
 	}
+	git_print_page_path($file_name, $ftype);
 
 	open my $fd, "-|",
 		"$GIT rev-list --full-history $hash_base -- \'$file_name\'";
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 1/3] gitweb.cgi: git_blame2: an alternative simple working git blame
From: Luben Tuikov @ 2006-07-23 20:34 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 554 bytes --]

This patch adds an alternative simple working git-blame
called git_blame2().  Simple, because it displays just
three columns: the commit, the line number and the line
of code.  Alternative, because the original git_blame()
is left untouched.  Lines of code are printed html
escaped, but as-is.

git_blame2() uses git-blame as opposed to git-annotate
used by git_blame().

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   71 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 1 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 2795696785-p1.patch --]
[-- Type: text/inline; name="p1.patch", Size: 3420 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 4106cb8..57f4a2e 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -227,7 +227,7 @@ if (!defined $action || $action eq "summ
 	git_tag();
 	exit;
 } elsif ($action eq "blame") {
-	git_blame();
+	git_blame2();
 	exit;
 } else {
 	undef $action;
@@ -1252,7 +1252,75 @@ sub git_tag {
 	git_footer_html();
 }
 
+sub git_read_blame_line {
+	my %bl;
+	$_ = shift;
+
+	($bl{'hash'}, $bl{'lineno'}, $bl{'data'}) = /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
+
+	return %bl;
+}
+
+sub git_blame2 {
+	my $fd;
+	my $ftype;
+	die_error(undef, "Permission denied.") if (!git_get_project_config_bool ('blame'));
+	die_error('404 Not Found', "File name not defined") if (!$file_name);
+	$hash_base ||= git_read_head($project);
+	die_error(undef, "Reading commit failed") unless ($hash_base);
+	my %co = git_read_commit($hash_base)
+		or die_error(undef, "Reading commit failed");
+	if (!defined $hash) {
+		$hash = git_get_hash_by_path($hash_base, $file_name, "blob")
+			or die_error(undef, "Error looking up file");
+	}
+	$ftype = git_get_type($hash);
+	if ($ftype !~ "blob") {
+		die_error("400 Bad Request", "object is not a blob");
+	}
+	open ($fd, "-|", $GIT, "blame", '-l', $file_name, $hash_base)
+		or die_error(undef, "Open failed");
+	git_header_html();
+	print "<div class=\"page_nav\">\n" .
+		$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "log") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base")}, "commit") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash_base")}, "commitdiff") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash_base")}, "tree") . "<br/>\n";
+	print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;h=$hash;hb=$hash_base;f=$file_name")}, "blob") .
+		" | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;f=$file_name")}, "head") . "<br/>\n";
+	print "</div>\n".
+		"<div>" .
+		$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
+		"</div>\n";
+	git_print_page_path($file_name, $ftype);
+
+	print "<div class=\"page_body\">\n";
+
+	print "<table class=\"blame\">\n";
+	print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
+	while (my $line = <$fd>) {
+		my %blame_line = git_read_blame_line($line);
+		my $full_rev = $blame_line{'hash'};
+		my $rev = substr($full_rev, 0, 8);
+		my $lineno = $blame_line{'lineno'};
+		my $data = $blame_line{'data'};
+
+		print "<tr>\n";
+		print "<td class=\"sha1\">" .
+			$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$full_rev;f=$file_name")}, esc_html($rev)) . "</td>\n";
+		print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" . esc_html($lineno) . "</a></td>\n";
+		print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
+		print "</tr>\n";
+	}
+	print "</table>\n";
+	print "</div>";
+
+	close $fd or print "Reading blob failed\n";
+	git_footer_html();
+}
+
 sub git_blame {
 	my $fd;
 	die_error('403 Permission denied', "Permission denied.") if (!git_get_project_config_bool ('blame'));
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 2/3] gitweb.cgi: git_blame2: Allow back-trekking through commits
From: Luben Tuikov @ 2006-07-23 20:36 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 292 bytes --]

This patch adds the capability of back-trekking through
commits from git_blame2() as follows:
blame2->commit->blame2->commit->blame2->...->initial commit.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 3952834181-p2.patch --]
[-- Type: text/inline; name="p2.patch", Size: 896 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 57f4a2e..2c2d9c8 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -2022,8 +2022,13 @@ sub git_commit {
 		print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash")}, "commitdiff");
 	}
 	print " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "\n" .
-	      "<br/><br/></div>\n";
+		"<br/>\n";
+	if (defined $file_name && defined $co{'parent'}) {
+		my $parent = $co{'parent'};
+		print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;hb=$parent;f=$file_name")}, "blame") . "\n";
+	}
+	print "<br/></div>\n";
+
 	if (defined $co{'parent'}) {
 		print "<div>\n" .
 		      $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH 3/3] gitweb.cgi: git_blame2: Revision blocks now have alternating colors
From: Luben Tuikov @ 2006-07-23 20:37 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 556 bytes --]

A revision block is the largest number of adjacent
lines of code originating from the same revision.

This patch adds color to git_blame2(), in that no two
adjacent revision blocks have the same color.  The color
alternates between light and dark.

As we annotate the code lines, we alternate the color
(light, dark) of code lines _per revision_.  This makes it
easier to see line conglomerations per revision.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 963471848-p3.patch --]
[-- Type: text/inline; name="p3.patch", Size: 1471 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2c2d9c8..16340f2 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1295,9 +1295,11 @@ sub git_blame2 {
 		$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
 		"</div>\n";
 	git_print_page_path($file_name, $ftype);
-
+	my @rev_color = (qw(light dark));
+	my $num_colors = scalar(@rev_color);
+	my $current_color = 0;
+	my $last_rev;
 	print "<div class=\"page_body\">\n";
-
 	print "<table class=\"blame\">\n";
 	print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
 	while (my $line = <$fd>) {
@@ -1307,7 +1309,13 @@ sub git_blame2 {
 		my $lineno = $blame_line{'lineno'};
 		my $data = $blame_line{'data'};
 
-		print "<tr>\n";
+		if (!defined $last_rev) {
+			$last_rev = $full_rev;
+		} elsif ($last_rev ne $full_rev) {
+			$last_rev = $full_rev;
+			$current_color = ++$current_color % $num_colors;
+		}
+		print "<tr class=\"$rev_color[$current_color]\">\n";
 		print "<td class=\"sha1\">" .
 			$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$full_rev;f=$file_name")}, esc_html($rev)) . "</td>\n";
 		print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" . esc_html($lineno) . "</a></td>\n";
@@ -1316,8 +1324,6 @@ sub git_blame2 {
 	}
 	print "</table>\n";
 	print "</div>";
-
 	close $fd or print "Reading blob failed\n";
 	git_footer_html();
 }
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH] gitweb.cgi: git_blame2: slight optimization reading the blame lines
From: Luben Tuikov @ 2006-07-23 21:17 UTC (permalink / raw)
  To: git

[-- Attachment #1: Type: text/plain, Size: 223 bytes --]

Eliminate git_read_blame_line() -- move that code inline and
optimize it.

Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
 gitweb/gitweb.cgi |   19 +++++--------------
 1 files changed, 5 insertions(+), 14 deletions(-)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 2795696785-p1.patch --]
[-- Type: text/inline; name="p1.patch", Size: 1010 bytes --]

diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 16340f2..7fbfc0d 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1252,15 +1252,6 @@ sub git_tag {
 	git_footer_html();
 }
 
-sub git_read_blame_line {
-	my %bl;
-	$_ = shift;
-
-	($bl{'hash'}, $bl{'lineno'}, $bl{'data'}) = /^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
-
-	return %bl;
-}
-
 sub git_blame2 {
 	my $fd;
 	my $ftype;
@@ -1302,13 +1293,12 @@ sub git_blame2 {
 	print "<div class=\"page_body\">\n";
 	print "<table class=\"blame\">\n";
 	print "<tr><th>Commit</th><th>Line</th><th>Data</th></tr>\n";
-	while (my $line = <$fd>) {
-		my %blame_line = git_read_blame_line($line);
-		my $full_rev = $blame_line{'hash'};
+	while (<$fd>) {
+		/^([0-9a-fA-F]{40}).*?(\d+)\)\s{1}(\s*.*)/;
+		my $full_rev = $1;
 		my $rev = substr($full_rev, 0, 8);
-		my $lineno = $blame_line{'lineno'};
-		my $data = $blame_line{'data'};
+		my $lineno = $2;
+		my $data = $3;
 
 		if (!defined $last_rev) {
 			$last_rev = $full_rev;
-- 
1.4.2.rc1.g9b54


^ permalink raw reply related

* [PATCH] support cover letter before commit log, using "+++"
From: Martin Waitz @ 2006-07-23 21:45 UTC (permalink / raw)
  To: git

We already have a "---" separator to end the commit log.
But writing the cover letter after this separator looks strange.
Now it is possible to put the cover letter and comments both before
or after the commit log, as the author sees fit.

Just put the commit log between lines starting with "+++" and "---".

Signed-off-by: Martin Waitz <tali@admingilde.org>
---
 builtin-mailinfo.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index ac53f76..a1cfc81 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -690,6 +690,13 @@ static int handle_commit_msg(int *seen)
 			return 1;
 		}
 
+		/* check for separator between cover-letter and commit log */
+		if (!memcmp("+++", line, 3)) {
+			rewind(cmitmsg);
+			ftruncate(fileno(cmitmsg), 0);
+			continue;
+		}
+
 		/* Unwrap transfer encoding and optionally
 		 * normalize the log message to UTF-8.
 		 */
-- 
1.4.1.gd3582

-- 
Martin Waitz

^ permalink raw reply related

* Hey, buddy, you must be very disappointed of it!
From: Echols @ 2006-07-23 20:50 UTC (permalink / raw)
  To: glenn

Hello bro, Leave complaining to others. You deserve to get rid of this. The great thing about Extra-Time is that it works, making you last longer from the very first time. It starts great but you feel like finishing within very first minutes? This is a common thing. Enter here:  http://florexx.com/gall/get/ Confidence and affection of your partner are the greatest things you get.

^ permalink raw reply

* Re: [RFC] Colorize 'commit' lines in log ui
From: Jeff King @ 2006-07-23 22:01 UTC (permalink / raw)
  To: Jan-Benedict Glaw; +Cc: git, Junio C Hamano
In-Reply-To: <20060723112422.GB27825@lug-owl.de>

On Sun, Jul 23, 2006 at 01:24:22PM +0200, Jan-Benedict Glaw wrote:

> If people only were used to *always* place a comma behind the last
> array element, the diff would be shorter by one line each time...

I agree that it's much more convenient; I left it off because it wasn't
there before and I thought there were some standardization issues.

As it turns out, the situation is quite ridiculous. C89 allowed trailing
commas in initialization lists but not in enums. Most compilers (gcc,
sun) accepted it anyway, but some (aix xlc) did not.

Do we care? I think probably not, since the color_diff enum already had
a trailing comma. It seems like the primary non-gcc compiler that has
been mentioned is sun cc. I don't know what other compilers are being
used to compile git.

-Peff

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox