summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-08-06blame: inline one-line function into its lone callerEric Sunshine
As of 25ed3412 (Refactor parse_loc; 2013-03-28), blame.c:prepare_blame_range() became effectively a one-line function which merely passes its arguments along to another function. This indirection does not bring clarity to the code. Simplify by inlining prepare_blame_range() into its lone caller. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-06range-set: publish API for re-use by git-blame -LEric Sunshine
git-blame is slated to accept multiple -L ranges. git-log already accepts multiple -L's but its implementation of range-set, which organizes and normalizes -L ranges, is private. Publish the small subset of range-set API which is needed for git-blame multiple -L support. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-06line-range-format.txt: clarify -L:regex usage formEric Sunshine
blame/log documentation describes -L option as: -L<start>,<end> -L:<regex> <start> and <end> can take one of these forms: * number * /regex/ * +offset or -offset * :regex which is incorrect and confusing since :regex is not one of the valid forms of <start> or <end>; in fact, it must be -L's lone argument. Clarify by discussing :<regex> at the same indentation level as "<start> and <end>...": -L<start>,<end> -L:<regex> <start> and <end> can take one of these forms: * number * /regex/ * +offset or -offset If :<regex> is given in place of <start> and <end> ... Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-06git-log.txt: place each -L option variation on its own lineEric Sunshine
Standard practice in Git documentation is for each variation of an option (such as: -p / --porcelain) to be placed on its own line in the OPTIONS table. The -L option does not follow suit. It cuddles "-L <start>,<end>:<file>" and "-L :<regex>:<file>", separated by a comma. This is inconsistent and potentially confusing since the comma separating them is typeset the same as the comma in "<start>,<end>". Fix this by placing each variation on its own line. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05blame: reject empty ranges -L,+0 and -L,-0Eric Sunshine
Empty ranges -L,+0 and -L,-0 are nonsensical in the context of blame yet they are accepted (in fact, both are interpreted as -L1,Y where Y is end-of-file). Report them as invalid. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t8001/t8002: blame: demonstrate acceptance of bogus -L,+0 and -L,-0Eric Sunshine
Empty ranges -L,+0 and -L,-0 are nonsensical in the context of blame yet they are accepted. They should be errors. Demonstrate this shortcoming. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05blame: reject empty ranges -LX,+0 and -LX,-0Eric Sunshine
Empty ranges -LX,+0 and -LX,-0 are nonsensical in the context of blame yet they are accepted (in fact, both are interpreted as -LX,+2). Report them as invalid. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t8001/t8002: blame: demonstrate acceptance of bogus -LX,+0 and -LX,-0Eric Sunshine
Empty ranges -LX,+0 and -LX,-0 are nonsensical in the context of blame yet they are accepted. They should be errors. Demonstrate this shortcoming. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05log: fix -L bounds checking bugEric Sunshine
When 12da1d1f added -L support to git-log, a broken bounds check was copied from git-blame -L which incorrectly allows -LX to extend one line past end of file without reporting an error. Instead, it generates an empty range. Fix this bug. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t4211: retire soon-to-be unimplementable testsEric Sunshine
58960978 and 99780b0a added tests which demonstrated bugs (crashes) in range-set and line-log when handed empty ranges specified via "log -LX:file" where X is one greater than the last line of the file. After these tests were added, it was realized that the ability to specify an empty range is a loophole due to a bug in -L bounds checking. That bug is slated to be fixed in a subsequent patch. Unfortunately, the closure of this loophole makes it impossible to continue checking range-set and line-log behavior with regard to empty ranges since there is no other way to specify empty ranges via the command-line. APIs of both facilities are private (file static) so there likewise is no way to test their behaviors programmatically. Consequently, retire these two tests. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t4211: log: demonstrate -L bounds checking bugEric Sunshine
A bounds checking bug allows the X in -LX to extend one line past the end of file. For example, given a file with 5 lines, -L6 is accepted as valid. Demonstrate this problem. While here, also add tests to check that the remaining cases of X and Y in -LX,Y are handled correctly at and in the vicinity of end-of-file. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05blame: fix -L bounds checking bugEric Sunshine
Since inception, -LX,Y has correctly reported an out-of-range error when Y is beyond end of file, however, X was not checked, and an out-of-range X would cause a crash. 92f9e273 (blame: prevent a segv when -L given start > EOF; 2010-02-08) attempted to rectify this shortcoming but has its own off-by-one error which allows X to extend one line past end of file. For example, given a file with 5 lines: git blame -L5 foo # OK, blames line 5 git blame -L6 foo # accepted, no error, no output, huh? git blame -L7 foo # error "fatal: file foo has only 5 lines" Fix this bug. In order to avoid regressing "blame foo" when foo is an empty file, the fix is slightly more complicated than changing '<' to '<='. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t8001/t8002: blame: add empty file & partial-line testsEric Sunshine
Add boundary case tests, with and without -L, for empty file; file with one partial line; file with one full line. The empty file test without -L is of particular interest. Historically, this case has been supported (empty blame output) and this test protects against regression by a subsequent patch fixing an off-by-one bug which incorrectly accepts -LX where X is one past end-of-file. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t8001/t8002: blame: demonstrate -L bounds checking bugEric Sunshine
A bounds checking bug allows the X in -LX to extend one line past the end of file. For example, given a file with 5 lines, -L6 is accepted as valid. Demonstrate this problem. While here, also add tests to check that the remaining cases of X and Y in -LX,Y are handled correctly at and in the vicinity of end-of-file. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t8001/t8002: blame: decompose overly-large testEric Sunshine
Checking all bogus -L syntax forms in a single test makes it difficult to identify the offender when one case fails. Decompose this conglomerate test in order to check each bad syntax case separately. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05Merge branch 'es/blame-L-breakage'Junio C Hamano
* es/blame-L-breakage: t8001, t8002: fix "blame -L :literal" test on NetBSD
2013-08-05t8001, t8002: fix "blame -L :literal" test on NetBSDRené Scharfe
Sub-test 42 of t8001 and t8002 ("blame -L :literal") fails on NetBSD with the following verbose output: git annotate -L:main hello.c Author F (expected 4, attributed 3) bad Author G (expected 1, attributed 1) good This is not caused by different behaviour of git blame or annotate on that platform, but by different test input, in turn caused by a sed command that forgets to add a newline on NetBSD. Here's the diff of the commit that adds "goodbye" to hello.c, for Linux: @@ -1,4 +1,5 @@ int main(int argc, const char *argv[]) { puts("hello"); + puts("goodbye"); } We see that it adds an extra TAB, but that's not a problem. Here's the same on NetBSD: @@ -1,4 +1,4 @@ int main(int argc, const char *argv[]) { puts("hello"); -} + puts("goodbye");} It also adds an extra TAB, but it is missing the newline character after the semicolon. The following patch gets rid of the extra TAB at the beginning, but more importantly adds the missing newline at the end in a (hopefully) portable way, mentioned in http://sed.sourceforge.net/sedfaq4.html. The diff becomes this, on both Linux and NetBSD: @@ -1,4 +1,5 @@ int main(int argc, const char *argv[]) { puts("hello"); + puts("goodbye"); } Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05Merge git://github.com/git-l10n/git-poJunio C Hamano
* git://github.com/git-l10n/git-po: l10n: zh_CN.po: translate 99 messages (2133t0f0u) l10n: vi.po (2133t) l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)
2013-08-05Merge branch 'sb/mailmap-updates'Junio C Hamano
* sb/mailmap-updates: .mailmap: Multiple addresses of Michael S. Tsirkin
2013-08-05Merge branch 'dn/test-reject-utf-16'Junio C Hamano
* dn/test-reject-utf-16: t3900: test rejecting log message with NULs correctly Add missing test file for UTF-16.
2013-08-05Merge branch 'bc/commit-invalid-utf8'Junio C Hamano
* bc/commit-invalid-utf8: commit: typofix for xxFFF[EF] check
2013-08-05commit: typofix for xxFFF[EF] checkJunio C Hamano
We wanted to catch all codepoints that ends with FFFE and FFFF, not with 0FFFE and 0FFFF. Noticed and corrected by Peter Krefting. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05t3900: test rejecting log message with NULs correctlyJunio C Hamano
It is not like that our longer term desire is to someday start accept log messages with NULs in them, so it is wrong to mark a test that demonstrates "git commit" that correctly fails given such an input as "expect-failure". "git commit" should fail today, and it should fail the same way in the future given a message with NUL in it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05Add missing test file for UTF-16.Brian M. Carlson
The test file that the UTF-16 rejection test looks for is missing, but this went unnoticed because the test is expected to fail anyway; as a consequence, the test fails because the file containing the commit message is missing, and not because the test file contains a NUL byte. Fix this by including a sample text file containing a commit message encoded in UTF-16. Signed-off-by: Brian M. Carlson <sandals@crustytoothpaste.net> Tested-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-05.mailmap: Multiple addresses of Michael S. TsirkinStefan Beller
Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Stefan Beller <stefanbeller@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-03l10n: zh_CN.po: translate 99 messages (2133t0f0u)Jiang Xin
Translate 99 new messages came from git.pot update in 28b3cff (l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)). Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2013-08-02Merge branch 'rj/cygwin-clarify-use-of-cheating-lstat'Junio C Hamano
Cygwin port added a "not quite correct but a lot faster and good enough for many lstat() calls that are only used to see if the working tree entity matches the index entry" lstat() emulation some time ago, and it started biting us in places. This removes it and uses the standard lstat() that comes with Cygwin. Recent topic that uses lstat on packed-refs file is broken when this cheating lstat is used, and this is a simplest fix that is also the cleanest direction to go in the long run. * rj/cygwin-clarify-use-of-cheating-lstat: cygwin: Remove the Win32 l/stat() implementation
2013-08-02Merge branch 'jk/cat-file-batch-optim'Junio C Hamano
* jk/cat-file-batch-optim: Revert "cat-file: split --batch input lines on whitespace"
2013-08-02Revert "cat-file: split --batch input lines on whitespace"Junio C Hamano
This reverts commit c334b87b30c1464a1ab563fe1fb8de5eaf0e5bac; the update assumed that people only used the command to read from "rev-list --objects" output, whose lines begin with a 40-hex object name followed by a whitespace, but it turns out that scripts feed random extended SHA-1 expressions (e.g. "HEAD:$pathname") in which a whitespace has to be kept.
2013-08-01Git 1.8.4-rc1v1.8.4-rc1Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-01Merge branch 'ob/typofixes'Junio C Hamano
* ob/typofixes: many small typofixes
2013-08-01Merge branch 'ms/subtree-install-fix'Junio C Hamano
* ms/subtree-install-fix: contrib/subtree: Fix make install target
2013-08-01Merge branch 'jc/rm-submodule-error-message'Junio C Hamano
Consolidate two messages phrased subtly differently without a good reason. * jc/rm-submodule-error-message: builtin/rm.c: consolidate error reporting for removing submodules
2013-08-01Merge branch 'lf/echo-n-is-not-portable'Junio C Hamano
* lf/echo-n-is-not-portable: Avoid using `echo -n` anywhere
2013-08-01Merge branch 'ma/hg-to-git'Junio C Hamano
* ma/hg-to-git: hg-to-git: --allow-empty-message in git commit
2013-08-01Merge branch 'jx/clean-interactive'Junio C Hamano
* jx/clean-interactive: git-clean: implement partial matching for selection Documentation/git-clean: fix description for range
2013-07-31Rename advice.object_name_warning to objectNameWarningThomas Rast
We spell config variables in camelCase instead of with_underscores. Signed-off-by: Thomas Rast <trast@inf.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-31Merge branch 'rr/rebase-autostash'Junio C Hamano
* rr/rebase-autostash: git-rebase: fix typo
2013-07-31Merge branch 'rj/commit-slab-fix'Junio C Hamano
* rj/commit-slab-fix: commit-slab.h: Fix memory allocation and addressing
2013-07-31Merge branch 'jk/commit-how-to-abort-cherry-pick'Junio C Hamano
* jk/commit-how-to-abort-cherry-pick: commit: tweak empty cherry pick advice for sequencer
2013-07-31Merge branch 'ds/doc-two-kinds-of-tags'Junio C Hamano
* ds/doc-two-kinds-of-tags: docs/git-tag: explain lightweight versus annotated tags
2013-07-31Merge branch 'rr/maint-tilde-markup-in-doc'Junio C Hamano
* rr/maint-tilde-markup-in-doc: config doc: quote paths, fixing tilde-interpretation
2013-07-31Merge branch 'mh/packed-refs-do-one-ref-recursion'Junio C Hamano
Fix a NULL-pointer dereference during nested iterations over references (for example, when replace references are being used). * mh/packed-refs-do-one-ref-recursion: do_one_ref(): save and restore value of current_ref
2013-07-30Merge branch 'jk/capabilities-doc'Junio C Hamano
* jk/capabilities-doc: document 'allow-tip-sha1-in-want' capability document 'quiet' receive-pack capability document 'agent' protocol capability docs: note that receive-pack knows side-band-64k capability docs: fix 'report-status' protocol capability thinko
2013-07-30Merge branch 'sb/mailmap-updates'Junio C Hamano
* sb/mailmap-updates: .mailmap: combine more (email, name) to individual persons
2013-07-30Merge branch 'bc/completion-for-bash-3.0'Junio C Hamano
* bc/completion-for-bash-3.0: git-completion.bash: replace zsh notation that breaks bash 3.X
2013-07-30contrib/subtree: Fix make install targetMichal Sojka
If the libexec directory doesn't exist, git-subtree gets installed as $prefix/share/libexec/git-core file. This patch creates the directory before installing git-subtree file into it. Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-29many small typofixesOndřej Bílka
Signed-off-by: Ondřej Bílka <neleai@seznam.cz> Reviewed-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-29git-rebase: fix typoRalf Thielow
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-29Avoid using `echo -n` anywhereLukas Fleischer
`echo -n` is non-portable. The POSIX specification says: Conforming applications that wish to do prompting without <newline> characters or that could possibly be expecting to echo a -n, should use the printf utility derived from the Ninth Edition system. Since all of the affected shell scripts use a POSIX shell shebang, replace `echo -n` invocations with printf. Signed-off-by: Lukas Fleischer <git@cryptocrack.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>