Commit graph

22 commits

Author SHA1 Message Date
Junio C Hamano 8675779454 Merge branch 'jc/shortlog-ref-exclude' into maint
"git log --exclude=<glob> --all | git shortlog" worked as expected,
but "git shortlog --exclude=<glob> --all", which is supposed to be
identical to the above pipeline, was not accepted at the command
line argument parser level.

* jc/shortlog-ref-exclude:
  shortlog: allow --exclude=<glob> to be passed
2014-06-25 11:49:11 -07:00
Junio C Hamano eb077745a4 shortlog: allow --exclude=<glob> to be passed
These two commands are supposed to be equivalent:

  $ git log --exclude=refs/notes/\* --all --no-merges --since=2.days |
    git shortlog
  $ git shortlog --exclude=refs/notes/\* --all --no-merges --since=2.days

However, the latter does not understand the ref-exclusion command
line option, even though other options understood by "log", such as
"--all" and "--no-merges", are understood.

This was because e7b432c5 (revision: introduce --exclude=<glob> to
tame wildcards, 2013-08-30) did not wire the new option fully to the
machinery.  A new option understood by handle_revision_pseudo_opt()
must be told to handle_revision_opt() as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-06-04 13:41:33 -07:00
Jeff King cd4f09e383 shortlog: ignore commits with missing authors
Most of git's traversals are robust against minor breakages
in commit data. For example, "git log" will still output an
entry for a commit that has a broken encoding or missing
author, and will not abort the whole operation.

Shortlog, on the other hand, will die as soon as it sees a
commit without an author, meaning that a repository with
a broken commit cannot get any shortlog output at all.

Let's downgrade this fatal error to a warning, and continue
the operation.

We simply ignore the commit and do not count it in the total
(since we do not have any author under which to file it).
Alternatively, we could output some kind of "<empty>" record
to collect these bogus commits. It is probably not worth it,
though; we have already warned to stderr, so the user is
aware that such bogosities exist, and any placeholder we
came up with would either be syntactically invalid, or would
potentially conflict with real data.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-09-18 14:41:19 -07:00
Steffen Prohaska 5b59708268 shortlog: fix wrapping lines of wraplen
A recent commit [1] fixed a off-by-one wrapping error.  As a
side-effect, the conditional in add_wrapped_shortlog_msg() to decide
whether to append a newline needs to be removed.  The function
should always append a newline, which was the case before the
off-by-one fix, because strbuf_add_wrapped_text() never returns a
value of wraplen; when it returns wraplen, the string does not end
with a newline, so this caller needs to add one anyway.

[1] 14e1a4e1ff utf8: fix off-by-one
    wrapping of text

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-11 10:01:44 -08:00
Jonathan Nieder a48fcd8369 tests: add missing &&
Breaks in a test assertion's && chain can potentially hide
failures from earlier commands in the chain.

Commands intended to fail should be marked with !, test_must_fail, or
test_might_fail.  The examples in this patch do not require that.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09 11:59:49 -08:00
Will Palmer c197702156 pretty: Respect --abbrev option
Prior to this, the output of git log -1 --format=%h was always 7
characters long, without regard to whether --abbrev had been passed.

Signed-off-by: Will Palmer <wmpalmer@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:38:58 -07:00
Jonathan Nieder 600372497c shortlog: Document and test --format option
Do not document the --pretty synonym, since it takes too long to
explain the name to people.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:30:59 -07:00
Jonathan Nieder ed715b5e39 t4201 (shortlog): Test output format with multiple authors
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:29:56 -07:00
Jonathan Nieder ae00dc191a t4201 (shortlog): guard setup with test_expect_success
Follow the current prevailing style.  This also has the benefit of
capturing any stray output and noticing if any of the setup commands
start failing.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-05-04 15:29:54 -07:00
Brandon Casey 3994e8a98d t4201: use ISO8859-1 rather than ISO-8859-1
Some ancient platforms do not have an extensive list of alternate names for
character encodings.  For example, Solaris 7 and IRIX 6.5 do not know that
ISO-8859-1 is the same as ISO8859-1.  Modern platforms do know this, so use
the older name.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-12-03 10:06:13 -08:00
Uwe Kleine-König 79f7ca063d shortlog: respect commit encoding
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>
2009-11-25 15:36:54 -08:00
Junio C Hamano 1f9ff0de82 Redo "add test_cmp function for test scripts"
We had a handful test updates since we accepted 82ebb0b (add test_cmp
function for test scripts).  This fixes them up.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-15 01:23:26 -07:00
Junio C Hamano 1f17868b30 Merge branch 'jk/portable'
* jk/portable:
  t6000lib: re-fix tr portability
  t7505: use SHELL_PATH in hook
  t9112: add missing #!/bin/sh header
  filter-branch: use $SHELL_PATH instead of 'sh'
  filter-branch: don't use xargs -0
  add NO_EXTERNAL_GREP build option
  t6000lib: tr portability fix
  t4020: don't use grep -a
  add test_cmp function for test scripts
  remove use of "tail -n 1" and "tail -1"
  grep portability fix: don't use "-e" or "-q"
  more tr portability test script fixes
  t0050: perl portability fix
  tr portability fixes
2008-03-15 01:10:53 -07:00
Jonas Fonseca abe549e179 shortlog: do not require to run from inside a git repository
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>
2008-03-15 00:49:15 -07:00
Jeff King 82ebb0b6ec add test_cmp function for test scripts
Many scripts compare actual and expected output using
"diff -u". This is nicer than "cmp" because the output shows
how the two differ. However, not all versions of diff
understand -u, leading to unnecessary test failure.

This adds a test_cmp function to the test scripts and
switches all "diff -u" invocations to use it. The function
uses the contents of "$GIT_TEST_CMP" to compare its
arguments; the default is "diff -u".

On systems with a less-capable diff, you can do:

  GIT_TEST_CMP=cmp make test

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-03-13 00:57:52 -07:00
Junio C Hamano 5c66d0d458 Officially deprecate repo-config.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-17 22:52:40 -08:00
Junio C Hamano 5be60078c9 Rewrite "git-frotz" to "git frotz"
This uses the remove-dashes target to replace "git-frotz" to "git frotz".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-07-02 22:52:14 -07:00
Johannes Schindelin 557b1e0da5 t4201: Do not display weird characters on the terminal
Now that git-commit got chatty, we have to shut it up again.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-23 21:45:22 -07:00
Alex Riesen 4848509a97 Fix permissions on test scripts
Make every test executable. Remove exec-attribute from included shell files,
they can't used standalone anyway.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 16:53:09 -07:00
Alex Riesen 238128d888 Fix t4201: accidental arithmetic expansion
instead of embedded subshell. It actually breaks here (dash as /bin/sh):

t4201-shortlog.sh: 27: Syntax error: Missing '))'
FATAL: Unexpected exit with code 2

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-16 16:52:55 -07:00
Junio C Hamano 3d711d97a0 shortlog -w: make wrap-line behaviour optional.
Signed-off-by: Junio C Hamano <junkio@cox.net>
2007-04-10 12:48:35 -07:00
Johannes Schindelin 3714e7c895 Use print_wrapped_text() in shortlog
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>
2007-04-10 12:48:35 -07:00