* Re: [PATCH] cherry-pick: make -r the default
From: Linus Torvalds @ 2006-10-06 1:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List
In-Reply-To: <7vsli245zp.fsf@assigned-by-dhcp.cox.net>
On Thu, 5 Oct 2006, Junio C Hamano wrote:
>
> Thanks for reminding. Does the rationale and warning for -x
> in the documentation look Ok?
Looks good, thanks.
Linus
^ permalink raw reply
* What's in git.git
From: Junio C Hamano @ 2006-10-06 0:59 UTC (permalink / raw)
To: git
* The 'maint' branch has produced the third maintenance release
1.4.2.3 a few days ago.
* The 'master' branch is at 1.4.3-rc1; we are in stabilization
cycle. I do not think I have made any formal announcement on
the merge policy during -rc; I am planning to play by the
following rules:
* no new features nor interface change should hit "master"
after -rc1, but I am a human and smaller things could seep
through ;-).
* fixes for "master" are encouraged and very much appreciated;
* fixes for "next" are also encouraged and appreciated, but
perfecting a topic that was still in "next" after -rc1 will
not make the topic for a candidate in the upcoming "master"
release. It will make the topic merged as part of the first
wave of merges after the release.
* For totally new topics, I reserve the right to drop them on
the floor during the stabilization period, but they might
get lucky and land on "next" or "pu" depending on my mood.
Please re-send them after the next release if you care
deeply enough.
contrib/ is exempt from the above rules for obvious reasons.
Here are what was added since 1.4.3-rc1 and will be in 1.4.3.
By the above definition, they should mostly be fixes:
Alan Chandler:
Update the gitweb/README file to include setting the GITWEB_CONFIG environment
git.c: Fix usage string to match that given in the man page
Alexandre Julliard:
git.el: Fixed inverted "renamed from/to" message.
vc-git.el: Switch to using git-blame instead of git-annotate.
Dennis Stosberg:
lock_ref_sha1_basic does not remove empty directories on BSD
Franck Bui-Huu:
Add git-upload-archive to the main git man page
Junio C Hamano:
Makefile: install and clean merge-recur, still.
git-mv: invalidate the removed path properly in cache-tree
git-push: .git/remotes/ file does not require SP after colon
escape tilde in Documentation/git-rev-parse.txt
tar-tree deprecation: we eat our own dog food.
gitweb: Make the Git logo link target to point to the homepage
git-send-email: avoid uninitialized variable warning.
cherry-pick: make -r the default
Luben Tuikov:
gitweb: Escape ESCAPE (\e) character
gitweb: Do not print "log" and "shortlog" redundantly in commit view
gitweb: blame: Minimize vertical table row padding
Martin Waitz:
gitweb: document webserver configuration for common gitweb/repo URLs.
git-commit: cleanup unused function.
Robin Rosenberg:
Error in test description of t1200-tutorial
* The 'next' branch, in addition, has these. They will not be
in 1.4.3 (except one):
- git-pack-refs, git-for-each-ref, git-show-ref by Linus and
me, with help in updating the documentation, test scripts,
and updates to the tools to use them from Andy Whitcroft,
Christian Couder, Dennis Stosberg, Jeff King, Johannes,
Jonas, Pasky,
I think this is in testable shape and I started to use
packed refs in one of my test repositories to see what are
still broken. Hopefully be in "master" soon after 1.4.3.
- git-receive-pack uses the common ref-locking code, and as a
side effect git-push will add ref-log entries on the remote
end if enabled.
This depends on the first item and should be considered a
part of it.
- git log --summary without any other options now look into
subdirectories, thanks to Johannes.
This is a small backward-incompatible change, but I think it
falls into "fix a broken behaviour" category (same as making
"cherry-pick -r" the default). If nobody objects I'll merge
it to "master" before 1.4.3-rc2.
- "git log --all-match --author=Foo --committer=Bar".
- "git apply" is prepared for planned output format change for
"git diff" when a file with SP in its name is involved. We
will add a trailing TAB on "+++/---" lines.
Merge to "master" immediately after 1.4.3
- Santi Béjar tidied up output from fetch and merge.
Merge to "master" immediately after 1.4.3
- Robert Shearman taught git-rebase (sans --merge) to use
--ignore-if-in-upstream to reduce obvious conflicts, and
taught it to show upstream changes with -v option.
Merge to "master" immediately after 1.4.3
- Assorted gitweb updates by Alan Chandler, me, Luben Tuikov,
Martin Waitz
Notable enhancements are:
- blame page output got a facelift.
- the URL gitweb generates can use PATH_INFO.
Merge to "master" sometime after 1.4.3
- Nico's pack format optimization.
I've been using this for my pulls and haven't seen a
problem. I'll enable it for repository packing in one of my
test repository soon to see if I get burned ;-) but I do not
expect breakage from Nico's code. Soon after dust settles
from other ones graduating to "master" post 1.4.3.
- "git blame --show-name" tells it to always output filename.
After dust settles from other ones graduating to "master"
post 1.4.3.
* The 'pu' branch, in addition, has these.
- "git diff"'s output format change for a file with SP in its
name, as described above. This will be merged after the
matching change to "git apply" graduates to "master" and
matures.
- "git blame --porcelain" gives richer information on revs
that are involved for scripted use.
- "gitweb" is updated to use the above "git blame --porcelain"
- My WIP of parallel tree walker hasn't made any progress.
^ permalink raw reply
* [PATCH] cherry-pick: make -r the default
From: Junio C Hamano @ 2006-10-06 0:56 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Git Mailing List
In-Reply-To: <Pine.LNX.4.64.0610051711310.3952@g5.osdl.org>
And introduce -x to expose (possibly) private commit object name
for people who cherry-pick between public branches.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* We discussed about this a few times already and every time I
end up forgetting. I noticed the topic on the kernel list a
few days ago again.
Thanks for reminding. Does the rationale and warning for -x
in the documentation look Ok?
Documentation/git-cherry-pick.txt | 23 ++++++++++++++++-------
git-revert.sh | 12 +++++++-----
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index bfa950c..875edb6 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -7,7 +7,7 @@ git-cherry-pick - Apply the change intro
SYNOPSIS
--------
-'git-cherry-pick' [--edit] [-n] [-r] <commit>
+'git-cherry-pick' [--edit] [-n] [-x] <commit>
DESCRIPTION
-----------
@@ -24,13 +24,22 @@ OPTIONS
With this option, `git-cherry-pick` will let you edit the commit
message prior committing.
--r|--replay::
- Usually the command appends which commit was
+-x::
+ Cause the command to append which commit was
cherry-picked after the original commit message when
- making a commit. This option, '--replay', causes it to
- use the original commit message intact. This is useful
- when you are reordering the patches in your private tree
- before publishing.
+ making a commit. Do not use this option if you are
+ cherry-picking from your private branch because the
+ information is useless to the recipient. If on the
+ other hand you are cherry-picking between two publicly
+ visible branches (e.g. backporting a fix to a
+ maintenance branch for an older release from a
+ development branch), adding this information can be
+ useful.
+
+-r|--replay::
+ It used to be that the command defaulted to do `-x`
+ described above, and `-r` was to disable it. Now the
+ default is not to do `-x` so this option is a no-op.
-n|--no-commit::
Usually the command automatically creates a commit with
diff --git a/git-revert.sh b/git-revert.sh
index 2bf35d1..0784f74 100755
--- a/git-revert.sh
+++ b/git-revert.sh
@@ -12,13 +12,13 @@ case "$0" in
*-cherry-pick* )
edit=
me=cherry-pick
- USAGE='[--edit] [-n] [-r] <commit-ish>' ;;
+ USAGE='[--edit] [-n] [-r] [-x] <commit-ish>' ;;
* )
die "What are you talking about?" ;;
esac
. git-sh-setup
-no_commit= replay=
+no_commit= replay=t
while case "$#" in 0) break ;; esac
do
case "$1" in
@@ -32,8 +32,10 @@ do
--n|--no|--no-|--no-e|--no-ed|--no-edi|--no-edit)
edit=
;;
- -r|--r|--re|--rep|--repl|--repla|--replay)
- replay=t
+ -r)
+ : no-op ;;
+ -x|--i-really-want-to-expose-my-private-commit-object-name)
+ replay=
;;
-*)
usage
@@ -121,7 +123,7 @@ cherry-pick)
git-cat-file commit $commit | sed -e '1,/^$/d'
case "$replay" in
'')
- echo "(cherry picked from $commit commit)"
+ echo "(cherry picked from commit $commit)"
test "$rev" = "$commit" ||
echo "(original 'git cherry-pick' arguments: $@)"
;;
--
1.4.2.3.gae59
^ permalink raw reply related
* Re: Could we please make "cherry-pick" not add the message by default?
From: Junio C Hamano @ 2006-10-06 0:35 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0610051711310.3952@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
> It appears that more and more people are finding "git cherry-pick", and we
> now have a number of totally inane
>
> cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit
>
> messages in the kernel logs, because I don't want to just re-cherry-pick
> them and edit peoples logs.
>
> Those messages not only make no grammatical sense (you'd say "commit X"
> rather than "X commit"), but they have no point. The original commit is
> not reachable and makes no sense any more, and that's actually likely to
> always be the common case.
>
> So could we just (a) fix the message word order to make sense and (b) make
> it only happen if people explicitly ask for it, rather than by default?
Let's do (c) never show it and make -r a no-op.
^ permalink raw reply
* Re: [PATCH 5/6] git-blame --porcelain
From: Luben Tuikov @ 2006-10-06 0:29 UTC (permalink / raw)
To: Junio C Hamano, git
In-Reply-To: <7v4puicvz5.fsf@assigned-by-dhcp.cox.net>
--- Junio C Hamano <junkio@cox.net> wrote:
> The new option makes the command's native output format to emit
> output that is easier to handle by Porcelain.
>
> Each line is output after a header. The header at the minimum
> has the first line which has:
>
> - 40-byte SHA-1 of the commit the line is attributed to;
>
> - the line number of the line in the final file;
>
> - the line number of the line in the original file;
>
> - on a line that starts a group of line from a different commit
> than the previous one, the number of lines in this group. On
> subsequent lines this field is absent.
Good stuff! ACK.
BTW, I would've chosen to print the line number of the original file
first, followed by the line number of the final (this) file followed
by the number of lines in this group of the final (this) file:
<SHA-1> <orig_line_no> <this_line_no> <this_num_lines>
\t<this_line_data>
Not that it matters that much, but is more consistent with other
tools which print "old new new_something_else".
Luben
>
> This header line is followed by the following information once
> for each commit:
>
> - author name ("author"), email ("author-mail"), time
> ("author-time"), and timezone ("author-tz"); similarly for
> committer.
>
> - filename in the commit the line is attributed to.
>
> - the first line of the commit log message ("summary").
>
> The contents of the actual line is output after the above
> header, prefixed by a TAB. This is to allow adding more header
> elements later.
>
> Signed-off-by: Junio C Hamano <junkio@cox.net>
> ---
>
> * By now, Luben would have guessed where this series is leading
> to...
>
> blame.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
> 1 files changed, 127 insertions(+), 22 deletions(-)
>
> diff --git a/blame.c b/blame.c
> index 47471e8..8189318 100644
> --- a/blame.c
> +++ b/blame.c
> @@ -17,6 +17,7 @@ #include "diff.h"
> #include "diffcore.h"
> #include "revision.h"
> #include "xdiff-interface.h"
> +#include "quote.h"
>
> #define DEBUG 0
>
> @@ -40,6 +41,7 @@ struct util_info {
> unsigned long size;
> int num_lines;
> const char *pathname;
> + unsigned meta_given:1;
>
> void *topo_data;
> };
> @@ -332,12 +334,8 @@ static struct util_info *get_util(struct
> if (util)
> return util;
>
> - util = xmalloc(sizeof(struct util_info));
> - util->buf = NULL;
> - util->size = 0;
> - util->line_map = NULL;
> + util = xcalloc(1, sizeof(struct util_info));
> util->num_lines = -1;
> - util->pathname = NULL;
> commit->util = util;
> return util;
> }
> @@ -642,39 +640,99 @@ struct commit_info
> char *author_mail;
> unsigned long author_time;
> char *author_tz;
> +
> + /* filled only when asked for details */
> + char *committer;
> + char *committer_mail;
> + unsigned long committer_time;
> + char *committer_tz;
> +
> + char *summary;
> };
>
> -static void get_commit_info(struct commit *commit, struct commit_info *ret)
> +static void get_ac_line(const char *inbuf, const char *what,
> + int bufsz, char *person, char **mail,
> + unsigned long *time, char **tz)
> {
> int len;
> - char *tmp;
> - static char author_buf[1024];
> -
> - tmp = strstr(commit->buffer, "\nauthor ") + 8;
> - len = strchr(tmp, '\n') - tmp;
> - ret->author = author_buf;
> - memcpy(ret->author, tmp, len);
> + char *tmp, *endp;
> +
> + tmp = strstr(inbuf, what);
> + if (!tmp)
> + goto error_out;
> + tmp += strlen(what);
> + endp = strchr(tmp, '\n');
> + if (!endp)
> + len = strlen(tmp);
> + else
> + len = endp - tmp;
> + if (bufsz <= len) {
> + error_out:
> + /* Ugh */
> + person = *mail = *tz = "(unknown)";
> + *time = 0;
> + return;
> + }
> + memcpy(person, tmp, len);
>
> - tmp = ret->author;
> + tmp = person;
> tmp += len;
> *tmp = 0;
> while (*tmp != ' ')
> tmp--;
> - ret->author_tz = tmp+1;
> + *tz = tmp+1;
>
> *tmp = 0;
> while (*tmp != ' ')
> tmp--;
> - ret->author_time = strtoul(tmp, NULL, 10);
> + *time = strtoul(tmp, NULL, 10);
>
> *tmp = 0;
> while (*tmp != ' ')
> tmp--;
> - ret->author_mail = tmp + 1;
> -
> + *mail = tmp + 1;
> *tmp = 0;
> }
>
> +static void get_commit_info(struct commit *commit, struct commit_info *ret, int detailed)
> +{
> + int len;
> + char *tmp, *endp;
> + static char author_buf[1024];
> + static char committer_buf[1024];
> + static char summary_buf[1024];
> +
> + ret->author = author_buf;
> + get_ac_line(commit->buffer, "\nauthor ",
> + sizeof(author_buf), author_buf, &ret->author_mail,
> + &ret->author_time, &ret->author_tz);
> +
> + if (!detailed)
> + return;
> +
> + ret->committer = committer_buf;
> + get_ac_line(commit->buffer, "\ncommitter ",
> + sizeof(committer_buf), committer_buf, &ret->committer_mail,
> + &ret->committer_time, &ret->committer_tz);
> +
> + ret->summary = summary_buf;
> + tmp = strstr(commit->buffer, "\n\n");
> + if (!tmp) {
> + error_out:
> + sprintf(summary_buf, "(%s)", sha1_to_hex(commit->object.sha1));
> + return;
> + }
> + tmp += 2;
> + endp = strchr(tmp, '\n');
> + if (!endp)
> + goto error_out;
> + len = endp - tmp;
> + if (len >= sizeof(summary_buf))
> + goto error_out;
> + memcpy(summary_buf, tmp, len);
> + summary_buf[len] = 0;
> +}
> +
> static const char *format_time(unsigned long time, const char *tz_str,
> int show_raw_time)
> {
> @@ -751,7 +809,7 @@ static int find_orig_linenum(struct util
> }
>
> static void emit_meta(struct commit *c, int lno,
> - int sha1_len, int compatibility,
> + int sha1_len, int compatibility, int porcelain,
> int show_name, int show_number, int show_raw_time,
> int longest_file, int longest_author,
> int max_digits, int max_orig_digits)
> @@ -763,7 +821,47 @@ static void emit_meta(struct commit *c,
> u = c->util;
> lineno = find_orig_linenum(u, lno);
>
> - get_commit_info(c, &ci);
> + if (porcelain) {
> + int group_size = -1;
> + struct commit *cc = (lno == 0) ? NULL : blame_lines[lno-1];
> + if (cc != c) {
> + /* This is the beginning of this group */
> + int i;
> + for (i = lno + 1; i < num_blame_lines; i++)
> + if (blame_lines[i] != c)
> + break;
> + group_size = i - lno;
> + }
> + if (0 < group_size)
> + printf("%s %d %d %d\n", sha1_to_hex(c->object.sha1),
> + lno + 1, lineno, group_size);
> + else
> + printf("%s %d %d\n", sha1_to_hex(c->object.sha1),
> + lno + 1, lineno);
> + if (!u->meta_given) {
> + get_commit_info(c, &ci, 1);
> + printf("author %s\n", ci.author);
> + printf("author-mail %s\n", ci.author_mail);
> + printf("author-time %lu\n", ci.author_time);
> + printf("author-tz %s\n", ci.author_tz);
> + printf("committer %s\n", ci.committer);
> + printf("committer-mail %s\n", ci.committer_mail);
> + printf("committer-time %lu\n", ci.committer_time);
> + printf("committer-tz %s\n", ci.committer_tz);
> + printf("filename ");
> + if (quote_c_style(u->pathname, NULL, NULL, 0))
> + quote_c_style(u->pathname, NULL, stdout, 0);
> + else
> + fputs(u->pathname, stdout);
> + printf("\nsummary %s\n", ci.summary);
> +
> + u->meta_given = 1;
> + }
> + putchar('\t');
> + return;
> + }
> +
> + get_commit_info(c, &ci, 0);
> fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
> if (compatibility) {
> printf("\t(%10s\t%10s\t%d)", ci.author,
> @@ -809,6 +907,7 @@ int main(int argc, const char **argv)
> int longest_file, longest_author, longest_file_lines;
> int show_name = 0;
> int show_number = 0;
> + int porcelain = 0;
>
> const char *prefix = setup_git_directory();
> git_config(git_default_config);
> @@ -852,6 +951,12 @@ int main(int argc, const char **argv)
> show_number = 1;
> continue;
> }
> + if (!strcmp(argv[i], "--porcelain")) {
> + porcelain = 1;
> + sha1_len = 40;
> + show_raw_time = 1;
> + continue;
> + }
> if (!strcmp(argv[i], "--")) {
> options = 0;
> continue;
> @@ -934,7 +1039,7 @@ int main(int argc, const char **argv)
> longest_file = strlen(u->pathname);
> if (longest_file_lines < u->num_lines)
> longest_file_lines = u->num_lines;
> - get_commit_info(c, &ci);
> + get_commit_info(c, &ci, 0);
> if (longest_author < strlen(ci.author))
> longest_author = strlen(ci.author);
> }
> @@ -943,7 +1048,7 @@ int main(int argc, const char **argv)
>
> for (i = 0; i < num_blame_lines; i++) {
> emit_meta(blame_lines[i], i,
> - sha1_len, compatibility,
> + sha1_len, compatibility, porcelain,
> show_name, show_number, show_raw_time,
> longest_file, longest_author,
> max_digits, max_orig_digits);
> --
> 1.4.2.3.g866f3
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply
* Could we please make "cherry-pick" not add the message by default?
From: Linus Torvalds @ 2006-10-06 0:14 UTC (permalink / raw)
To: Junio C Hamano, Git Mailing List
It appears that more and more people are finding "git cherry-pick", and we
now have a number of totally inane
cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit
messages in the kernel logs, because I don't want to just re-cherry-pick
them and edit peoples logs.
Those messages not only make no grammatical sense (you'd say "commit X"
rather than "X commit"), but they have no point. The original commit is
not reachable and makes no sense any more, and that's actually likely to
always be the common case.
So could we just (a) fix the message word order to make sense and (b) make
it only happen if people explicitly ask for it, rather than by default?
Linus
^ permalink raw reply
* Re: [RFC][PATCH] gitweb: Make the Git logo link target to point to the homepage
From: Petr Baudis @ 2006-10-05 23:57 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vbqoqbg5p.fsf@assigned-by-dhcp.cox.net>
Dear diary, on Thu, Oct 05, 2006 at 11:34:42PM CEST, I got a letter
where Junio C Hamano <junkio@cox.net> said that...
> Junio C Hamano <junkio@cox.net> writes:
>
> > Petr Baudis <pasky@suse.cz> writes:
> >
> >>> > > Ping? This is the only gitweb patch still in my stg stack. I guess
> >>> > > noone really cares strongly either way since there were no comments.
> >>> >
> >>> > I did not care either way, but I did not like either of these
> >>> > hardcoded strings in the code, and felt that if we are touching
> >>> > that part of the code we also should be making real improvement
> >>> > at the same time ;-).
> >>> >
> >>> > Doing something like this would let us update it easier, and
> >>> > let people override with GITWEB_CONFIG if they want to.
> >>>
> >>> Reasonable.
> >>>
> >>> Acked-by: Petr Baudis <pasky@suse.cz>
> >>
> >> So, what happenned to this patch?
> >
> > Did anybody send in an applicable patch?
>
> Ah, I found it; you do not have to re-send it. But do you still
> want it?
Yes. :-) (I wouldn't prod about it otherwise.)
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply
* Re: git-send-email w/ headers
From: Junio C Hamano @ 2006-10-05 23:34 UTC (permalink / raw)
To: Len Brown; +Cc: git
In-Reply-To: <200610041250.50272.len.brown@intel.com>
Len Brown <len.brown@intel.com> writes:
> git-send-email seems to strip out my custom headers.
It seems to not care about anything but a selected few.
Could you give this a try, please?
-- >8 --
git-send-email: do not drop custom headers the user prepared
The command picked up only Subject, CC, and From headers in the
incoming mbox text. Sending out patches prepared by
git-format-patch with user's custom headers was impossible with
that.
Just keep the ones it does not need to look at and add them to
the header of the message when sending it out.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
diff --git a/git-send-email.perl b/git-send-email.perl
index 4a20310..77e4557 100755
--- a/git-send-email.perl
+++ b/git-send-email.perl
@@ -83,7 +83,7 @@ # Constants (essentially)
my $compose_filename = ".msg.$$";
# Variables we fill in automatically, or via prompting:
-my (@to,@cc,@initial_cc,@bcclist,
+my (@to,@cc,@initial_cc,@bcclist,@xh,
$initial_reply_to,$initial_subject,@files,$from,$compose,$time);
# Behavior modification variables
@@ -422,6 +422,9 @@ X-Mailer: git-send-email $gitversion
$header .= "In-Reply-To: $reply_to\n";
$header .= "References: $references\n";
}
+ if (@xh) {
+ $header .= join("\n", @xh);
+ }
if ($smtp_server =~ m#^/#) {
my $pid = open my $sm, '|-';
@@ -472,6 +475,7 @@ foreach my $t (@files) {
my $author_not_sender = undef;
@cc = @initial_cc;
+ @xh = ();
my $found_mbox = 0;
my $header_done = 0;
$message = "";
@@ -495,6 +499,9 @@ foreach my $t (@files) {
$2, $_) unless $quiet;
push @cc, $2;
}
+ elsif (/^[-A-Za-z]+:\s+\S/) {
+ push @xh, $_;
+ }
} else {
# In the traditional
^ permalink raw reply related
* Re: [PATCH 6/6] gitweb: use blame --porcelain
From: Junio C Hamano @ 2006-10-05 21:48 UTC (permalink / raw)
To: git
In-Reply-To: <7vwt7ebhe9.fsf@assigned-by-dhcp.cox.net>
Found a stupid typo...
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index feb768f..8b97357 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -2589,7 +2589,7 @@ HTML
file_name => $meta->{'filename'},
hash_base => $full_rev);
print "<td class=\"linenr\">";
- print $cgi->a({ -href => "$blamed#l$lineno",
+ print $cgi->a({ -href => "$blamed#l$orig_lineno",
-id => "l$lineno",
-class => "linenr" },
esc_html($lineno));
^ permalink raw reply related
* Re: [RFC][PATCH] gitweb: Make the Git logo link target to point to the homepage
From: Junio C Hamano @ 2006-10-05 21:34 UTC (permalink / raw)
To: Petr Baudis; +Cc: git
In-Reply-To: <7vhcyibgon.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano <junkio@cox.net> writes:
> Petr Baudis <pasky@suse.cz> writes:
>
>>> > > Ping? This is the only gitweb patch still in my stg stack. I guess
>>> > > noone really cares strongly either way since there were no comments.
>>> >
>>> > I did not care either way, but I did not like either of these
>>> > hardcoded strings in the code, and felt that if we are touching
>>> > that part of the code we also should be making real improvement
>>> > at the same time ;-).
>>> >
>>> > Doing something like this would let us update it easier, and
>>> > let people override with GITWEB_CONFIG if they want to.
>>>
>>> Reasonable.
>>>
>>> Acked-by: Petr Baudis <pasky@suse.cz>
>>
>> So, what happenned to this patch?
>
> Did anybody send in an applicable patch?
Ah, I found it; you do not have to re-send it. But do you still
want it?
^ permalink raw reply
* Re: [RFC][PATCH] gitweb: Make the Git logo link target to point to the homepage
From: Junio C Hamano @ 2006-10-05 21:23 UTC (permalink / raw)
To: git
In-Reply-To: <20061005204752.GL20017@pasky.or.cz>
Petr Baudis <pasky@suse.cz> writes:
> Dear diary, on Sat, Sep 23, 2006 at 09:46:43PM CEST, I got a letter
> where Petr Baudis <pasky@suse.cz> said that...
>> Dear diary, on Sat, Sep 23, 2006 at 09:36:01PM CEST, I got a letter
>> where Junio C Hamano <junkio@cox.net> said that...
>> > Petr Baudis <pasky@suse.cz> writes:
>> >
>> > > Dear diary, on Tue, Sep 19, 2006 at 11:27:25PM CEST, I got a letter
>> > > where Petr Baudis <pasky@suse.cz> said that...
>> > >> It provides more useful information for causual Git users than the Git docs
>> > >> (especially about where to get Git and such).
>> > >>
>> > >> Signed-off-by: Petr Baudis <pasky@suse.cz>
>> > >
>> > > Ping? This is the only gitweb patch still in my stg stack. I guess
>> > > noone really cares strongly either way since there were no comments.
>> >
>> > I did not care either way, but I did not like either of these
>> > hardcoded strings in the code, and felt that if we are touching
>> > that part of the code we also should be making real improvement
>> > at the same time ;-).
>> >
>> > Doing something like this would let us update it easier, and
>> > let people override with GITWEB_CONFIG if they want to.
>>
>> Reasonable.
>>
>> Acked-by: Petr Baudis <pasky@suse.cz>
>
> So, what happenned to this patch?
Did anybody send in an applicable patch?
^ permalink raw reply
* Re: [PATCH 6/6] gitweb: use blame --porcelain
From: Junio C Hamano @ 2006-10-05 21:18 UTC (permalink / raw)
To: git
In-Reply-To: <7vwt7ebhe9.fsf@assigned-by-dhcp.cox.net>
Side note.
This change does not give any more information (other than the
link to the corresponding line in the original version) than the
current gitweb in "next", but "blame --porcelain" returns richer
information than it used to be available, most notably the
summary line. It might be interesting to enhance the title pop-up
mechanism to show them on mouse-over, but I was too lazy ;-).
I've considered making the commit-8 link to link not to the
commit page for the originating commit but to the corresponding
line in the blame page for it, but opted to take over the line
number link, which was serving far less useful purpose. Your
keyboard has PgUp and PgDn to let you navigate within the same
blame output.
As I noted in the log message for [3/6], I suspect that the
curent implementation to show the original line number is
unnecessarily inefficient. Improvement is much encouraged.
Again, I am too lazy to look into it right now.
^ permalink raw reply
* [StGIT PATCH] Command to move a patch to the top
From: Robin Rosenberg @ 2006-10-05 21:14 UTC (permalink / raw)
To: git
In-Reply-To: <20061005211414.17126.64563.stgit@lathund.dewire.com>
From: Robin Rosenberg <robin.rosenberg@dewire.com>
---
stgit/commands/float.py | 78 +++++++++++++++++++++++++++++++++++++++++++++++
stgit/main.py | 3 ++
t/t1500-float.sh | 56 ++++++++++++++++++++++++++++++++++
3 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/stgit/commands/float.py b/stgit/commands/float.py
new file mode 100644
index 0000000..3e39b35
--- /dev/null
+++ b/stgit/commands/float.py
@@ -0,0 +1,78 @@
+
+__copyright__ = """
+Copyright (C) 2006, Robin Rosenberg <robin.rosenberg@dewire.com>
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License version 2 as
+published by the Free Software Foundation.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+"""
+
+import sys, os
+from optparse import OptionParser, make_option
+
+from stgit.commands.common import *
+from stgit.utils import *
+from stgit import stack, git
+
+help = 'push a patch to the top, even if applied'
+usage = """%prog [options]
+
+Push a patch to the top even if applied. The necessary
+pop and push operations will be performed to accomplish
+this. """
+
+#options = [make_option('-b', '--branch',
+# help = 'use BRANCH instead of the default one')].
+
+options = [make_option('-a', '--all',
+ help = 'push all the unapplied patches',
+ action = 'store_true'),
+ make_option('--keep',
+ help = 'keep the current working directory',
+ action = 'store_true'),
+ make_option('-m', '--merged',
+ help = 'check for patches merged upstream',
+ action = 'store_true') ]
+
+def func(parser, options, args):
+ """Pops and pushed to make the named patch the topmost patch
+ """
+
+ if not options.keep:
+ check_local_changes()
+ check_conflicts()
+ check_head_top_equal()
+
+ unapplied = crt_series.get_unapplied()
+ applied = crt_series.get_applied()
+ all = []
+ all.extend(unapplied)
+ all.extend(applied)
+
+ patches = parse_patches(args, all)
+
+ topush=[]
+ topop=[]
+
+ for p in patches:
+ while p in applied:
+ top = applied[-1]
+ print applied
+ if not top in patches:
+ topush.insert(0,top)
+ topop.append(top)
+ x = applied.pop()
+ for p in patches:
+ topush.append(p)
+
+ pop_patches(topop, options.keep)
+ push_patches(topush, options.merged)
diff --git a/stgit/main.py b/stgit/main.py
index f59bce6..e9cc6cd 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -38,6 +38,7 @@ import stgit.commands.clone
import stgit.commands.commit
import stgit.commands.export
import stgit.commands.files
+import stgit.commands.float
import stgit.commands.fold
import stgit.commands.goto
import stgit.commands.id
@@ -77,6 +78,7 @@ commands = {
'commit': stgit.commands.commit,
'export': stgit.commands.export,
'files': stgit.commands.files,
+ 'float': stgit.commands.float,
'fold': stgit.commands.fold,
'goto': stgit.commands.goto,
'id': stgit.commands.id,
@@ -113,6 +115,7 @@ stackcommands = (
'applied',
'clean',
'commit',
+ 'float',
'goto',
'init',
'pop',
diff --git a/t/t1500-float.sh b/t/t1500-float.sh
new file mode 100755
index 0000000..dbcd8ce
--- /dev/null
+++ b/t/t1500-float.sh
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Robin Rosenberg
+#
+
+test_description='Test floating a number of patches to the top of the stack
+
+'
+
+. ./test-lib.sh
+
+test_expect_success \
+ 'Initialize the StGIT repository' \
+ 'stg init &&
+ stg new A -m "a" && echo A >a.txt && stg add a.txt && stg refresh &&
+ stg new B -m "b" && echo B >b.txt && stg add b.txt && stg refresh &&
+ stg new C -m "c" && echo C >c.txt && stg add c.txt && stg refresh &&
+ stg new D -m "d" && echo D >d.txt && stg add d.txt && stg refresh &&
+ stg new E -m "e" && echo E >e.txt && stg add e.txt && stg refresh &&
+ stg new F -m "f" && echo F >f.txt && stg add f.txt && stg refresh &&
+ stg new G -m "g" && echo G >g.txt && stg add g.txt && stg refresh &&
+ stg pop &&
+ test "`echo \`cat .git/patches/master/applied\``" = "A B C D E F"
+ '
+
+test_expect_success \
+ 'Float A to top' \
+ 'stg float A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ '
+test_expect_success \
+ 'Float A to top (noop)' \
+ 'stg float A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "B C D E F A"
+ '
+test_expect_success \
+ 'Float B C to top' \
+ 'stg float B C &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D E F A B C"
+ '
+test_expect_success \
+ 'Float E A to top' \
+ 'stg float E A &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D F B C E A"
+ '
+test_expect_success \
+ 'Float E to top' \
+ 'stg float E &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D F B C A E"
+ '
+test_expect_success \
+ 'Float G F to top' \
+ 'stg float G F &&
+ test "`echo \`cat .git/patches/master/applied\``" = "D B C A E G F"
+ '
+test_done
^ permalink raw reply related
* [StGIT PATCH] (Repost) Command to move a patch to the top
From: Robin Rosenberg @ 2006-10-05 21:09 UTC (permalink / raw)
To: git
In-Reply-To: <20061003213453.26195.54830.stgit@lathund.dewire.com>
This is a repost of a proposed StGIT command that I find useful. The
previous patch was broken.
-- robin
^ permalink raw reply
* [PATCH 6/6] gitweb: use blame --porcelain
From: Junio C Hamano @ 2006-10-05 21:07 UTC (permalink / raw)
To: git
This makes gitweb (git_blame2) to use "blame --porcelain", which
lets the caller to figure out which line in the original version
each line comes from. Using this information, change the
behaviour of clicking the line number to go to the line of the
blame output for the original commit.
Before, clicking the line number meant "scoll up to show this
line at the beginning of the page", which was not all that
useful. The new behaviour lets you click on the line you are
interested in to view the line in the context it was introduced,
and keep digging deeper as you examine it.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* I've tested this only very lightly but it seems to be quite
pleasant to use.
gitweb/gitweb.perl | 65 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 44 insertions(+), 21 deletions(-)
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index d217187..29a56c3 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -971,6 +971,9 @@ sub parse_date {
$date{'hour_local'} = $hour;
$date{'minute_local'} = $min;
$date{'tz_local'} = $tz;
+ $date{'iso-tz'} = sprintf ("%04d-%02d-%02d %02d:%02d:%02d %s",
+ 1900+$year, $mon+1, $mday,
+ $hour, $min, $sec, $tz);
return %date;
}
@@ -2496,7 +2499,8 @@ sub git_blame2 {
if ($ftype !~ "blob") {
die_error("400 Bad Request", "Object is not a blob");
}
- open ($fd, "-|", git_cmd(), "blame", '-l', '--', $file_name, $hash_base)
+ open ($fd, "-|", git_cmd(), "blame", '--porcelain', '--',
+ $file_name, $hash_base)
or die_error(undef, "Open git-blame failed");
git_header_html();
my $formats_nav =
@@ -2520,33 +2524,52 @@ sub git_blame2 {
<table class="blame">
<tr><th>Commit</th><th>Line</th><th>Data</th></tr>
HTML
- while (<$fd>) {
- my ($full_rev, $author, $date, $lineno, $data) =
- /^([0-9a-f]{40}).*?\s\((.*?)\s+([-\d]+ [:\d]+ [-+\d]+)\s+(\d+)\)\s(.*)/;
+ my %metainfo = ();
+ while (1) {
+ $_ = <$fd>;
+ last unless defined $_;
+ my ($full_rev, $lineno, $orig_lineno, $group_size) =
+ /^([0-9a-f]{40}) (\d+) (\d+)(?: (\d+))?$/;
+ if (!exists $metainfo{$full_rev}) {
+ $metainfo{$full_rev} = {};
+ }
+ my $meta = $metainfo{$full_rev};
+ while (<$fd>) {
+ last if (s/^\t//);
+ if (/^(\S+) (.*)$/) {
+ $meta->{$1} = $2;
+ }
+ }
+ my $data = $_;
my $rev = substr($full_rev, 0, 8);
- my $print_c8 = 0;
-
- if (!defined $last_rev) {
- $last_rev = $full_rev;
- $print_c8 = 1;
- } elsif ($last_rev ne $full_rev) {
- $last_rev = $full_rev;
+ my $author = $meta->{'author'};
+ my %date = parse_date($meta->{'author-time'},
+ $meta->{'author-tz'});
+ my $date = $date{'iso-tz'};
+ if ($group_size) {
$current_color = ++$current_color % $num_colors;
- $print_c8 = 1;
}
print "<tr class=\"$rev_color[$current_color]\">\n";
- print "<td class=\"sha1\"";
- if ($print_c8 == 1) {
+ if ($group_size) {
+ print "<td class=\"sha1\"";
print " title=\"$author, $date\"";
- }
- print ">";
- if ($print_c8 == 1) {
- print $cgi->a({-href => href(action=>"commit", hash=>$full_rev, file_name=>$file_name)},
+ print " rowspan=\"$group_size\"" if ($group_size > 1);
+ print ">";
+ print $cgi->a({-href => href(action=>"commit",
+ hash=>$full_rev,
+ file_name=>$file_name)},
esc_html($rev));
+ print "</td>\n";
}
- print "</td>\n";
- print "<td class=\"linenr\"><a id=\"l$lineno\" href=\"#l$lineno\" class=\"linenr\">" .
- esc_html($lineno) . "</a></td>\n";
+ my $blamed = href(action => 'blame',
+ file_name => $meta->{'filename'},
+ hash_base => $full_rev);
+ print "<td class=\"linenr\">";
+ print $cgi->a({ -href => "$blamed#l$lineno",
+ -id => "l$lineno",
+ -class => "linenr" },
+ esc_html($lineno));
+ print "</td>";
print "<td class=\"pre\">" . esc_html($data) . "</td>\n";
print "</tr>\n";
}
--
1.4.2.3.g866f3
^ permalink raw reply related
* [PATCH 5/6] git-blame --porcelain
From: Junio C Hamano @ 2006-10-05 21:07 UTC (permalink / raw)
To: git
The new option makes the command's native output format to emit
output that is easier to handle by Porcelain.
Each line is output after a header. The header at the minimum
has the first line which has:
- 40-byte SHA-1 of the commit the line is attributed to;
- the line number of the line in the final file;
- the line number of the line in the original file;
- on a line that starts a group of line from a different commit
than the previous one, the number of lines in this group. On
subsequent lines this field is absent.
This header line is followed by the following information once
for each commit:
- author name ("author"), email ("author-mail"), time
("author-time"), and timezone ("author-tz"); similarly for
committer.
- filename in the commit the line is attributed to.
- the first line of the commit log message ("summary").
The contents of the actual line is output after the above
header, prefixed by a TAB. This is to allow adding more header
elements later.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
* By now, Luben would have guessed where this series is leading
to...
blame.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++---------
1 files changed, 127 insertions(+), 22 deletions(-)
diff --git a/blame.c b/blame.c
index 47471e8..8189318 100644
--- a/blame.c
+++ b/blame.c
@@ -17,6 +17,7 @@ #include "diff.h"
#include "diffcore.h"
#include "revision.h"
#include "xdiff-interface.h"
+#include "quote.h"
#define DEBUG 0
@@ -40,6 +41,7 @@ struct util_info {
unsigned long size;
int num_lines;
const char *pathname;
+ unsigned meta_given:1;
void *topo_data;
};
@@ -332,12 +334,8 @@ static struct util_info *get_util(struct
if (util)
return util;
- util = xmalloc(sizeof(struct util_info));
- util->buf = NULL;
- util->size = 0;
- util->line_map = NULL;
+ util = xcalloc(1, sizeof(struct util_info));
util->num_lines = -1;
- util->pathname = NULL;
commit->util = util;
return util;
}
@@ -642,39 +640,99 @@ struct commit_info
char *author_mail;
unsigned long author_time;
char *author_tz;
+
+ /* filled only when asked for details */
+ char *committer;
+ char *committer_mail;
+ unsigned long committer_time;
+ char *committer_tz;
+
+ char *summary;
};
-static void get_commit_info(struct commit *commit, struct commit_info *ret)
+static void get_ac_line(const char *inbuf, const char *what,
+ int bufsz, char *person, char **mail,
+ unsigned long *time, char **tz)
{
int len;
- char *tmp;
- static char author_buf[1024];
-
- tmp = strstr(commit->buffer, "\nauthor ") + 8;
- len = strchr(tmp, '\n') - tmp;
- ret->author = author_buf;
- memcpy(ret->author, tmp, len);
+ char *tmp, *endp;
+
+ tmp = strstr(inbuf, what);
+ if (!tmp)
+ goto error_out;
+ tmp += strlen(what);
+ endp = strchr(tmp, '\n');
+ if (!endp)
+ len = strlen(tmp);
+ else
+ len = endp - tmp;
+ if (bufsz <= len) {
+ error_out:
+ /* Ugh */
+ person = *mail = *tz = "(unknown)";
+ *time = 0;
+ return;
+ }
+ memcpy(person, tmp, len);
- tmp = ret->author;
+ tmp = person;
tmp += len;
*tmp = 0;
while (*tmp != ' ')
tmp--;
- ret->author_tz = tmp+1;
+ *tz = tmp+1;
*tmp = 0;
while (*tmp != ' ')
tmp--;
- ret->author_time = strtoul(tmp, NULL, 10);
+ *time = strtoul(tmp, NULL, 10);
*tmp = 0;
while (*tmp != ' ')
tmp--;
- ret->author_mail = tmp + 1;
-
+ *mail = tmp + 1;
*tmp = 0;
}
+static void get_commit_info(struct commit *commit, struct commit_info *ret, int detailed)
+{
+ int len;
+ char *tmp, *endp;
+ static char author_buf[1024];
+ static char committer_buf[1024];
+ static char summary_buf[1024];
+
+ ret->author = author_buf;
+ get_ac_line(commit->buffer, "\nauthor ",
+ sizeof(author_buf), author_buf, &ret->author_mail,
+ &ret->author_time, &ret->author_tz);
+
+ if (!detailed)
+ return;
+
+ ret->committer = committer_buf;
+ get_ac_line(commit->buffer, "\ncommitter ",
+ sizeof(committer_buf), committer_buf, &ret->committer_mail,
+ &ret->committer_time, &ret->committer_tz);
+
+ ret->summary = summary_buf;
+ tmp = strstr(commit->buffer, "\n\n");
+ if (!tmp) {
+ error_out:
+ sprintf(summary_buf, "(%s)", sha1_to_hex(commit->object.sha1));
+ return;
+ }
+ tmp += 2;
+ endp = strchr(tmp, '\n');
+ if (!endp)
+ goto error_out;
+ len = endp - tmp;
+ if (len >= sizeof(summary_buf))
+ goto error_out;
+ memcpy(summary_buf, tmp, len);
+ summary_buf[len] = 0;
+}
+
static const char *format_time(unsigned long time, const char *tz_str,
int show_raw_time)
{
@@ -751,7 +809,7 @@ static int find_orig_linenum(struct util
}
static void emit_meta(struct commit *c, int lno,
- int sha1_len, int compatibility,
+ int sha1_len, int compatibility, int porcelain,
int show_name, int show_number, int show_raw_time,
int longest_file, int longest_author,
int max_digits, int max_orig_digits)
@@ -763,7 +821,47 @@ static void emit_meta(struct commit *c,
u = c->util;
lineno = find_orig_linenum(u, lno);
- get_commit_info(c, &ci);
+ if (porcelain) {
+ int group_size = -1;
+ struct commit *cc = (lno == 0) ? NULL : blame_lines[lno-1];
+ if (cc != c) {
+ /* This is the beginning of this group */
+ int i;
+ for (i = lno + 1; i < num_blame_lines; i++)
+ if (blame_lines[i] != c)
+ break;
+ group_size = i - lno;
+ }
+ if (0 < group_size)
+ printf("%s %d %d %d\n", sha1_to_hex(c->object.sha1),
+ lno + 1, lineno, group_size);
+ else
+ printf("%s %d %d\n", sha1_to_hex(c->object.sha1),
+ lno + 1, lineno);
+ if (!u->meta_given) {
+ get_commit_info(c, &ci, 1);
+ printf("author %s\n", ci.author);
+ printf("author-mail %s\n", ci.author_mail);
+ printf("author-time %lu\n", ci.author_time);
+ printf("author-tz %s\n", ci.author_tz);
+ printf("committer %s\n", ci.committer);
+ printf("committer-mail %s\n", ci.committer_mail);
+ printf("committer-time %lu\n", ci.committer_time);
+ printf("committer-tz %s\n", ci.committer_tz);
+ printf("filename ");
+ if (quote_c_style(u->pathname, NULL, NULL, 0))
+ quote_c_style(u->pathname, NULL, stdout, 0);
+ else
+ fputs(u->pathname, stdout);
+ printf("\nsummary %s\n", ci.summary);
+
+ u->meta_given = 1;
+ }
+ putchar('\t');
+ return;
+ }
+
+ get_commit_info(c, &ci, 0);
fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
if (compatibility) {
printf("\t(%10s\t%10s\t%d)", ci.author,
@@ -809,6 +907,7 @@ int main(int argc, const char **argv)
int longest_file, longest_author, longest_file_lines;
int show_name = 0;
int show_number = 0;
+ int porcelain = 0;
const char *prefix = setup_git_directory();
git_config(git_default_config);
@@ -852,6 +951,12 @@ int main(int argc, const char **argv)
show_number = 1;
continue;
}
+ if (!strcmp(argv[i], "--porcelain")) {
+ porcelain = 1;
+ sha1_len = 40;
+ show_raw_time = 1;
+ continue;
+ }
if (!strcmp(argv[i], "--")) {
options = 0;
continue;
@@ -934,7 +1039,7 @@ int main(int argc, const char **argv)
longest_file = strlen(u->pathname);
if (longest_file_lines < u->num_lines)
longest_file_lines = u->num_lines;
- get_commit_info(c, &ci);
+ get_commit_info(c, &ci, 0);
if (longest_author < strlen(ci.author))
longest_author = strlen(ci.author);
}
@@ -943,7 +1048,7 @@ int main(int argc, const char **argv)
for (i = 0; i < num_blame_lines; i++) {
emit_meta(blame_lines[i], i,
- sha1_len, compatibility,
+ sha1_len, compatibility, porcelain,
show_name, show_number, show_raw_time,
longest_file, longest_author,
max_digits, max_orig_digits);
--
1.4.2.3.g866f3
^ permalink raw reply related
* [PATCH 3/6] git-blame: --show-number (and -n)
From: Junio C Hamano @ 2006-10-05 21:06 UTC (permalink / raw)
To: git
The new option makes the command's native output format show the
original line number in the blamed revision.
Note: the current implementation of find_orig_linenum involves
linear search through the line_map array every time. It should
probably build a reverse map upfront and do a simple look-up to
speed things up, but I'll leave it to more clever and beautiful
people ;-).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
blame.c | 42 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 38 insertions(+), 4 deletions(-)
diff --git a/blame.c b/blame.c
index d830b29..bf4a1a1 100644
--- a/blame.c
+++ b/blame.c
@@ -731,6 +731,25 @@ static int read_ancestry(const char *gra
return 0;
}
+static int lineno_width(int lines)
+{
+ int i, width;
+
+ for (width = 1, i = 10; i <= lines + 1; width++)
+ i *= 10;
+ return width;
+}
+
+static int find_orig_linenum(struct util_info *u, int lineno)
+{
+ int i;
+
+ for (i = 0; i < u->num_lines; i++)
+ if (lineno == u->line_map[i])
+ return i + 1;
+ return 0;
+}
+
int main(int argc, const char **argv)
{
int i;
@@ -750,9 +769,10 @@ int main(int argc, const char **argv)
struct commit_info ci;
const char *buf;
- int max_digits;
- int longest_file, longest_author;
+ int max_digits, max_orig_digits;
+ int longest_file, longest_author, longest_file_lines;
int show_name = 0;
+ int show_number = 0;
const char *prefix = setup_git_directory();
git_config(git_default_config);
@@ -791,6 +811,11 @@ int main(int argc, const char **argv)
show_name = 1;
continue;
}
+ if (!strcmp(argv[i], "-n") ||
+ !strcmp(argv[i], "--show-number")) {
+ show_number = 1;
+ continue;
+ }
if (!strcmp(argv[i], "--")) {
options = 0;
continue;
@@ -853,11 +878,11 @@ int main(int argc, const char **argv)
process_commits(&rev, filename, &initial);
buf = blame_contents;
- for (max_digits = 1, i = 10; i <= num_blame_lines + 1; max_digits++)
- i *= 10;
+ max_digits = lineno_width(num_blame_lines);
longest_file = 0;
longest_author = 0;
+ longest_file_lines = 0;
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
struct util_info *u;
@@ -869,17 +894,23 @@ int main(int argc, const char **argv)
show_name = 1;
if (longest_file < strlen(u->pathname))
longest_file = strlen(u->pathname);
+ if (longest_file_lines < u->num_lines)
+ longest_file_lines = u->num_lines;
get_commit_info(c, &ci);
if (longest_author < strlen(ci.author))
longest_author = strlen(ci.author);
}
+ max_orig_digits = lineno_width(longest_file_lines);
+
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
struct util_info *u;
+ int lineno;
if (!c)
c = initial;
u = c->util;
+ lineno = find_orig_linenum(u, i);
get_commit_info(c, &ci);
fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
@@ -893,6 +924,9 @@ int main(int argc, const char **argv)
if (show_name)
printf(" %-*.*s", longest_file, longest_file,
u->pathname);
+ if (show_number)
+ printf(" %*d", max_orig_digits,
+ lineno);
printf(" (%-*.*s %10s %*d) ",
longest_author, longest_author, ci.author,
format_time(ci.author_time, ci.author_tz,
--
1.4.2.3.g866f3
^ permalink raw reply related
* [PATCH 4/5] blame.c: move code to output metainfo into a separate function.
From: Junio C Hamano @ 2006-10-05 21:06 UTC (permalink / raw)
To: git
This does not change any behaviour, but just separates out the
code to emit the initial part of the output of each line into a
separate function, since I'll be mucking with it further.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
blame.c | 76 +++++++++++++++++++++++++++++++++++++-------------------------
1 files changed, 45 insertions(+), 31 deletions(-)
diff --git a/blame.c b/blame.c
index bf4a1a1..47471e8 100644
--- a/blame.c
+++ b/blame.c
@@ -750,6 +750,42 @@ static int find_orig_linenum(struct util
return 0;
}
+static void emit_meta(struct commit *c, int lno,
+ int sha1_len, int compatibility,
+ int show_name, int show_number, int show_raw_time,
+ int longest_file, int longest_author,
+ int max_digits, int max_orig_digits)
+{
+ struct util_info *u;
+ int lineno;
+ struct commit_info ci;
+
+ u = c->util;
+ lineno = find_orig_linenum(u, lno);
+
+ get_commit_info(c, &ci);
+ fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
+ if (compatibility) {
+ printf("\t(%10s\t%10s\t%d)", ci.author,
+ format_time(ci.author_time, ci.author_tz,
+ show_raw_time),
+ lno + 1);
+ }
+ else {
+ if (show_name)
+ printf(" %-*.*s", longest_file, longest_file,
+ u->pathname);
+ if (show_number)
+ printf(" %*d", max_orig_digits,
+ lineno);
+ printf(" (%-*.*s %10s %*d) ",
+ longest_author, longest_author, ci.author,
+ format_time(ci.author_time, ci.author_tz,
+ show_raw_time),
+ max_digits, lno + 1);
+ }
+}
+
int main(int argc, const char **argv)
{
int i;
@@ -877,6 +913,10 @@ int main(int argc, const char **argv)
prepare_revision_walk(&rev);
process_commits(&rev, filename, &initial);
+ for (i = 0; i < num_blame_lines; i++)
+ if (!blame_lines[i])
+ blame_lines[i] = initial;
+
buf = blame_contents;
max_digits = lineno_width(num_blame_lines);
@@ -886,8 +926,6 @@ int main(int argc, const char **argv)
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
struct util_info *u;
- if (!c)
- c = initial;
u = c->util;
if (!show_name && strcmp(filename, u->pathname))
@@ -904,35 +942,11 @@ int main(int argc, const char **argv)
max_orig_digits = lineno_width(longest_file_lines);
for (i = 0; i < num_blame_lines; i++) {
- struct commit *c = blame_lines[i];
- struct util_info *u;
- int lineno;
- if (!c)
- c = initial;
- u = c->util;
- lineno = find_orig_linenum(u, i);
-
- get_commit_info(c, &ci);
- fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
- if (compatibility) {
- printf("\t(%10s\t%10s\t%d)", ci.author,
- format_time(ci.author_time, ci.author_tz,
- show_raw_time),
- i+1);
- }
- else {
- if (show_name)
- printf(" %-*.*s", longest_file, longest_file,
- u->pathname);
- if (show_number)
- printf(" %*d", max_orig_digits,
- lineno);
- printf(" (%-*.*s %10s %*d) ",
- longest_author, longest_author, ci.author,
- format_time(ci.author_time, ci.author_tz,
- show_raw_time),
- max_digits, i+1);
- }
+ emit_meta(blame_lines[i], i,
+ sha1_len, compatibility,
+ show_name, show_number, show_raw_time,
+ longest_file, longest_author,
+ max_digits, max_orig_digits);
if (i == num_blame_lines - 1) {
fwrite(buf, blame_len - (buf - blame_contents),
--
1.4.2.3.g866f3
^ permalink raw reply related
* [PATCH 2/6] git-blame: --show-name (and -f)
From: Junio C Hamano @ 2006-10-05 21:06 UTC (permalink / raw)
To: git
The new option makes the command's native output format show the
filename even when there were no renames in its history, to make
it simpler for Porcelains to parse its output.
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
blame.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/blame.c b/blame.c
index 394b5c3..d830b29 100644
--- a/blame.c
+++ b/blame.c
@@ -752,7 +752,7 @@ int main(int argc, const char **argv)
const char *buf;
int max_digits;
int longest_file, longest_author;
- int found_rename;
+ int show_name = 0;
const char *prefix = setup_git_directory();
git_config(git_default_config);
@@ -786,6 +786,11 @@ int main(int argc, const char **argv)
}
usage(blame_usage);
}
+ if (!strcmp(argv[i], "-f") ||
+ !strcmp(argv[i], "--show-name")) {
+ show_name = 1;
+ continue;
+ }
if (!strcmp(argv[i], "--")) {
options = 0;
continue;
@@ -853,7 +858,6 @@ int main(int argc, const char **argv)
longest_file = 0;
longest_author = 0;
- found_rename = 0;
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
struct util_info *u;
@@ -861,8 +865,8 @@ int main(int argc, const char **argv)
c = initial;
u = c->util;
- if (!found_rename && strcmp(filename, u->pathname))
- found_rename = 1;
+ if (!show_name && strcmp(filename, u->pathname))
+ show_name = 1;
if (longest_file < strlen(u->pathname))
longest_file = strlen(u->pathname);
get_commit_info(c, &ci);
@@ -886,7 +890,7 @@ int main(int argc, const char **argv)
i+1);
}
else {
- if (found_rename)
+ if (show_name)
printf(" %-*.*s", longest_file, longest_file,
u->pathname);
printf(" (%-*.*s %10s %*d) ",
--
1.4.2.3.g866f3
^ permalink raw reply related
* [PATCH 1/6] blame.c: whitespace and formatting clean-up.
From: Junio C Hamano @ 2006-10-05 21:00 UTC (permalink / raw)
To: git
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
blame.c | 200 +++++++++++++++++++++++++++++++-------------------------------
1 files changed, 100 insertions(+), 100 deletions(-)
diff --git a/blame.c b/blame.c
index 8cfd5d9..394b5c3 100644
--- a/blame.c
+++ b/blame.c
@@ -20,16 +20,17 @@ #include "xdiff-interface.h"
#define DEBUG 0
-static const char blame_usage[] = "git-blame [-c] [-l] [-t] [-S <revs-file>] [--] file [commit]\n"
- " -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
- " -l, --long Show long commit SHA1 (Default: off)\n"
- " -t, --time Show raw timestamp (Default: off)\n"
- " -S, --revs-file Use revisions from revs-file instead of calling git-rev-list\n"
- " -h, --help This message";
+static const char blame_usage[] =
+"git-blame [-c] [-l] [-t] [-S <revs-file>] [--] file [commit]\n"
+" -c, --compatibility Use the same output mode as git-annotate (Default: off)\n"
+" -l, --long Show long commit SHA1 (Default: off)\n"
+" -t, --time Show raw timestamp (Default: off)\n"
+" -S, --revs-file Use revisions from revs-file instead of calling git-rev-list\n"
+" -h, --help This message";
static struct commit **blame_lines;
static int num_blame_lines;
-static char* blame_contents;
+static char *blame_contents;
static int blame_len;
struct util_info {
@@ -38,9 +39,9 @@ struct util_info {
char *buf;
unsigned long size;
int num_lines;
- const char* pathname;
+ const char *pathname;
- void* topo_data;
+ void *topo_data;
};
struct chunk {
@@ -156,11 +157,10 @@ static int get_blob_sha1_internal(const
unsigned mode, int stage);
static unsigned char blob_sha1[20];
-static const char* blame_file;
+static const char *blame_file;
static int get_blob_sha1(struct tree *t, const char *pathname,
unsigned char *sha1)
{
- int i;
const char *pathspec[2];
blame_file = pathname;
pathspec[0] = pathname;
@@ -168,12 +168,7 @@ static int get_blob_sha1(struct tree *t,
hashclr(blob_sha1);
read_tree_recursive(t, "", 0, 0, pathspec, get_blob_sha1_internal);
- for (i = 0; i < 20; i++) {
- if (blob_sha1[i] != 0)
- break;
- }
-
- if (i == 20)
+ if (is_null_sha1(blob_sha1))
return -1;
hashcpy(sha1, blob_sha1);
@@ -239,7 +234,8 @@ static void print_map(struct commit *cmi
if (i < util->num_lines) {
num = util->line_map[i];
printf("%d\t", num);
- } else
+ }
+ else
printf("\t");
if (i < util2->num_lines) {
@@ -247,7 +243,8 @@ static void print_map(struct commit *cmi
printf("%d\t", num2);
if (num != -1 && num2 != num)
printf("---");
- } else
+ }
+ else
printf("\t");
printf("\n");
@@ -266,12 +263,12 @@ static void fill_line_map(struct commit
int cur_chunk = 0;
int i1, i2;
- if (p->num && DEBUG)
- print_patch(p);
-
- if (DEBUG)
+ if (DEBUG) {
+ if (p->num)
+ print_patch(p);
printf("num lines 1: %d num lines 2: %d\n", util->num_lines,
util2->num_lines);
+ }
for (i1 = 0, i2 = 0; i1 < util->num_lines; i1++, i2++) {
struct chunk *chunk = NULL;
@@ -293,7 +290,8 @@ static void fill_line_map(struct commit
i2 += chunk->len2;
cur_chunk++;
- } else {
+ }
+ else {
if (i2 >= util2->num_lines)
break;
@@ -327,7 +325,7 @@ static int map_line(struct commit *commi
return info->line_map[line];
}
-static struct util_info* get_util(struct commit *commit)
+static struct util_info *get_util(struct commit *commit)
{
struct util_info *util = commit->util;
@@ -369,7 +367,7 @@ static void alloc_line_map(struct commit
if (util->buf[i] == '\n')
util->num_lines++;
}
- if(util->buf[util->size - 1] != '\n')
+ if (util->buf[util->size - 1] != '\n')
util->num_lines++;
util->line_map = xmalloc(sizeof(int) * util->num_lines);
@@ -378,9 +376,9 @@ static void alloc_line_map(struct commit
util->line_map[i] = -1;
}
-static void init_first_commit(struct commit* commit, const char* filename)
+static void init_first_commit(struct commit *commit, const char *filename)
{
- struct util_info* util = commit->util;
+ struct util_info *util = commit->util;
int i;
util->pathname = filename;
@@ -395,18 +393,17 @@ static void init_first_commit(struct com
util->line_map[i] = i;
}
-
static void process_commits(struct rev_info *rev, const char *path,
- struct commit** initial)
+ struct commit **initial)
{
int i;
- struct util_info* util;
+ struct util_info *util;
int lines_left;
int *blame_p;
int *new_lines;
int new_lines_len;
- struct commit* commit = get_revision(rev);
+ struct commit *commit = get_revision(rev);
assert(commit);
init_first_commit(commit, path);
@@ -442,7 +439,7 @@ static void process_commits(struct rev_i
parents != NULL; parents = parents->next)
num_parents++;
- if(num_parents == 0)
+ if (num_parents == 0)
*initial = commit;
if (fill_util_info(commit))
@@ -503,13 +500,12 @@ static void process_commits(struct rev_i
} while ((commit = get_revision(rev)) != NULL);
}
-
-static int compare_tree_path(struct rev_info* revs,
- struct commit* c1, struct commit* c2)
+static int compare_tree_path(struct rev_info *revs,
+ struct commit *c1, struct commit *c2)
{
int ret;
- const char* paths[2];
- struct util_info* util = c2->util;
+ const char *paths[2];
+ struct util_info *util = c2->util;
paths[0] = util->pathname;
paths[1] = NULL;
@@ -520,12 +516,11 @@ static int compare_tree_path(struct rev_
return ret;
}
-
-static int same_tree_as_empty_path(struct rev_info *revs, struct tree* t1,
- const char* path)
+static int same_tree_as_empty_path(struct rev_info *revs, struct tree *t1,
+ const char *path)
{
int ret;
- const char* paths[2];
+ const char *paths[2];
paths[0] = path;
paths[1] = NULL;
@@ -536,9 +531,9 @@ static int same_tree_as_empty_path(struc
return ret;
}
-static const char* find_rename(struct commit* commit, struct commit* parent)
+static const char *find_rename(struct commit *commit, struct commit *parent)
{
- struct util_info* cutil = commit->util;
+ struct util_info *cutil = commit->util;
struct diff_options diff_opts;
const char *paths[1];
int i;
@@ -564,9 +559,11 @@ static const char* find_rename(struct co
for (i = 0; i < diff_queued_diff.nr; i++) {
struct diff_filepair *p = diff_queued_diff.queue[i];
- if (p->status == 'R' && !strcmp(p->one->path, cutil->pathname)) {
+ if (p->status == 'R' &&
+ !strcmp(p->one->path, cutil->pathname)) {
if (DEBUG)
- printf("rename %s -> %s\n", p->one->path, p->two->path);
+ printf("rename %s -> %s\n",
+ p->one->path, p->two->path);
return p->two->path;
}
}
@@ -582,7 +579,7 @@ static void simplify_commit(struct rev_i
return;
if (!commit->parents) {
- struct util_info* util = commit->util;
+ struct util_info *util = commit->util;
if (!same_tree_as_empty_path(revs, commit->tree,
util->pathname))
commit->object.flags |= TREECHANGE;
@@ -608,17 +605,17 @@ static void simplify_commit(struct rev_i
case REV_TREE_NEW:
{
-
- struct util_info* util = commit->util;
+ struct util_info *util = commit->util;
if (revs->remove_empty_trees &&
same_tree_as_empty_path(revs, p->tree,
util->pathname)) {
- const char* new_name = find_rename(commit, p);
+ const char *new_name = find_rename(commit, p);
if (new_name) {
- struct util_info* putil = get_util(p);
+ struct util_info *putil = get_util(p);
if (!putil->pathname)
putil->pathname = xstrdup(new_name);
- } else {
+ }
+ else {
*pp = parent->next;
continue;
}
@@ -639,19 +636,18 @@ static void simplify_commit(struct rev_i
commit->object.flags |= TREECHANGE;
}
-
struct commit_info
{
- char* author;
- char* author_mail;
+ char *author;
+ char *author_mail;
unsigned long author_time;
- char* author_tz;
+ char *author_tz;
};
-static void get_commit_info(struct commit* commit, struct commit_info* ret)
+static void get_commit_info(struct commit *commit, struct commit_info *ret)
{
int len;
- char* tmp;
+ char *tmp;
static char author_buf[1024];
tmp = strstr(commit->buffer, "\nauthor ") + 8;
@@ -662,24 +658,24 @@ static void get_commit_info(struct commi
tmp = ret->author;
tmp += len;
*tmp = 0;
- while(*tmp != ' ')
+ while (*tmp != ' ')
tmp--;
ret->author_tz = tmp+1;
*tmp = 0;
- while(*tmp != ' ')
+ while (*tmp != ' ')
tmp--;
ret->author_time = strtoul(tmp, NULL, 10);
*tmp = 0;
- while(*tmp != ' ')
+ while (*tmp != ' ')
tmp--;
ret->author_mail = tmp + 1;
*tmp = 0;
}
-static const char* format_time(unsigned long time, const char* tz_str,
+static const char *format_time(unsigned long time, const char *tz_str,
int show_raw_time)
{
static char time_buf[128];
@@ -704,15 +700,15 @@ static const char* format_time(unsigned
return time_buf;
}
-static void topo_setter(struct commit* c, void* data)
+static void topo_setter(struct commit *c, void *data)
{
- struct util_info* util = c->util;
+ struct util_info *util = c->util;
util->topo_data = data;
}
-static void* topo_getter(struct commit* c)
+static void *topo_getter(struct commit *c)
{
- struct util_info* util = c->util;
+ struct util_info *util = c->util;
return util->topo_data;
}
@@ -747,9 +743,9 @@ int main(int argc, const char **argv)
int compatibility = 0;
int show_raw_time = 0;
int options = 1;
- struct commit* start_commit;
+ struct commit *start_commit;
- const char* args[10];
+ const char *args[10];
struct rev_info rev;
struct commit_info ci;
@@ -758,27 +754,30 @@ int main(int argc, const char **argv)
int longest_file, longest_author;
int found_rename;
- const char* prefix = setup_git_directory();
+ const char *prefix = setup_git_directory();
git_config(git_default_config);
- for(i = 1; i < argc; i++) {
- if(options) {
- if(!strcmp(argv[i], "-h") ||
+ for (i = 1; i < argc; i++) {
+ if (options) {
+ if (!strcmp(argv[i], "-h") ||
!strcmp(argv[i], "--help"))
usage(blame_usage);
- else if(!strcmp(argv[i], "-l") ||
- !strcmp(argv[i], "--long")) {
+ if (!strcmp(argv[i], "-l") ||
+ !strcmp(argv[i], "--long")) {
sha1_len = 40;
continue;
- } else if(!strcmp(argv[i], "-c") ||
- !strcmp(argv[i], "--compatibility")) {
+ }
+ if (!strcmp(argv[i], "-c") ||
+ !strcmp(argv[i], "--compatibility")) {
compatibility = 1;
continue;
- } else if(!strcmp(argv[i], "-t") ||
- !strcmp(argv[i], "--time")) {
+ }
+ if (!strcmp(argv[i], "-t") ||
+ !strcmp(argv[i], "--time")) {
show_raw_time = 1;
continue;
- } else if(!strcmp(argv[i], "-S")) {
+ }
+ if (!strcmp(argv[i], "-S")) {
if (i + 1 < argc &&
!read_ancestry(argv[i + 1], &sha1_p)) {
compatibility = 1;
@@ -786,33 +785,34 @@ int main(int argc, const char **argv)
continue;
}
usage(blame_usage);
- } else if(!strcmp(argv[i], "--")) {
+ }
+ if (!strcmp(argv[i], "--")) {
options = 0;
continue;
- } else if(argv[i][0] == '-')
+ }
+ if (argv[i][0] == '-')
usage(blame_usage);
- else
- options = 0;
+ options = 0;
}
- if(!options) {
- if(!filename)
+ if (!options) {
+ if (!filename)
filename = argv[i];
- else if(!commit)
+ else if (!commit)
commit = argv[i];
else
usage(blame_usage);
}
}
- if(!filename)
+ if (!filename)
usage(blame_usage);
if (commit && sha1_p)
usage(blame_usage);
- else if(!commit)
+ else if (!commit)
commit = "HEAD";
- if(prefix)
+ if (prefix)
sprintf(filename_buf, "%s%s", prefix, filename);
else
strcpy(filename_buf, filename);
@@ -830,7 +830,6 @@ int main(int argc, const char **argv)
return 1;
}
-
init_revisions(&rev, setup_git_directory());
rev.remove_empty_trees = 1;
rev.topo_order = 1;
@@ -857,7 +856,7 @@ int main(int argc, const char **argv)
found_rename = 0;
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
- struct util_info* u;
+ struct util_info *u;
if (!c)
c = initial;
u = c->util;
@@ -873,20 +872,20 @@ int main(int argc, const char **argv)
for (i = 0; i < num_blame_lines; i++) {
struct commit *c = blame_lines[i];
- struct util_info* u;
-
+ struct util_info *u;
if (!c)
c = initial;
-
u = c->util;
+
get_commit_info(c, &ci);
fwrite(sha1_to_hex(c->object.sha1), sha1_len, 1, stdout);
- if(compatibility) {
+ if (compatibility) {
printf("\t(%10s\t%10s\t%d)", ci.author,
format_time(ci.author_time, ci.author_tz,
show_raw_time),
i+1);
- } else {
+ }
+ else {
if (found_rename)
printf(" %-*.*s", longest_file, longest_file,
u->pathname);
@@ -897,13 +896,14 @@ int main(int argc, const char **argv)
max_digits, i+1);
}
- if(i == num_blame_lines - 1) {
+ if (i == num_blame_lines - 1) {
fwrite(buf, blame_len - (buf - blame_contents),
1, stdout);
- if(blame_contents[blame_len-1] != '\n')
+ if (blame_contents[blame_len-1] != '\n')
putc('\n', stdout);
- } else {
- char* next_buf = strchr(buf, '\n') + 1;
+ }
+ else {
+ char *next_buf = strchr(buf, '\n') + 1;
fwrite(buf, next_buf - buf, 1, stdout);
buf = next_buf;
}
--
1.4.2.3.g866f3
^ permalink raw reply related
* Re: [RFC][PATCH] gitweb: Make the Git logo link target to point to the homepage
From: Petr Baudis @ 2006-10-05 20:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <20060923194643.GN13132@pasky.or.cz>
Dear diary, on Sat, Sep 23, 2006 at 09:46:43PM CEST, I got a letter
where Petr Baudis <pasky@suse.cz> said that...
> Dear diary, on Sat, Sep 23, 2006 at 09:36:01PM CEST, I got a letter
> where Junio C Hamano <junkio@cox.net> said that...
> > Petr Baudis <pasky@suse.cz> writes:
> >
> > > Dear diary, on Tue, Sep 19, 2006 at 11:27:25PM CEST, I got a letter
> > > where Petr Baudis <pasky@suse.cz> said that...
> > >> It provides more useful information for causual Git users than the Git docs
> > >> (especially about where to get Git and such).
> > >>
> > >> Signed-off-by: Petr Baudis <pasky@suse.cz>
> > >
> > > Ping? This is the only gitweb patch still in my stg stack. I guess
> > > noone really cares strongly either way since there were no comments.
> >
> > I did not care either way, but I did not like either of these
> > hardcoded strings in the code, and felt that if we are touching
> > that part of the code we also should be making real improvement
> > at the same time ;-).
> >
> > Doing something like this would let us update it easier, and
> > let people override with GITWEB_CONFIG if they want to.
>
> Reasonable.
>
> Acked-by: Petr Baudis <pasky@suse.cz>
So, what happenned to this patch?
Thanks,
--
Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
$/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)
^ permalink raw reply
* Re: [PATCH] Gitweb - provide site headers and footers
From: Alan Chandler @ 2006-10-05 20:45 UTC (permalink / raw)
To: git
In-Reply-To: <E1GUkNO-0007p9-QJ@home.chandlerfamily.org.uk>
On Tuesday 03 October 2006 14:32, Alan Chandler wrote:
> Alan Chandler writes:
> > From: Alan Chandler <alan@chandlerfamily.org.uk>
> >
> > This allows web sites with a header and footer standard for each page
> > to add them to the pages produced by gitweb.
>
> My web site at http://www.chandlerfamily.org.uk/git shows the example of
> this, although the list of projects is null at the moment,
The site is working now, that I have updated the underlying git to 1.4.2
--
Alan Chandler
http://www.chandlerfamily.org.uk
^ permalink raw reply
* [PATCH] gitweb: blame: Minimize vertical table row padding
From: Luben Tuikov @ 2006-10-05 20:30 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
Minimize vertical table row padding for blame only. I
discovered this while having the browser's blame output
right next to my editor's window, only to notice how much
vertically stretched the blame output was.
Blame most likely shows source code and is in this way
more "spartan" than the rest of the tables gitweb shows.
This patch makes the blame table more vertically compact,
thus being closer to what you'd see in your editor's window,
as well as reusing more window estate to show more
information (which in turn minimizes scrolling).
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
gitweb/gitweb.css | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
[-- Attachment #2: 1207600725-p1.txt --]
[-- Type: text/plain, Size: 353 bytes --]
diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
index eb9fc38..668e69a 100644
--- a/gitweb/gitweb.css
+++ b/gitweb/gitweb.css
@@ -173,6 +173,12 @@ table.blame {
border-collapse: collapse;
}
+table.blame td {
+ padding: 0px 5px;
+ font-size: 12px;
+ vertical-align: top;
+}
+
th {
padding: 2px 5px;
font-size: 12px;
--
1.4.2.3.gc45c-dirty
^ permalink raw reply related
* [PATCH] gitweb: Do not print "log" and "shortlog" redundantly in commit view
From: Luben Tuikov @ 2006-10-05 19:22 UTC (permalink / raw)
To: git
[-- Attachment #1: Type: text/plain, Size: 376 bytes --]
Do not print "log" and "shortlog" redundantly in commit
view. This is passed into the $extra argument of
git_print_page_nav from git_commit, but git_print_page_nav
prints "log" and "shortlog" already with the same head.
Noticed by Junio.
Signed-off-by: Luben Tuikov <ltuikov@yahoo.com>
---
gitweb/gitweb.perl | 5 -----
1 files changed, 0 insertions(+), 5 deletions(-)
[-- Attachment #2: 1207600725-p1.txt --]
[-- Type: text/plain, Size: 663 bytes --]
diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
index bfd1405..65f1d82 100755
--- a/gitweb/gitweb.perl
+++ b/gitweb/gitweb.perl
@@ -3014,11 +3014,6 @@ sub git_commit {
$cgi->a({-href => href(action=>"blame", hash_parent=>$parent, file_name=>$file_name)},
"blame");
}
- if (defined $co{'parent'}) {
- push @views_nav,
- $cgi->a({-href => href(action=>"shortlog", hash=>$hash)}, "shortlog"),
- $cgi->a({-href => href(action=>"log", hash=>$hash)}, "log");
- }
git_header_html(undef, $expires);
git_print_page_nav('commit', defined $co{'parent'} ? '' : 'commitdiff',
$hash, $co{'tree'}, $hash,
--
1.4.2.3.g2e575
^ permalink raw reply related
* Re: [PATCH] pack-refs: use lockfile as everybody else does.
From: Linus Torvalds @ 2006-10-05 14:51 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vodsrguej.fsf@assigned-by-dhcp.cox.net>
On Wed, 4 Oct 2006, Junio C Hamano wrote:
>
> How would one ensure the effect of rename(2) hits the disk
> platter before proceeding to do something else? We seem to do
> sync(1) in git-repack.sh for similar reasons, and I wonder if we
> should do a sync(2) there. I doubt it would be worth it though;
> the function can return before the actual writing is done.
sync() is supposed to wait until the data is on the disk, anything else is
likely to be a bad implementation (even if POSIX may not _guarantee_ it).
Also, most filesystems (for various reasons, not the least of which is
"speed of fsck") will journal metadata, but not file contents. Which means
that if a crash happens and one of the loose refs has already been
removed, then (thanks to journaling) that means that on most filesystems
the rename would already have been guaranteed to hit the disk - even
regardless of any sync().
So in practice, it's much more important to guarantee the file contents
(the fsync) part, because the OS already tends to guarantee metadata
ordering.
Linus
^ 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