* Re: [PATCH] pager: config variable pager.color
From: Johannes Schindelin @ 2006-07-29 23:15 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
In-Reply-To: <E1G6xHb-0008Rw-G2@moooo.ath.cx>
Hi,
On Sun, 30 Jul 2006, Matthias Lederhofer wrote:
> diff --git a/builtin-log.c b/builtin-log.c
> index 82c69d1..7fdefec 100644
> --- a/builtin-log.c
> +++ b/builtin-log.c
> @@ -34,7 +34,6 @@ static int cmd_log_walk(struct rev_info
> struct commit *commit;
>
> prepare_revision_walk(rev);
> - setup_pager();
> while ((commit = get_revision(rev)) != NULL) {
> log_tree_commit(rev, commit);
> free(commit->buffer);
> @@ -49,6 +48,7 @@ int cmd_whatchanged(int argc, const char
> {
> struct rev_info rev;
>
> + setup_pager();
> git_config(git_diff_ui_config);
> init_revisions(&rev, prefix);
> rev.diff = 1;
> @@ -64,6 +64,7 @@ int cmd_show(int argc, const char **argv
> {
> struct rev_info rev;
>
> + setup_pager();
> git_config(git_diff_ui_config);
> init_revisions(&rev, prefix);
> rev.diff = 1;
> @@ -81,6 +82,7 @@ int cmd_log(int argc, const char **argv,
> {
> struct rev_info rev;
>
> + setup_pager();
> git_config(git_diff_ui_config);
> init_revisions(&rev, prefix);
> rev.always_show_header = 1;
Why? The three users of cmd_log_walk() need to call setup_pager()
explicitely, when cmd_log_walk() can do it for them?
Oh, and I do not really understand why you would enable color _at all_ if
you want to disable it when paging. Do you have many instances when you
want a color diff which is short enough not to be paged?
Ciao,
Dscho
^ permalink raw reply
* Re: git prune pig slow
From: Linus Torvalds @ 2006-07-29 23:48 UTC (permalink / raw)
To: linux; +Cc: git
In-Reply-To: <20060729224106.12312.qmail@science.horizon.com>
On Sat, 29 Jul 2006, linux@horizon.com wrote:
>
> No, that's dangerous too. The index file is considered part of the root
> set for git-fsck-objects, but not for git-repack.
Indeed.
Although at least you won't lose any history - at worst you'll have to
basically do a "git reset HEAD" to make things right again.
I was careful when I wrote the new git-prune to take the index into
account, but I'd forgotten about it wrt the "git repack -a -d" suggestion.
Linus
^ permalink raw reply
* Re: [PATCH] pager: config variable pager.color
From: Matthias Lederhofer @ 2006-07-30 0:43 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0607300112340.29667@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Why? The three users of cmd_log_walk() need to call setup_pager()
> explicitely, when cmd_log_walk() can do it for them?
The explanation is below the commit message:
"setup_pager has to be called before git_diff_ui_config because the
latter uses pager_use_color initialized by setup_pager."
> Oh, and I do not really understand why you would enable color _at all_ if
> you want to disable it when paging. Do you have many instances when you
> want a color diff which is short enough not to be paged?
When I use a pager that escapes the escape character or highlights the
content itself the output of git diff without the pager should have
colors but not with the pager. For example using git diff with a
pathspec is quite short most of the time. For git diff I have to
enable paging manually and run git diff | $PAGER usually but git log
uses the pager automatically and should not use colors with it.
^ permalink raw reply
* Re: [RFC] Add the --color-words option to the diff options family
From: Matthias Lederhofer @ 2006-07-30 0:57 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0607282354450.29667@wbgn013.biozentrum.uni-wuerzburg.de>
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> With this option, the changed words are shown inline. For example,
> if a file containing "This is foo" is changed to "This is bar", the diff
> will now show "This is " in plain text, "foo" in red, and "bar" in green.
>
> Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
>
> ---
>
> I am probably the only person who finds it useful, but there
> is a high coolness factor attached to it.
>
> And the libxdiff library actually made it very easy to do. (Yes,
> there are two nested calls to xdiff...)
I'd probably find it more useful if it would still show two lines but
only the relevant part in red/green.
^ permalink raw reply
* [PATCH] allow alias expansion without a git directory
From: Matthias Lederhofer @ 2006-07-30 1:30 UTC (permalink / raw)
To: git
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
With this patch
[alias]
init = init-db --template=/path/to/template
is usable.
The change in setup_git_directory_gently is a bug which did not cause
any problems yet (afaict): setup_git_directory_gently did die even
though nongit_ok was not NULL. Without this GIT_DIR=.foo git init
will die.
---
git.c | 76 ++++++++++++++++++++++++++++++---------------------------------
setup.c | 4 +++
2 files changed, 40 insertions(+), 40 deletions(-)
diff --git a/git.c b/git.c
index 452180e..7321d6c 100644
--- a/git.c
+++ b/git.c
@@ -156,52 +156,48 @@ static int handle_alias(int *argcp, cons
{
int nongit = 0, ret = 0, saved_errno = errno;
const char *subdir;
+ int count, option_count;
+ const char** new_argv;
subdir = setup_git_directory_gently(&nongit);
- if (!nongit) {
- int count, option_count;
- const char** new_argv;
-
- alias_command = (*argv)[0];
- git_config(git_alias_config);
- if (alias_string) {
-
- count = split_cmdline(alias_string, &new_argv);
- option_count = handle_options(&new_argv, &count);
- memmove(new_argv - option_count, new_argv,
- count * sizeof(char *));
- new_argv -= option_count;
-
- if (count < 1)
- die("empty alias for %s", alias_command);
-
- if (!strcmp(alias_command, new_argv[0]))
- die("recursive alias: %s", alias_command);
-
- if (getenv("GIT_TRACE")) {
- int i;
- fprintf(stderr, "trace: alias expansion: %s =>",
- alias_command);
- for (i = 0; i < count; ++i) {
- fputc(' ', stderr);
- sq_quote_print(stderr, new_argv[i]);
- }
- fputc('\n', stderr);
- fflush(stderr);
- }
- new_argv = realloc(new_argv, sizeof(char*) *
- (count + *argcp + 1));
- /* insert after command name */
- memcpy(new_argv + count, *argv + 1,
- sizeof(char*) * *argcp);
- new_argv[count+*argcp] = NULL;
+ alias_command = (*argv)[0];
+ git_config(git_alias_config);
+ if (alias_string) {
+ count = split_cmdline(alias_string, &new_argv);
+ option_count = handle_options(&new_argv, &count);
+ memmove(new_argv - option_count, new_argv,
+ count * sizeof(char *));
+ new_argv -= option_count;
+
+ if (count < 1)
+ die("empty alias for %s", alias_command);
- *argv = new_argv;
- *argcp += count - 1;
+ if (!strcmp(alias_command, new_argv[0]))
+ die("recursive alias: %s", alias_command);
- ret = 1;
+ if (getenv("GIT_TRACE")) {
+ int i;
+ fprintf(stderr, "trace: alias expansion: %s =>",
+ alias_command);
+ for (i = 0; i < count; ++i) {
+ fputc(' ', stderr);
+ sq_quote_print(stderr, new_argv[i]);
+ }
+ fputc('\n', stderr);
+ fflush(stderr);
}
+
+ new_argv = realloc(new_argv, sizeof(char*) *
+ (count + *argcp + 1));
+ /* insert after command name */
+ memcpy(new_argv + count, *argv + 1, sizeof(char*) * *argcp);
+ new_argv[count+*argcp] = NULL;
+
+ *argv = new_argv;
+ *argcp += count - 1;
+
+ ret = 1;
}
if (subdir)
diff --git a/setup.c b/setup.c
index 4612f11..358e139 100644
--- a/setup.c
+++ b/setup.c
@@ -184,6 +184,10 @@ const char *setup_git_directory_gently(i
}
return NULL;
bad_dir_environ:
+ if (!nongit_ok) {
+ *nongit_ok = 1;
+ return NULL;
+ }
path[len] = 0;
die("Not a git repository: '%s'", path);
}
--
1.4.2.rc2.g91b7
^ permalink raw reply related
* [PATCH 5] gitweb: Cleanup - chomp $line in consistent style
From: Jakub Narebski @ 2006-07-30 2:08 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2c67df0..e1f0e26 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -635,7 +635,7 @@ sub git_diff_print {
$/ = "\n";
} else {
while (my $line = <$fd>) {
- chomp($line);
+ chomp $line;
my $char = substr($line, 0, 1);
my $diff_class = "";
if ($char eq '+') {
@@ -944,7 +944,7 @@ sub read_info_ref {
# c39ae07f393806ccf406ef966e9a15afc43cc36a refs/tags/v2.6.11^{}
open my $fd, "$projectroot/$project/info/refs" or return;
while (my $line = <$fd>) {
- chomp($line);
+ chomp $line;
if ($line =~ m/^([0-9a-fA-F]{40})\t.*$type\/([^\^]+)/) {
if (defined $refs{$1}) {
$refs{$1} .= " / $2";
--
1.4.0
^ permalink raw reply related
* [PATCH 6] gitweb: Correct error from changing "-|" open to list form in git_commit
From: Jakub Narebski @ 2006-07-30 2:11 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Correct error in moving to list form of open for running git commands
and reading their output through pipe (PATCH 2 in series) in
git_commit subroutine.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
It also simplifies git_commit a tiny bit.
gitweb/gitweb.cgi | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index e1f0e26..86b9547 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1984,16 +1984,14 @@ sub git_commit {
my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
my @difftree;
- my $root = "";
my $parent = $co{'parent'};
if (!defined $parent) {
- $root = " --root";
- $parent = "";
+ $parent = "--root";
}
- open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $root, $parent, $hash
+ open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
@difftree = map { chomp; $_ } <$fd>;
- close $fd or die_error(undef, "Reading diff-tree failed.");
+ close $fd or die_error(undef, "Reading git-diff-tree failed.");
# non-textual hash id's can be cached
my $expires;
--
1.4.0
^ permalink raw reply related
* Re: [PATCH 2] gitweb: Use list for of open for running git commands, thorougly.
From: Jakub Narebski @ 2006-07-30 2:12 UTC (permalink / raw)
To: git
In-Reply-To: <200607292251.21072.jnareb@gmail.com>
This patch introduces error in git_commit, corrected in [PATCH 6].
--
Jakub Narebski
^ permalink raw reply
* Re: [PATCH] pager: config variable pager.color
From: Johannes Schindelin @ 2006-07-30 9:33 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
In-Reply-To: <E1G6zPH-00062L-Je@moooo.ath.cx>
Hi,
On Sun, 30 Jul 2006, Matthias Lederhofer wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> > Why? The three users of cmd_log_walk() need to call setup_pager()
> > explicitely, when cmd_log_walk() can do it for them?
>
> The explanation is below the commit message:
> "setup_pager has to be called before git_diff_ui_config because the
> latter uses pager_use_color initialized by setup_pager."
>
> > Oh, and I do not really understand why you would enable color _at all_ if
> > you want to disable it when paging. Do you have many instances when you
> > want a color diff which is short enough not to be paged?
> When I use a pager that escapes the escape character or highlights the
> content itself the output of git diff without the pager should have
> colors but not with the pager. For example using git diff with a
> pathspec is quite short most of the time. For git diff I have to
> enable paging manually and run git diff | $PAGER usually but git log
> uses the pager automatically and should not use colors with it.
I understand now. Maybe you want to put such reasoning into the commit
message next time?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] allow alias expansion without a git directory
From: Johannes Schindelin @ 2006-07-30 9:34 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
In-Reply-To: <E1G708T-00073m-Hg@moooo.ath.cx>
Hi,
On Sun, 30 Jul 2006, Matthias Lederhofer wrote:
> diff --git a/setup.c b/setup.c
> index 4612f11..358e139 100644
> --- a/setup.c
> +++ b/setup.c
> @@ -184,6 +184,10 @@ const char *setup_git_directory_gently(i
> }
> return NULL;
> bad_dir_environ:
> + if (!nongit_ok) {
> + *nongit_ok = 1;
> + return NULL;
> + }
Funny. Yesterday, I looked through "git diff next", and decided to sync
this part, i.e. undo the change you just proposed...
Ciao,
Dscho
^ permalink raw reply
* Re: [RFC] Add the --color-words option to the diff options family
From: Johannes Schindelin @ 2006-07-30 9:36 UTC (permalink / raw)
To: Matthias Lederhofer; +Cc: git
In-Reply-To: <E1G6zc4-0007PC-9j@moooo.ath.cx>
Hi,
On Sun, 30 Jul 2006, Matthias Lederhofer wrote:
> Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
>
> > With this option, the changed words are shown inline. For example,
> > if a file containing "This is foo" is changed to "This is bar", the diff
> > will now show "This is " in plain text, "foo" in red, and "bar" in green.
>
> I'd probably find it more useful if it would still show two lines but
> only the relevant part in red/green.
I could do that if you want, but it is a little more involved. Besides, in
my use case, which is text with _long_ lines, it would be less useful, so
I would make it a switch.
Ciao,
Dscho
^ permalink raw reply
* Re: GIT user survey
From: Paolo Ciarrocchi @ 2006-07-30 9:48 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:
> 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
Thanks a lot to all the people that already filled the questionnaire.
We received 89 full filled questionnaires but we can do better, if you
didn't fill it please do it before the 6th of August.
Thanks.
regards,
--
Paolo
http://paolo.ciarrocchi.googlepages.com
http://picasaweb.google.com/paolo.ciarrocchi
^ permalink raw reply
* [PATCH 7] gitweb: Cleanup - chomp @lines in consistent style
From: Jakub Narebski @ 2006-07-30 12:58 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Use 'my @lines = map { chomp; $_ } <$fd>;' form to read all lines of
git command output into array without trailing newlines.
It has advantage over 'chomp (my (@lines) = <$fd>);' in that it does
not modify array.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 19 +++++++++----------
1 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 86b9547..d5248fe 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1064,7 +1064,7 @@ sub git_summary {
"</table>\n";
open my $fd, "-|", $GIT, "rev-list", "--max-count=17", git_read_head($project)
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog"), -class => "title"}, "shortlog") .
@@ -1709,7 +1709,7 @@ sub git_tree {
$/ = "\0";
open my $fd, "-|", $GIT, "ls-tree", '-z', $hash
or die_error(undef, "Open git-ls-tree failed.");
- chomp (my (@entries) = <$fd>);
+ my @entries = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading tree failed.");
$/ = "\n";
@@ -1791,7 +1791,7 @@ sub git_rss {
# http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
open my $fd, "-|", $GIT, "rev-list", "--max-count=150", git_read_head($project)
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading rev-list failed.");
print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
print "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n".
@@ -1900,7 +1900,7 @@ sub git_log {
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
if ($hash ne $head || $page) {
@@ -1983,14 +1983,13 @@ sub git_commit {
my %ad = date_str($co{'author_epoch'}, $co{'author_tz'});
my %cd = date_str($co{'committer_epoch'}, $co{'committer_tz'});
- my @difftree;
my $parent = $co{'parent'};
if (!defined $parent) {
$parent = "--root";
}
open my $fd, "-|", $GIT, "diff-tree", '-r', '-M', $parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- @difftree = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading git-diff-tree failed.");
# non-textual hash id's can be cached
@@ -2237,7 +2236,7 @@ sub git_commitdiff {
}
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- my (@difftree) = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
# non-textual hash id's can be cached
@@ -2328,14 +2327,14 @@ sub git_commitdiff_plain {
mkdir($git_temp, 0700);
open my $fd, "-|", $GIT, "diff-tree", '-r', $hash_parent, $hash
or die_error(undef, "Open git-diff-tree failed.");
- my (@difftree) = map { chomp; $_ } <$fd>;
+ my @difftree = map { chomp; $_ } <$fd>;
close $fd or die_error(undef, "Reading diff-tree failed.");
# try to figure out the next tag after this commit
my $tagname;
my $refs = read_info_ref("tags");
open $fd, "-|", $GIT, "rev-list", "HEAD";
- chomp (my (@commits) = <$fd>);
+ my @commits = map { chomp; $_ } <$fd>;
close $fd;
foreach my $commit (@commits) {
if (defined $refs->{$commit}) {
@@ -2622,7 +2621,7 @@ sub git_shortlog {
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
or die_error(undef, "Open git-rev-list failed.");
- my (@revlist) = map { chomp; $_ } <$fd>;
+ my @revlist = map { chomp; $_ } <$fd>;
close $fd;
if ($hash ne $head || $page) {
--
1.4.0
^ permalink raw reply related
* [PATCH 8] gitweb: Add git_page_nav for later use
From: Jakub Narebski @ 2006-07-30 12:59 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Adds git_page_nav subroutine to factors out the generation of the
navigation bar. Based on Sven Verdoolaege code
Message-Id: <20050618113121.GA13122@pc117b.liacs.nl>
http://marc.theaimsgroup.com/?l=git&m=111909432415478&w=2
I tried for the refactored navbar generate the same result.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 34 ++++++++++++++++++++++++++++++++++
1 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index d5248fe..2bc3445 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -385,6 +385,40 @@ sub die_error {
exit;
}
+sub git_page_nav {
+ my ($current, $suppress, $head, $treehead, $treebase, $extra) = @_;
+ $extra = '' if !defined $extra; # pager or formats
+
+ my @navs = qw(summary shortlog log commit commitdiff tree);
+ if ($suppress) {
+ @navs = grep { $_ ne $suppress } @navs;
+ }
+
+ my %arg = map { $_, ''} @navs;
+ if (defined $head) {
+ for (qw(commit commitdiff)) {
+ $arg{$_} = ";h=$head";
+ }
+ if ($current =~ m/^(tree | log | shortlog | commit | commitdiff | search)$/x) {
+ for (qw(shortlog log)) {
+ $arg{$_} = ";h=$head";
+ }
+ }
+ }
+ $arg{tree} .= ";h=$treehead" if defined $treehead;
+ $arg{tree} .= ";hb=$treebase" if defined $treebase;
+
+ print "<div class=\"page_nav\">\n" .
+ (join " | ",
+ map { $_ eq $current
+ ? $_
+ : $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$_$arg{$_}")}, "$_")
+ }
+ @navs);
+ print "<br/>$extra<br/>\n" .
+ "</div>\n";
+}
+
sub git_get_type {
my $hash = shift;
--
1.4.0
^ permalink raw reply related
* [PATCH 9] gitweb: Navbar refactoring - use git_page_nav to generate navigation bar
From: Jakub Narebski @ 2006-07-30 13:01 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Use git_page_nav subroutine to generate navigation bar. Additional
navigation (either formats or pager/pagination) is put into variables.
Corrects error in git_search where hash parameter was added to
"summary" link instead of to "log" link. Might differ from previous
version by additional "<br/>" in navigation bar.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 235 +++++++++++++++--------------------------------------
1 files changed, 66 insertions(+), 169 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 2bc3445..6c72d33 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -1081,15 +1081,7 @@ sub git_summary {
my $refs = read_info_ref();
git_header_html();
- print "<div class=\"page_nav\">\n" .
- "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=$head")}, "commit") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree")}, "tree") .
- "<br/><br/>\n" .
- "</div>\n";
+ git_page_nav('summary','', $head);
print "<div class=\"title\"> </div>\n";
print "<table cellspacing=\"0\">\n" .
"<tr><td>description</td><td>" . esc_html($descr) . "</td></tr>\n" .
@@ -1251,15 +1243,7 @@ sub git_print_page_path {
sub git_tag {
my $head = git_read_head($project);
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=$head")}, "commit") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
- "<br/>\n" .
- "</div>\n";
+ git_page_nav('','', $head,undef,$head);
my %tag = git_read_tag($hash);
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($tag{'name'})) . "\n" .
@@ -1307,19 +1291,13 @@ sub git_blame2 {
open ($fd, "-|", $GIT, "blame", '-l', $file_name, $hash_base)
or die_error(undef, "Open git-blame 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";
+ my $formats_nav =
+ $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");
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ print "<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);
my @rev_color = (qw(light dark));
my $num_colors = scalar(@rev_color);
@@ -1369,19 +1347,13 @@ sub git_blame {
open ($fd, "-|", $GIT, "annotate", '-l', '-t', '-r', $file_name, $hash_base)
or die_error(undef, "Open git-annotate 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";
+ my $formats_nav =
+ $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");
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ print "<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);
print "<div class=\"page_body\">\n";
print <<HTML;
@@ -1456,15 +1428,7 @@ HTML
sub git_tags {
my $head = git_read_head($project);
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=$head")}, "commit") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
- "<br/>\n" .
- "</div>\n";
+ git_page_nav('','', $head,undef,$head);
my $taglist = git_read_refs("refs/tags");
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -1515,15 +1479,7 @@ sub git_tags {
sub git_heads {
my $head = git_read_head($project);
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=$head")}, "commit") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff;h=$head")}, "commitdiff") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;hb=$head")}, "tree") . "<br/>\n" .
- "<br/>\n" .
- "</div>\n";
+ git_page_nav('','', $head,undef,$head);
my $taglist = git_read_refs("refs/heads");
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -1684,25 +1640,20 @@ sub git_blob {
return git_blob_plain($mimetype);
}
git_header_html();
+ my $formats_nav = '';
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
- 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";
if (defined $file_name) {
if ($have_blame) {
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;h=$hash;hb=$hash_base;f=$file_name")}, "blame") . " | ";
}
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=HEAD;f=$file_name")}, "head") . "<br/>\n";
+ $formats_nav .=
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash;f=$file_name")}, "plain") .
+ " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob;hb=HEAD;f=$file_name")}, "head");
} else {
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash")}, "plain") . "<br/>\n";
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blob_plain;h=$hash")}, "plain");
}
- print "</div>\n".
- "<div>" .
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
+ print "<div>" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'})) .
"</div>\n";
} else {
@@ -1757,15 +1708,7 @@ sub git_tree {
my $base = "";
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
$base_key = ";hb=$hash_base";
- 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;h=$hash_base")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash_base")}, "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") .
- " | tree" .
- "<br/><br/>\n" .
- "</div>\n";
+ git_page_nav('tree','', $hash_base);
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash_base"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
"</div>\n";
@@ -1922,14 +1865,6 @@ sub git_log {
$page = 0;
}
my $refs = read_info_ref();
- git_header_html();
- print "<div class=\"page_nav\">\n";
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash")}, "shortlog") .
- " | 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=$hash;hb=$hash")}, "tree") . "<br/>\n";
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -1937,25 +1872,28 @@ sub git_log {
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
+ my $paging_nav = '';
if ($hash ne $head || $page) {
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "HEAD");
+ $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "HEAD");
} else {
- print "HEAD";
+ $paging_nav .= "HEAD";
}
if ($page > 0) {
- print " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
} else {
- print " ⋅ prev";
+ $paging_nav .= " ⋅ prev";
}
if ($#revlist >= (100 * ($page+1)-1)) {
- print " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
} else {
- print " ⋅ next";
+ $paging_nav .= " ⋅ next";
}
- print "<br/>\n" .
- "</div>\n";
+
+ git_header_html();
+ git_page_nav('log','', $hash,undef,undef, $paging_nav);
+
if (!@revlist) {
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
@@ -2037,21 +1975,14 @@ sub git_commit {
$ref = " <span class=\"tag\">" . esc_html($refs->{$co{'id'}}) . "</span>";
}
git_header_html(undef, $expires);
- 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;h=$hash")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
- " | commit";
- if (defined $co{'parent'}) {
- 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/>\n";
+ my $formats_nav = '';
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";
+ $formats_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blame;hb=$parent;f=$file_name")}, "blame");
}
- print "<br/></div>\n";
+ git_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
+ $hash, $co{'tree'}, $hash,
+ $formats_nav);
if (defined $co{'parent'}) {
print "<div>\n" .
@@ -2223,16 +2154,9 @@ sub git_blobdiff {
mkdir($git_temp, 0700);
git_header_html();
if (defined $hash_base && (my %co = git_read_commit($hash_base))) {
- 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=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain") .
- "</div>\n";
+ my $formats_nav =
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=blobdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base, $formats_nav);
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";
@@ -2284,15 +2208,9 @@ sub git_commitdiff {
$ref = " <span class=\"tag\">" . esc_html($refs->{$co{'id'}}) . "</span>";
}
git_header_html(undef, $expires);
- 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;h=$hash")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "log") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash")}, "commit") .
- " | commitdiff" .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=tree;h=$co{'tree'};hb=$hash")}, "tree") . "<br/>\n";
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain") . "\n" .
- "</div>\n";
+ my $formats_nav =
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commitdiff_plain;h=$hash;hp=$hash_parent")}, "plain");
+ git_page_nav('commitdiff','', $hash,$co{'tree'},$hash, $formats_nav);
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'}) . $ref) . "\n" .
"</div>\n";
@@ -2424,15 +2342,7 @@ sub git_history {
}
my $refs = read_info_ref();
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/><br/>\n" .
- "</div>\n";
+ git_page_nav('','', $hash_base,$co{'tree'},$hash_base);
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";
@@ -2515,15 +2425,7 @@ sub git_search {
$pickaxe_search = 1;
}
git_header_html();
- print "<div class=\"page_nav\">\n" .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary;h=$hash")}, "summary") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "shortlog") .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "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") .
- "<br/><br/>\n" .
- "</div>\n";
+ git_page_nav('','', $hash,$co{'tree'},$hash);
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=commit;h=$hash"), -class => "title"}, esc_html($co{'title'})) . "\n" .
@@ -2643,14 +2545,6 @@ sub git_shortlog {
$page = 0;
}
my $refs = read_info_ref();
- git_header_html();
- print "<div class=\"page_nav\">\n" .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary")}, "summary") .
- " | shortlog" .
- " | " . $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash")}, "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=$hash;hb=$hash")}, "tree") . "<br/>\n";
my $limit = sprintf("--max-count=%i", (100 * ($page+1)));
open my $fd, "-|", $GIT, "rev-list", $limit, $hash
@@ -2658,25 +2552,28 @@ sub git_shortlog {
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
+ my $paging_nav = '';
if ($hash ne $head || $page) {
- print $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "HEAD");
+ $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "HEAD");
} else {
- print "HEAD";
+ $paging_nav .= "HEAD";
}
if ($page > 0) {
- print " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
} else {
- print " ⋅ prev";
+ $paging_nav .= " ⋅ prev";
}
if ($#revlist >= (100 * ($page+1)-1)) {
- print " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
} else {
- print " ⋅ next";
+ $paging_nav .= " ⋅ next";
}
- print "<br/>\n" .
- "</div>\n";
+
+ git_header_html();
+ git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
+
print "<div>\n" .
$cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=summary"), -class => "title"}, " ") .
"</div>\n";
--
1.4.0
^ permalink raw reply related
* [PATCH 10] gitweb: Replace form-feed character by ^L
From: Jakub Narebski @ 2006-07-30 13:02 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
>From 2be5cab10486cba804ccae063e93b146288054fe Mon Sep 17 00:00:00 2001
From: Jakub Narebski <jnareb@gmail.com>
Date: Sun, 30 Jul 2006 13:11:56 +0200
Subject: [PATCH]
Replace FORM FEED (FF) character (014, 12, 0xc) by it's textual
representation '^L'. This character is used for example in GNU GPL
'COPYING' file. With this patch "blob" output for COPYING passes
XHTML validation.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 6c72d33..d39af82 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -250,6 +250,7 @@ sub esc_html {
my $str = shift;
$str = decode("utf8", $str, Encode::FB_DEFAULT);
$str = escapeHTML($str);
+ $str =~ s/\014/^L/g; # escape FORM FEED (FF) character (e.g. in COPYING file)
return $str;
}
--
1.4.0
^ permalink raw reply related
* [PATCH 11] gitweb: Read project description using utf-8 encoding
From: Jakub Narebski @ 2006-07-30 14:13 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index d39af82..7d52a2c 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -463,7 +463,7 @@ sub git_read_hash {
sub git_read_description {
my $path = shift;
- open my $fd, "$projectroot/$path/description" or return undef;
+ open (my $fd, "<:utf8", "$projectroot/$path/description") or return undef;
my $descr = <$fd>;
close $fd;
chomp $descr;
--
1.4.0
^ permalink raw reply related
* [PATCH 12] gitweb: Add "\n" after <br/> in git_page_nav
From: Jakub Narebski @ 2006-07-30 14:14 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
gitweb/gitweb.cgi | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 7d52a2c..df152c3 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -416,7 +416,7 @@ sub git_page_nav {
: $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$_$arg{$_}")}, "$_")
}
@navs);
- print "<br/>$extra<br/>\n" .
+ print "<br/>\n$extra<br/>\n" .
"</div>\n";
}
--
1.4.0
^ permalink raw reply related
* Re: Java GIT/Eclipse GIT version 0.1.1
From: Daniel Barkalow @ 2006-07-30 14:55 UTC (permalink / raw)
To: Shawn Pearce; +Cc: git
In-Reply-To: <20060728063620.GD30783@spearce.org>
On Fri, 28 Jul 2006, Shawn Pearce wrote:
> I would appreciate any and all input, feedback, etc. that anyone
> might have on this library or plugin. Patches are of course
> certainly welcome. :-)
I'm going to try to do a Servlet (+ my stuff) implementation of essentiall
gitweb, with the idea that it could integrate with project management
software (i.e., link completed tasks to the commit which completed them,
regressions to the commit that broke things, fixes to the commit that
fixed them, etc, with the UI for choosing values letting you browse the
actual content and validating that the hash you give exists).
I don't think I need anything you don't already have, but I'll write
documentation as I figure out what's going on, if you want that.
-Daniel
*This .sig left intentionally blank*
^ permalink raw reply
* Re: [PATCH 11] gitweb: Read project description using utf-8 encoding
From: Jakub Narebski @ 2006-07-30 15:20 UTC (permalink / raw)
To: git
In-Reply-To: <200607301613.49947.jnareb@gmail.com>
Disregard this patch for now. It corrects error in project_list page, but
introduces errors on other pages:
Software error: Cannot decode string with wide characters
at Encode.pm line 166.
Corrected patch to follow.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git
^ permalink raw reply
* [PATCH 11] gitweb: Show project descriptions with utf-8 characters in project list correctly
From: Jakub Narebski @ 2006-07-30 15:47 UTC (permalink / raw)
To: git
In-Reply-To: <200607301613.49947.jnareb@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
This supersedes previous patch.
gitweb/gitweb.cgi | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index 3884ffd..1befa7d 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -988,7 +988,7 @@ sub git_project_list {
}
$alternate ^= 1;
print "<td>" . $cgi->a({-href => "$my_uri?" . esc_param("p=$pr->{'path'};a=summary"), -class => "list"}, esc_html($pr->{'path'})) . "</td>\n" .
- "<td>$pr->{'descr'}</td>\n" .
+ "<td>" . esc_html($pr->{'descr'}) . "</td>\n" .
"<td><i>" . chop_str($pr->{'owner'}, 15) . "</i></td>\n";
print "<td class=\"". age_class($pr->{'commit'}{'age'}) . "\">" . $pr->{'commit'}{'age_string'} . "</td>\n" .
"<td class=\"link\">" .
--
1.4.0
^ permalink raw reply related
* [PATCH 13] gitweb: Pager refactoring - use git_get_paging_nav for pagination
From: Jakub Narebski @ 2006-07-30 15:49 UTC (permalink / raw)
To: git
In-Reply-To: <200607292239.11034.jnareb@gmail.com>
Add git_get_paging_nav subroutine which returns string with pager
(paging nav) for shortlog and log actions.
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
It would make no sense to split this patch into two, I think.
gitweb/gitweb.cgi | 68 +++++++++++++++++++++++++----------------------------
1 files changed, 32 insertions(+), 36 deletions(-)
diff --git a/gitweb/gitweb.cgi b/gitweb/gitweb.cgi
index df152c3..0ed3ad2 100755
--- a/gitweb/gitweb.cgi
+++ b/gitweb/gitweb.cgi
@@ -420,6 +420,36 @@ sub git_page_nav {
"</div>\n";
}
+sub git_get_paging_nav {
+ my ($project, $action, $hash, $head, $page, $nrevs) = @_;
+ my $paging_nav;
+
+
+ if ($hash ne $head || $page) {
+ $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$action")}, "HEAD");
+ } else {
+ $paging_nav .= "HEAD";
+ }
+
+ if ($page > 0) {
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$action;h=$hash;pg=" . ($page-1)),
+ -accesskey => "p", -title => "Alt-p"}, "prev");
+ } else {
+ $paging_nav .= " ⋅ prev";
+ }
+
+ if ($nrevs >= (100 * ($page+1)-1)) {
+ $paging_nav .= " ⋅ " .
+ $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=$action;h=$hash;pg=" . ($page+1)),
+ -accesskey => "n", -title => "Alt-n"}, "next");
+ } else {
+ $paging_nav .= " ⋅ next";
+ }
+
+ return $paging_nav;
+}
+
sub git_get_type {
my $hash = shift;
@@ -1873,24 +1903,7 @@ sub git_log {
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
- my $paging_nav = '';
- if ($hash ne $head || $page) {
- $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log")}, "HEAD");
- } else {
- $paging_nav .= "HEAD";
- }
- if ($page > 0) {
- $paging_nav .= " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
- } else {
- $paging_nav .= " ⋅ prev";
- }
- if ($#revlist >= (100 * ($page+1)-1)) {
- $paging_nav .= " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=log;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
- } else {
- $paging_nav .= " ⋅ next";
- }
+ my $paging_nav = git_get_paging_nav($project, 'log', $hash, $head, $page, $#revlist);
git_header_html();
git_page_nav('log','', $hash,undef,undef, $paging_nav);
@@ -2553,24 +2566,7 @@ sub git_shortlog {
my @revlist = map { chomp; $_ } <$fd>;
close $fd;
- my $paging_nav = '';
- if ($hash ne $head || $page) {
- $paging_nav .= $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog")}, "HEAD");
- } else {
- $paging_nav .= "HEAD";
- }
- if ($page > 0) {
- $paging_nav .= " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page-1)), -accesskey => "p", -title => "Alt-p"}, "prev");
- } else {
- $paging_nav .= " ⋅ prev";
- }
- if ($#revlist >= (100 * ($page+1)-1)) {
- $paging_nav .= " ⋅ " .
- $cgi->a({-href => "$my_uri?" . esc_param("p=$project;a=shortlog;h=$hash;pg=" . ($page+1)), -accesskey => "n", -title => "Alt-n"}, "next");
- } else {
- $paging_nav .= " ⋅ next";
- }
+ my $paging_nav = git_get_paging_nav($project, 'shortlog', $hash, $head, $page, $#revlist);
git_header_html();
git_page_nav('shortlog','', $hash,$hash,$hash, $paging_nav);
--
1.4.0
^ permalink raw reply related
* [PATCH] merge-recur: fix thinko in unique_path()
From: Johannes Schindelin @ 2006-07-30 16:35 UTC (permalink / raw)
To: git, junkio
This could result in a nasty infinite loop, or in bogus names (it used
the strlen() of the newly allocated buffer instead of the original
buffer).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
merge-recursive.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 6a796f2..5375a1b 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -477,9 +477,9 @@ static char *unique_path(const char *pat
char *newpath = xmalloc(strlen(path) + 1 + strlen(branch) + 8 + 1);
int suffix = 0;
struct stat st;
- char *p = newpath + strlen(newpath);
+ char *p = newpath + strlen(path);
strcpy(newpath, path);
- strcat(newpath, "~");
+ *(p++) = '~';
strcpy(p, branch);
for (; *p; ++p)
if ('/' == *p)
--
1.4.2.rc2.geb7f
^ permalink raw reply related
* [PATCH 1/1] Make git-tar-tree more flexible
From: Anand Kumria @ 2006-07-30 17:48 UTC (permalink / raw)
To: git
If you have a project which is setup like:
project
website
and you decide you wish to generate a tar archive of _just_ the 'project'
portion, git-tar-tree is not able to help. This patch adds two parameters
which can assist.
The first is '--pathlimit', which forces git-tar-tree to only generate the
tar archive for project; as in:
'git tar-tree --pathlimit=project project-1.0 tag-1.0'
The above command will mean that paths in the tar archive look like:
project-1.0/project/src/main.c
etc.
The second parameter allows you two strip the extraneous project, as in:
'git tar-tree --strippath=project --pathlimit=project project-1.0 tag-1.0 Which will result in tar archives looking like:
project-1.0/src/main.c
This patch also updates the documentation to match the new parameters and
rewrites the argument processing so that arguments can be passed in any
order by the user
Signed-off-by: Anand Kumria <wildfire@progsoc.org>
---
Documentation/git-tar-tree.txt | 11 ++++++
tar-tree.c | 70 ++++++++++++++++++++++++++++++----------
2 files changed, 63 insertions(+), 18 deletions(-)
diff --git a/Documentation/git-tar-tree.txt b/Documentation/git-tar-tree.txt
index 2139b6f..d123329 100644
--- a/Documentation/git-tar-tree.txt
+++ b/Documentation/git-tar-tree.txt
@@ -8,7 +8,7 @@ git-tar-tree - Creates a tar archive of
SYNOPSIS
--------
-'git-tar-tree' <tree-ish> [ <base> ]
+'git-tar-tree' [--strippath=<path>] [--pathlimit=<path>] <tree-ish> [ <base> ]
DESCRIPTION
-----------
@@ -23,6 +23,15 @@ commit time as recorded in the reference
Additionally the commit ID is stored in a global extended pax header.
It can be extracted using git-get-tar-commit-id.
+OPTIONS
+-------
+--strippath::
+ Remove from the created tar archive the specified string from
+ any of the generated paths
+
+--pathlimit::
+ Create the tar archive but limit the included files to be those
+ specified by the pathlimit
Author
------
diff --git a/tar-tree.c b/tar-tree.c
index fc60a90..78ae7ff 100644
--- a/tar-tree.c
+++ b/tar-tree.c
@@ -11,7 +11,7 @@ #include "tar.h"
#define RECORDSIZE (512)
#define BLOCKSIZE (RECORDSIZE * 20)
-static const char tar_tree_usage[] = "git-tar-tree <key> [basedir]";
+static const char tar_tree_usage[] = "git-tar-tree [--strippath=<path>] [--pathlimit=<path>] <key> [basedir]";
static char block[BLOCKSIZE];
static unsigned long offset;
@@ -265,7 +265,7 @@ static void write_global_extended_header
free(ext_header.buf);
}
-static void traverse_tree(struct tree_desc *tree, struct strbuf *path)
+static void traverse_tree(struct tree_desc *tree, struct strbuf *path, const char *namelimit, const char *strippath)
{
int pathlen = path->len;
@@ -280,14 +280,25 @@ static void traverse_tree(struct tree_de
sha1 = tree_entry_extract(tree, &name, &mode);
update_tree_entry(tree);
+ /* if we have a namelimit and we don't match it, escape */
+ if (namelimit)
+ if (!(strcmp(name,namelimit) == 0))
+ continue;
+
eltbuf = read_sha1_file(sha1, elttype, &eltsize);
if (!eltbuf)
die("cannot read %s", sha1_to_hex(sha1));
path->len = pathlen;
- strbuf_append_string(path, name);
- if (S_ISDIR(mode))
- strbuf_append_string(path, "/");
+
+ /* if we match the path to strip out,
+ * don't append it to the path
+ */
+ if ((strippath) && (!(strcmp(name,strippath) == 0))) {
+ strbuf_append_string(path, name);
+ if (S_ISDIR(mode))
+ strbuf_append_string(path, "/");
+ }
write_entry(sha1, path, mode, eltbuf, eltsize);
@@ -295,7 +306,7 @@ static void traverse_tree(struct tree_de
struct tree_desc subtree;
subtree.buf = eltbuf;
subtree.size = eltsize;
- traverse_tree(&subtree, path);
+ traverse_tree(&subtree, path, NULL, strippath);
}
free(eltbuf);
}
@@ -307,6 +318,9 @@ int main(int argc, char **argv)
struct commit *commit;
struct tree_desc tree;
struct strbuf current_path;
+ int i, gotsha1 = 0, gotpath = 0;
+ const char *strippath;
+ const char *pathlimit;
current_path.buf = xmalloc(PATH_MAX);
current_path.alloc = PATH_MAX;
@@ -315,19 +329,41 @@ int main(int argc, char **argv)
setup_git_directory();
git_config(git_default_config);
- switch (argc) {
- case 3:
- strbuf_append_string(¤t_path, argv[2]);
- strbuf_append_string(¤t_path, "/");
- /* FALLTHROUGH */
- case 2:
- if (get_sha1(argv[1], sha1) < 0)
+ for (i = 1; i < argc; i++) {
+ const char *arg = argv[i];
+
+ if (*arg != '-') {
+ /* first assume it is an SHA1 ref */
+ if (!gotsha1) {
+ if (get_sha1(arg, sha1) >= 0) {
+ gotsha1 = 1;
+ continue;
+ }
+ }
+
+ /* now assume it is the path prefix */
+ if (!gotpath) {
+ strbuf_append_string(¤t_path, arg);
+ strbuf_append_string(¤t_path, "/");
+ gotpath = 1;
+ continue;
+ }
+
+ /* we're still here? */
+ usage(tar_tree_usage);
+
+ } else if (!strncmp(arg, "--strippath=", 12)) {
+ strippath = strdup(arg+12);
+ } else if (!strncmp(arg, "--pathlimit=", 12)) {
+ pathlimit = strdup(arg+12);
+ } else
usage(tar_tree_usage);
- break;
- default:
- usage(tar_tree_usage);
}
+ /* be sure we have an SHA1 ref */
+ if (!gotsha1)
+ usage(tar_tree_usage);
+
commit = lookup_commit_reference_gently(sha1, 1);
if (commit) {
write_global_extended_header(commit->object.sha1);
@@ -343,7 +379,7 @@ int main(int argc, char **argv)
if (current_path.len > 0)
write_entry(tree_sha1, ¤t_path, 040777, NULL, 0);
- traverse_tree(&tree, ¤t_path);
+ traverse_tree(&tree, ¤t_path, pathlimit, strippath);
write_trailer();
free(current_path.buf);
return 0;
--
1.4.1
^ permalink raw reply related
* [PATCH 0/3] merge-recur: get rid of external call to read-tree
From: Johannes Schindelin @ 2006-07-30 18:24 UTC (permalink / raw)
To: git, junkio
Hi,
these three patches refactor the read-tree functionality into
unpack-trees.[ch], and then use them in merge-recur.
I did not do any benchmarks yet, so this task is up for grabs.
Ciao,
Dscho
^ 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