summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* grep: add option -p/--show-functionRené Scharfe2009-07-015-13/+98
| | | | | | | | | | | | | The new option -p instructs git grep to print the previous function definition as a context line, similar to diff -p. Such context lines are marked with an equal sign instead of a dash. This option complements the existing context options -A, -B, -C. Function definitions are detected using the same heuristic that diff uses. User defined regular expressions are not supported, yet. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* grep: handle pre context lines on demandRené Scharfe2009-07-011-29/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor out pre context line handling into the new function show_pre_context() and change the algorithm to rewind by looking for newline characters and roll forward again, instead of maintaining an array of line beginnings and ends. This is slower for hits, but the cost for non-matching lines becomes zero. Normally, there are far more non-matching lines, so the time spent in total decreases. Before this patch (current Linux kernel repo, best of five runs): $ time git grep --no-ext-grep -B1 memset >/dev/null real 0m2.134s user 0m1.932s sys 0m0.196s $ time git grep --no-ext-grep -B1000 memset >/dev/null real 0m12.059s user 0m11.837s sys 0m0.224s The same with this patch: $ time git grep --no-ext-grep -B1 memset >/dev/null real 0m2.117s user 0m1.892s sys 0m0.228s $ time git grep --no-ext-grep -B1000 memset >/dev/null real 0m2.986s user 0m2.696s sys 0m0.288s Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* grep: print context hunk marks between filesRené Scharfe2009-07-014-1/+40
| | | | | | | | | | | Print a hunk mark before matches from a new file are shown, in addition to the current behaviour of printing them if lines have been skipped. The result is easier to read, as (presumably unrelated) matches from different files are separated by a hunk mark. GNU grep does the same. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* grep: move context hunk mark handling into show_line()René Scharfe2009-07-012-15/+12
| | | | | | | | | Move last_shown into struct grep_opt, to make it available in show_line(), and then make the function handle the printing of hunk marks for context lines in a central place. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* userdiff: add xdiff_clear_find_func()René Scharfe2009-07-013-0/+17
| | | | | | | | | | | | xdiff_set_find_func() is used to set user defined regular expressions for finding function signatures. Add xdiff_clear_find_func(), which frees the memory allocated by the former, making the API complete. Also, use the new function in diff.c (the only call site of xdiff_set_find_func()) to clean up after ourselves. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge branch 'maint'Junio C Hamano2009-06-306-17/+21
|\ | | | | | | | | | | | | | | | | * maint: attr: plug minor memory leak request-pull: really disable pager Makes some cleanup/review in gittutorial Makefile: git.o depends on library headers git-submodule documentation: fix foreach example
| * attr: plug minor memory leakRené Scharfe2009-06-301-0/+2
| | | | | | | | | | | | | | Free the memory allocated for struct strbuf pathbuf when we're done. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * request-pull: really disable pagerJunio C Hamano2009-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | ff06c74 (Improve request-pull to handle non-rebased branches, 2007-05-01) attempted to disable pager when running subcommands in this script, but with a wrong variable. If GIT_PAGER is set, it takes precedence over PAGER. Noticed by Michal Marek. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Makes some cleanup/review in gittutorialThadeu Lima de Souza Cascardo2009-06-301-12/+12
| | | | | | | | | | | | | | | | | | | | There are some different but little cleanup changes to fix some missing quotes, to fix what seemed to be an unended sentence, to reident a little paragraph with too large a sentence and fix a branch name that was referred to twice later by another name. Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Makefile: git.o depends on library headersJohannes Sixt2009-06-301-1/+1
| | | | | | | | | | | | | | This dependency was not yet specified anywhere else. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * git-submodule documentation: fix foreach exampleMiklos Vajna2009-06-302-2/+4
| | | | | | | | | | | | | | | | Backtick and apostrophe are asciidoc markup, so they should be escaped in order to get the expected result in the rendered manual page. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git.c: avoid allocating one-too-many elements for new argv arrayBrandon Casey2009-06-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating a new argv array from a configured alias and the supplied command line arguments, the new argv was allocated with one element too many. Since the first element of the original argv array is skipped when copying it to the new_argv, the number of elements that are allocated should be reduced by one. 'count' is the number of elements that new_argv contains, and *argcp is the number of elements in the original argv array. So the total allocation (including the terminating NULL entry) for the new_argv array should be: count + (*argcp - 1) + 1 Also, the explicit assignment of the NULL terminating entry can be avoided by just copying it over from the original argv array. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git-mv: fix directory separator treatment on WindowsJohannes Sixt2009-06-301-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following invocations did not work as expected on Windows: git mv foo\bar dest git mv foo\ dest The first command was interpreted as git mv foo/bar dest/foo/bar because the Windows style directory separator was not obeyed when the basename of 'foo\bar' was computed. The second command failed because the Windows style directory separator was not removed from the source directory, whereupon the lookup of the directory in the index failed. This fixes both issues by using is_dir_sep() and basename(). Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | completion: add missing config variablesStephen Boyd2009-06-301-2/+3
| | | | | | | | | | | | | | | | Update to include branch.*.rebase, remote.*.pushurl, and add.ignore-errors Signed-off-by: Stephen Boyd <bebarino@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | git log: add '--merges' flag to match '--no-merges'Linus Torvalds2009-06-292-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I do various statistics on git, and one of the things I look at is merges, because they are often interesting events to count ("how many merges vs how much 'real development'" kind of statistics). And you can do it with some fairly straightforward scripting, ie git rev-list --parents HEAD | grep ' .* ' | git diff-tree --always -s --pretty=oneline --stdin | less -S will do it. But I finally got irritated with the fact that we can skip merges with '--no-merges', but we can't do the trivial reverse operation. So this just adds a '--merges' flag that _only_ shows merges. Now you can do the above with just a git log --merges --pretty=oneline which is a lot simpler. It also means that we automatically get a lot of statistics for free, eg git shortlog -ns --merges does exactly what you'd want it to do. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | Merge git://git.bogomips.org/git-svnJunio C Hamano2009-06-275-42/+446
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * git://git.bogomips.org/git-svn: git svn: Doc update for multiple branch and tag paths git svn: cleanup t9138-multiple-branches git-svn: Canonicalize svn urls to prevent libsvn assertion t9138: remove stray dot in test which broke bash git-svn: convert globs to regexps for branch destinations git svn: Support multiple branch and tag paths in the svn repository. Add 'git svn reset' to unwind 'git svn fetch' git-svn: speed up find_rev_before Add 'git svn help [cmd]' which works outside a repo. git-svn: let 'dcommit $rev' work on $rev instead of HEAD
| * | git svn: Doc update for multiple branch and tag pathsMarc Branchaud2009-06-271-9/+35
| | | | | | | | | | | | | | | Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | git svn: cleanup t9138-multiple-branchesMarc Branchaud2009-06-271-57/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using the "svn_cmd" wrapper instead of "svn" alone allows tests to run consistently for users with customized ~/.subversion/configs. Additionally, using subshells via "(cd ...)" allow cleaner and less error-prone tests to be written. [ew: expanded commit message] Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | git-svn: Canonicalize svn urls to prevent libsvn assertionUlrich Dangel2009-06-261-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cloning/initializing svn repositories with an uncanonicalize url does not work as libsvn throws an assertion. This patch canonicalize svn uris for the clone and init command from git-svn. [ew: fixed trailing whitespace] Signed-off-by: Ulrich Dangel <uli@spamt.net> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | t9138: remove stray dot in test which broke bashEric Wong2009-06-261-1/+0
| | | | | | | | | | | | | | | | | | | | | The stray dot broke bash and probably some other shells, but worked fine with dash in my limited testing. Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * | git-svn: convert globs to regexps for branch destinationsEric Wong2009-06-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Marc Branchaud wrote: > I'm fairly happy with this, except for the way the branch > subcommand matches refspecs. The patch does a simple string > comparison, but it'd be better to do an actual glob. I just > couldn't track down the right function for that, so I left it as > a strcmp and hope that a gitizen can tell me how to glob here. Signed-off-by: Eric Wong <normalperson@yhbt.net>
| * | git svn: Support multiple branch and tag paths in the svn repository.Marc Branchaud2009-06-252-22/+170
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables git-svn.perl to read multiple 'branches' and 'tags' entries in svn-remote config sections. The init and clone subcommands also support multiple --branches and --tags arguments. The branch (and tag) subcommand gets a new argument: --destination (or -d). This argument is required if there are multiple branches (or tags) entries configured for the remote Subversion repository. The argument's value specifies which branch (or tag) path to use to create the branch (or tag). The specified value must match the left side (without wildcards) of one of the branches (or tags) refspecs in the svn-remote's config. [ew: avoided explicit loop when combining globs with "push"] Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | Add 'git svn reset' to unwind 'git svn fetch'Ben Jackson2009-06-253-6/+164
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a command to unwind the effects of fetch by moving the rev_map and refs/remotes/git-svn back to an old SVN revision. This allows revisions to be re-fetched. Ideally SVN revs would be immutable, but permissions changes in the SVN repository or indiscriminate use of '--ignore-paths' can create situations where fetch cannot make progress. Signed-off-by: Ben Jackson <ben@ben.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | git-svn: speed up find_rev_beforeBen Jackson2009-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By limiting start revision of find_rev_before to max existing revision. This avoids a long wait if you do 'git svn reset -r 9999999'. The linear search within the contiguous revisions doesn't seem to be a problem. [ew: expanded commit message] Signed-off-by: Ben Jackson <ben@ben.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | Add 'git svn help [cmd]' which works outside a repo.Ben Jackson2009-06-251-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously there was no explicit 'help' command, but 'git svn help' still printed the usage message (as an invalid command), provided you got past the initialization steps that required a valid repo. Signed-off-by: Ben Jackson <ben@ben.com> Acked-by: Eric Wong <normalperson@yhbt.net>
| * | git-svn: let 'dcommit $rev' work on $rev instead of HEADThomas Rast2009-06-253-4/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 'git svn dcommit' takes an optional revision argument, but the meaning of it was rather scary. It completely ignored the current state of the HEAD, only looking at the revisions between SVN and $rev. If HEAD was attached to $branch, the branch lost all commits $rev..$branch in the process. Considering that 'git svn dcommit HEAD^' has the intuitive meaning "dcommit all changes on my branch except the last one", we change the meaning of the revision argument. git-svn temporarily checks out $rev for its work, meaning that * if a branch is specified, that branch (_not_ the HEAD) is rebased as part of the dcommit, * if some other revision is specified, as in the example, all work happens on a detached HEAD and no branch is affected. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Acked-by: Eric Wong <normalperson@yhbt.net>
* | | Merge branch 'pb/send-email-cccmd-fix'Junio C Hamano2009-06-271-1/+4
|\ \ \ | | | | | | | | | | | | | | | | * pb/send-email-cccmd-fix: t/t9001-send-email.sh: ensure generated script is executed with $SHELL_PATH
| * | | t/t9001-send-email.sh: ensure generated script is executed with $SHELL_PATHBrandon Casey2009-06-231-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the shell is not specified using the '#!' notation, then the OS will use '/bin/sh' to execute the script which may not produce the desired results. In particular, /bin/sh on Solaris interprets '^' specially which has an effect on the sed command that this patch touches. Signed-off-by: Brandon Casey <drafnel@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'maint'Junio C Hamano2009-06-274-2/+44
|\ \ \ \ | | |_|/ | |/| | | | | | | | | | | | | | | | | | | | | | * maint: gitweb/README: fix AliasMatch in example Test grep --and/--or/--not Test git archive --remote fread does not return negative on error
| * | | gitweb/README: fix AliasMatch in exampleGiuseppe Bilotta2009-06-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When combining "dumb client" and human-friendly access by using the '.git' extension to switch between the two, make sure the AliasMatch covers the entire request. Without a full match, a request for http://git.example.com/project/shortlog/branch..gitsomething would result in a 404 because the server would try to access the the project 'project/shortlog/branch.' The solution is still not bulletproof, so document the possible failing case. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | Test grep --and/--or/--notThomas Rast2009-06-271-0/+30
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | Test git archive --remoteThomas Rast2009-06-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a small test case for git archive --remote (and thus git-upload-archive), which so far went untested. Signed-off-by: Thomas Rast <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | fread does not return negative on errorRoel Kluin2009-06-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | size_t res cannot be less than 0. fread returns 0 on error. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | builtin-remote: (get_one_entry): use strbufBert Wesarg2009-06-231-9/+7
| |_|/ |/| | | | | | | | | | | Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | Merge branch 'maint'Junio C Hamano2009-06-221-1/+1
|\ \ \ | |/ / | | | | | | | | | * maint: t3700-add: add a POSIXPERM prerequisite to a new test
| * | t3700-add: add a POSIXPERM prerequisite to a new testJohannes Sixt2009-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The new test does a 'chmod 0', which does not have the intended effect on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | Merge branch 'sb/maint-1.6.0-add-config-fix' into maintJunio C Hamano2009-06-222-2/+15
| |\ \ | | | | | | | | | | | | | | | | * sb/maint-1.6.0-add-config-fix: add: allow configurations to be overriden by command line
* | \ \ Sync with 1.6.3.3Junio C Hamano2009-06-215-12/+53
|\ \ \ \ | |/ / / | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | GIT 1.6.3.3v1.6.3.3Junio C Hamano2009-06-213-2/+40
| | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | Merge branch 'ak/maint-for-each-ref-no-lookup' into maintJunio C Hamano2009-06-211-9/+17
| |\ \ \ | | | | | | | | | | | | | | | | | | | | * ak/maint-for-each-ref-no-lookup: for-each-ref: Do not lookup objects when they will not be used
| * \ \ \ Merge branch 'rc/maint-http-local-slot-fix' into maintJunio C Hamano2009-06-212-0/+12
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | * rc/maint-http-local-slot-fix: http*: cleanup slot->local after fclose
| * \ \ \ \ Merge branch 'cb/maint-no-double-merge' into maintJunio C Hamano2009-06-212-1/+7
| |\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * cb/maint-no-double-merge: refuse to merge during a merge
| * \ \ \ \ \ Merge branch 'mn/maint-iconv-autoconf' into maintJunio C Hamano2009-06-211-0/+8
| |\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * mn/maint-iconv-autoconf: fix handling of iconv configuration options
| * \ \ \ \ \ \ Merge branch 'lt/maint-unsigned-left-shift' into maintJunio C Hamano2009-06-218-16/+12
| |\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lt/maint-unsigned-left-shift: Fix big left-shifts of unsigned char
| * \ \ \ \ \ \ \ Merge branch 'pb/maint-1.6.2-userdiff-fix' into maintJunio C Hamano2009-06-212-7/+10
| |\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * pb/maint-1.6.2-userdiff-fix: upload-archive: fix infinite loop on Cygwin avoid exponential regex match for java and objc function names
| * | | | | | | | | attribute: whitespace set to true detects all errors known to gitJunio C Hamano2009-06-211-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That is what the documentation says, but the code pretends as if all the known whitespace error tokens were given. Among the whitespace error tokens, there is one kind that loosens the rule when set: cr-at-eol. Which means that whitespace error token that is set to true ignores a newly introduced CR at the end, which is inconsistent with the documentation. Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | | | | .gitattributes: CR at the end of the line is an errorNanako Shiraishi2009-06-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a CR is accidentally added at the end of a C source file in the git project tree, "git diff --check" doesn't detect it as an error. $ echo abQ | tr Q '\015' >>fast-import.c $ git diff --check I think this is because the "whitespace" attribute is set to *.[ch] files without specifying what kind of errors are caught. It makes git "notice all types of errors" (as described in the documentation), but I think it is incorrectly setting cr-at-eol, too, and hides this error. Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * | | | | | | | | t3505: fix abuse of test_expect_codeJunio C Hamano2009-06-211-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The test wanted to make sure that cherry-pick exits with status 1, but with the way it was placed after "git checkout master &&" meant that it could have misjudged success if checkout barfed with the same failure status. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | | Merge branch 'maint'Junio C Hamano2009-06-202-3/+3
|\ \ \ \ \ \ \ \ \ \ | |/ / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * maint: git-show-ref.txt: remove word and make consistent git-svn documentation: fix typo in 'rebase vs. pull/merge' section
| * | | | | | | | | Merge branch 'maint-1.6.2' into maintJunio C Hamano2009-06-203-7/+7
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * maint-1.6.2: git-show-ref.txt: remove word and make consistent git-svn documentation: fix typo in 'rebase vs. pull/merge' section use xstrdup, not strdup in ll-merge.c