summaryrefslogtreecommitdiff
path: root/builtin-shortlog.c
Commit message (Collapse)AuthorAgeFilesLines
* Move 'builtin-*' into a 'builtin/' subdirectoryLinus Torvalds2010-02-221-343/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This shrinks the top-level directory a bit, and makes it much more pleasant to use auto-completion on the thing. Instead of [torvalds@nehalem git]$ em buil<tab> Display all 180 possibilities? (y or n) [torvalds@nehalem git]$ em builtin-sh builtin-shortlog.c builtin-show-branch.c builtin-show-ref.c builtin-shortlog.o builtin-show-branch.o builtin-show-ref.o [torvalds@nehalem git]$ em builtin-shor<tab> builtin-shortlog.c builtin-shortlog.o [torvalds@nehalem git]$ em builtin-shortlog.c you get [torvalds@nehalem git]$ em buil<tab> [type] builtin/ builtin.h [torvalds@nehalem git]$ em builtin [auto-completes to] [torvalds@nehalem git]$ em builtin/sh<tab> [type] shortlog.c shortlog.o show-branch.c show-branch.o show-ref.c show-ref.o [torvalds@nehalem git]$ em builtin/sho [auto-completes to] [torvalds@nehalem git]$ em builtin/shor<tab> [type] shortlog.c shortlog.o [torvalds@nehalem git]$ em builtin/shortlog.c which doesn't seem all that different, but not having that annoying break in "Display all 180 possibilities?" is quite a relief. NOTE! If you do this in a clean tree (no object files etc), or using an editor that has auto-completion rules that ignores '*.o' files, you won't see that annoying 'Display all 180 possibilities?' message - it will just show the choices instead. I think bash has some cut-off around 100 choices or something. So the reason I see this is that I'm using an odd editory, and thus don't have the rules to cut down on auto-completion. But you can simulate that by using 'ls' instead, or something similar. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'uk/maint-shortlog-encoding'Junio C Hamano2009-11-301-8/+11
|\ | | | | | | | | Conflicts: builtin-shortlog.c
| * shortlog: respect commit encodingUwe Kleine-König2009-11-251-9/+11
| | | | | | | | | | | | | | | | | | Don't take the author name information without re-encoding from the raw commit object buffer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Refactor pretty_print_commit arguments into a structThomas Rast2009-10-191-3/+6
|/ | | | | | | | | | | | | | | | | pretty_print_commit() has a bunch of rarely-used arguments, and introducing more of them requires yet another update of all the call sites. Refactor most of them into a struct to make future extensions easier. The ones that stay "plain" arguments were chosen on the grounds that all callers put real arguments there, whereas some callers have 0/NULL for all arguments that were factored into the struct. We declare the struct 'const' to ensure none of the callers are bitten by the changed (no longer call-by-value) semantics. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Style fixes, add a space after if/for/while.Brian Gianforcaro2009-08-311-1/+1
| | | | | | | | | The majority of code in core git appears to use a single space after if/for/while. This is an attempt to bring more code to this standard. These are entirely cosmetic changes. Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* parse-opts: prepare for OPT_FILENAMEStephen Boyd2009-05-251-1/+1
| | | | | | | | | | To give OPT_FILENAME the prefix, we pass the prefix to parse_options() which passes the prefix to parse_options_start() which sets the prefix member of parse_opts_ctx accordingly. If there isn't a prefix in the calling context, passing NULL will suffice. Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Remove unused assignmentsBenjamin Kramer2009-03-141-1/+0
| | | | | | | | | | | | | | | | | These variables were always overwritten or the assigned value was unused: builtin-diff-tree.c::cmd_diff_tree(): nr_sha1 builtin-for-each-ref.c::opt_parse_sort(): sort_tail builtin-mailinfo.c::decode_header_bq(): in builtin-shortlog.c::insert_one_record(): len connect.c::git_connect(): path imap-send.c::v_issue_imap_cmd(): n pretty.c::pp_user_info(): filler remote::parse_refspec_internal(): llen Signed-off-by: Benjamin Kramer <benny.kra@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Change current mailmap usage to do matching on both name and email of ↵Marius Storm-Olsen2009-02-081-5/+17
| | | | | | | author/committer. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Add mailmap.file as configurational option for mailmap locationMarius Storm-Olsen2009-02-081-1/+2
| | | | | | | | | | This allows us to augment the repo mailmap file, and to use mailmap files elsewhere than the repository root. Meaning that the entries in mailmap.file will override the entries in "./.mailmap", should they match. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'rs/maint-shortlog-foldline'Junio C Hamano2009-01-171-3/+6
|\ | | | | | | | | * rs/maint-shortlog-foldline: shortlog: handle multi-line subjects like log --pretty=oneline et. al. do
| * shortlog: handle multi-line subjects like log --pretty=oneline et. al. doRené Scharfe2009-01-061-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | The commit message parser of git shortlog used to treat only the first non-empty line of the commit message as the subject. Other log commands (e.g. --pretty=oneline) show the whole first paragraph instead (unwrapped into a single line). For consistency, this patch borrows format_subject() from pretty.c to make shortlog do the same. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | builtin-shortlog.c: use string_list_append(), and don't strdup unnecessarilyAdeodato Simó2009-01-011-16/+3
|/ | | | | | | | | | | | | | | | | Make insert_one_record() use string_list_append(), instead of duplicating its code. Because of this, do not free the "util" member when clearing the "onelines" string lists: with the new code path it is not initialized to any value (was being initialized to NULL previously). Also, avoid unnecessary strdup() calls when inserting names in log->list. This list always has "strdup_strings" activated, hence strdup'ing namebuf is unnecessary. This change also removes a latent memory leak in the old code. NB: The duplicated code mentioned above predated the appearance of string_list_append(). Signed-off-by: Adeodato Simó <dato@net.com.org.es> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Rename path_list to string_listJohannes Schindelin2008-07-211-21/+21
| | | | | | | | | | | | | | | | | | | | | | | The name path_list was correct for the first usage of that data structure, but it really is a general-purpose string list. $ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list) $ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list) $ git mv path-list.h string-list.h $ git mv path-list.c string-list.c $ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path) $ perl -i -pe 's/path/string/g' string-list.[ch] $ git mv Documentation/technical/api-path-list.txt \ Documentation/technical/api-string-list.txt $ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths) ... and then fix all users of string-list to access the member "string" instead of "path". Documentation/technical/api-string-list.txt needed some rewrapping, too. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'sb/dashless'Junio C Hamano2008-07-161-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/test-lib.sh: exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c git-am.sh t/t4150-am.sh t/t4200-rerere.sh
| * Make usage strings dash-lessStephan Beyer2008-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When you misuse a git command, you are shown the usage string. But this is currently shown in the dashed form. So if you just copy what you see, it will not work, when the dashed form is no longer supported. This patch makes git commands show the dash-less version. For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh generates a dash-less usage string now. Signed-off-by: Stephan Beyer <s-beyer@gmx.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | shortlog: support --pretty=format: optionJohannes Schindelin2008-07-151-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With this patch, the user can override the default setting, to print the commit messages using a user format instead of the onelines of the commits. Example: $ git shortlog --pretty='format:%s (%h)' <commit>.. Note that shortlog will only respect a user format setting, as the other formats do not make much sense. Wished for by Andrew Morton. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | revisions: refactor handle_revision_opt into parse_revision_opt.Pierre Habouzit2008-07-091-9/+1
| | | | | | | | | | | | | | | | | | | | | | It seems we're using handle_revision_opt the same way each time, have a wrapper around it that does the 9-liner we copy each time instead. handle_revision_opt can be static in the module for now, it's always possible to make it public again if needed. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-shortlog: migrate to parse-options partially.Pierre Habouzit2008-07-091-58/+77
|/ | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint-1.5.4' into maintJunio C Hamano2008-04-121-1/+1
|\ | | | | | | | | | | | | * maint-1.5.4: Docs gitk: Explicitly mention the files that gitk uses (~/.gitk) Document -w option to shortlog bisect: report bad rev better
| * Document -w option to shortlogJunio C Hamano2008-04-121-1/+1
| | | | | | | | | | | | Noticed by Fredrik Noring. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | shortlog: do not require to run from inside a git repositoryJonas Fonseca2008-03-151-1/+3
| | | | | | | | | | | | | | | | | | Once upon a time shortlog could be run from a non-git directory and still do its job. Fix this regression and add a small test for it. Signed-off-by: Jonas Fonseca <fonseca@diku.dk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge branch 'aw/maint-shortlog-blank-lines'Junio C Hamano2008-03-081-2/+3
|\ \ | |/ | | | | | | * aw/maint-shortlog-blank-lines: shortlog: take the first populated line of the description
| * shortlog: take the first populated line of the descriptionAndy Whitcroft2008-03-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Way back the perl version of shortlog would take the first populated line of the commit body. The builtin version mearly takes the first line. This leads to empty shortlog entries when there is some viable text in the commit. Reinstate this behaviour igoring all lines with nothing but whitespace. This is often useful when dealing with commits imported from foreign SCMs that do not tidy up the log message of useless blank lines at the beginning. Signed-off-by: Andy Whitcroft <apw@shadowen.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Add API access to shortlogDaniel Barkalow2008-02-251-68/+80
|/ | | | | | | | | Shortlog is gives a pretty simple API for cases where you're already identifying all of the individual commits. Make this available to other code instead of requiring them to use the revision API and command line. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org>
* shortlog: mention the "-e" option in the usageJohannes Schindelin2008-01-091-1/+1
| | | | | Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* shortlog: default to HEAD when the standard input is a ttyJunio C Hamano2007-12-111-2/+3
| | | | | | | | | | | | | | Instead of warning the user that it is expecting git log output from the standard input (and waiting for the user to type the log from the keyboard, which is a silly thing to do), default to traverse from HEAD when there is no rev parameter given and the standard input is a tty. This factors out a useful helper "add_head()" from builtin-diff.c to a more appropriate place revision.c while renaming it to more descriptive name add_head_to_pending(), as that is what the function is about. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Invert numbers and names in the git-shortlog summary mode.Pierre Habouzit2007-12-111-1/+1
| | | | | | | Also make it `cut` friendly using a tab to separate the numbers and names. Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* git-shortlog -e: show e-mail address as wellJunio C Hamano2007-12-081-0/+12
| | | | | | This option shows the author's email address next to the name. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* shortlog: code restructuring and clean-upJunio C Hamano2007-12-081-103/+62
| | | | | | | | | | | The code tried to parse and clean-up the author name and the one line information in three places (two callers of insert_author_oneline() and the called function itself), which was a mess. This renames the callee to insert_one_record() and make it responsible for cleaning up the author name and one line information. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Use xmemdupz() in many places.Pierre Habouzit2007-09-181-9/+2
| | | | | Signed-off-by: Pierre Habouzit <madcoder@debian.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* War on whitespaceJunio C Hamano2007-06-071-1/+0
| | | | | | | | | This uses "git-apply --whitespace=strip" to fix whitespace errors that have crept in to our source files over time. There are a few files that need to have trailing whitespaces (most notably, test vectors). The results still passes the test, and build result in Documentation/ area is unchanged. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Remove pointless calls to access(2) when checking for .mailmapAlex Riesen2007-04-301-2/+1
| | | | | | | | | | read_mailmap already returns not 0 in case of error, and nothing seem to be interested in it. It also is silent about the fact (read_mailmap being to chatty would justify the call to access, but there is no point for it to be and it isn't). Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Split out mailmap handling out of shortlogJunio C Hamano2007-04-291-80/+4
| | | | | | | | This splits out a few functions to deal with mailmap from shortlog and makes it a bit more usable from other programs. Most notably, it does not clobber input e-mail address anymore. Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog -w: make wrap-line behaviour optional.Junio C Hamano2007-04-101-4/+66
| | | | Signed-off-by: Junio C Hamano <junkio@cox.net>
* Use print_wrapped_text() in shortlogJohannes Schindelin2007-04-101-3/+8
| | | | | | | | | | | Some oneline descriptions are just too long. In shortlog, it looks much nicer when they are wrapped. Since print_wrapped_text() is UTF-8 aware, it also works with those descriptions. [jc: with minimum fixes] Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: prompt when reading from terminal by mistakeJunio C Hamano2007-03-141-1/+4
| | | | | | | | | | | | | | | | | I was trying to see who have been active recently to find GSoC mentor candidates by running: $ git shortlog -s -n --since=4.months | head -n 20 After waiting for about 20 seconds, I started getting worried, thinking that the recent revision traversal updates might have had an unintended side effect. Not so. "git shortlog" acts as a filter when no revs are given, unlike "git log" which defaults to HEAD. It was reading from its standard input. Signed-off-by: Junio C Hamano <junkio@cox.net>
* General const correctness fixesShawn O. Pearce2007-03-071-2/+2
| | | | | | | | | | | | | | | | We shouldn't attempt to assign constant strings into char*, as the string is not writable at runtime. Likewise we should always be treating unsigned values as unsigned values, not as signed values. Most of these are very straightforward. The only exception is the (unnecessary) xstrdup/free in builtin-branch.c for the detached head case. Since this is a user-level interactive type program and that particular code path is executed no more than once, I feel that the extra xstrdup call is well worth the easy elimination of this warning. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
* Mechanical conversion to use prefixcmp()Junio C Hamano2007-02-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This mechanically converts strncmp() to use prefixcmp(), but only when the parameters match specific patterns, so that they can be verified easily. Leftover from this will be fixed in a separate step, including idiotic conversions like if (!strncmp("foo", arg, 3)) => if (!(-prefixcmp(arg, "foo"))) This was done by using this script in px.perl #!/usr/bin/perl -i.bak -p if (/strncmp\(([^,]+), "([^\\"]*)", (\d+)\)/ && (length($2) == $3)) { s|strncmp\(([^,]+), "([^\\"]*)", (\d+)\)|prefixcmp($1, "$2")|; } if (/strncmp\("([^\\"]*)", ([^,]+), (\d+)\)/ && (length($1) == $3)) { s|strncmp\("([^\\"]*)", ([^,]+), (\d+)\)|(-prefixcmp($2, "$1"))|; } and running: $ git grep -l strncmp -- '*.c' | xargs perl px.perl Signed-off-by: Junio C Hamano <junkio@cox.net>
* simplify inclusion of system header files.Junio C Hamano2006-12-201-1/+0
| | | | | | | | | | | | | | | | | | | | This is a mechanical clean-up of the way *.c files include system header files. (1) sources under compat/, platform sha-1 implementations, and xdelta code are exempt from the following rules; (2) the first #include must be "git-compat-util.h" or one of our own header file that includes it first (e.g. config.h, builtin.h, pkt-line.h); (3) system headers that are included in "git-compat-util.h" need not be included in individual C source files. (4) "git-compat-util.h" does not have to include subsystem specific header files (e.g. expat.h). Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: fix segfault on empty authornameJunio C Hamano2006-12-111-1/+2
| | | | | | | | | | | | | | | The old code looked backwards from the email address to parse the name, allowing an arbitrary number of spaces between the two. However, in the case of no name, we looked back too far to the 'author' (or 'Author:') header. The bug was triggered by commit febf7ea4bed from linux-2.6. Jeff King originally fixed it by looking back only one character; Johannes Schindelin pointed out that we could try harder while at it to cope with commits with broken headers. Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: remove "[PATCH]" prefix from shortlog outputJunio C Hamano2006-12-111-2/+8
| | | | | | | | | Originally noticed by Nicolas Pitre; the real cause was the code was prepared to deal with [PATCH] (and [PATCH n/m whatever]) prefixes but forgot that the string can be indented while acting as a filter. Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: fix segfault on empty authornameJeff King2006-12-081-2/+2
| | | | | | | | | | | | The old code looked backwards from the email address to parse the name, allowing an arbitrary number of spaces between the two. However, in the case of no name, we looked back too far to the 'author' (or 'Author:') header. Instead, remove at most one space between name and address. The bug was triggered by commit febf7ea4bed from linux-2.6. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: remove range checkRené Scharfe2006-11-281-3/+1
| | | | | | | | | | Don't force the user to specify more than one revision parameter, thus making git-shortlog behave more like git-log. 'git-shortlog master' will now produce the expected results; the other end of the range simply is the (oldest) root commit. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-shortlog: make common repository prefix configurable with .mailmapJunio C Hamano2006-11-251-2/+22
| | | | | | | | | | | | | | The code had "/pub/scm/linux/kernel/git/" hardcoded which was too specific to the kernel project. With this, a line in the .mailmap file: # repo-abbrev: /pub/scm/linux/kernel/git/ can be used to cause the substring to be abbreviated to /.../ on the title line of the commit message. Signed-off-by: Junio C Hamano <junkio@cox.net>
* git-shortlog: fix common repository prefix abbreviation.Junio C Hamano2006-11-251-4/+9
| | | | | | | The code to abbreviate the common repository prefix was totally borked. Signed-off-by: Junio C Hamano <junkio@cox.net>
* builtin git-shortlog is brokenNicolas Pitre2006-11-211-3/+5
| | | | | | | | | Another small patch to fix the output result to be conform with the perl version. Signed-off-by: Nicolas Pitre <nico@cam.org> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: fix "-n"Johannes Schindelin2006-11-211-6/+9
| | | | | | | | | Since it is now a builtin optionally taking a range, we have to parse the options before the rev machinery, to be able to shadow the short hand "-n" for "--max-count". Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: handle email addresses case-insensitivelyJohannes Schindelin2006-11-191-1/+7
| | | | | Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: read mailmap from ./.mailmap againJohannes Schindelin2006-11-191-42/+39
| | | | | | | | While at it, remove the linux specific mailmap into contrib/mailmap.linux. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
* shortlog: do not crash on parsing "[PATCH"Johannes Schindelin2006-11-191-7/+9
| | | | | | | | Annoyingly, it looked for the closing bracket in the author name instead of in the message, and then accessed the NULL pointer. Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <junkio@cox.net>