1
0
mirror of https://github.com/git/git.git synced 2024-10-20 09:59:05 +02:00
Commit Graph

4947 Commits

Author SHA1 Message Date
René Scharfe
c41dd2fd7d grep: read patterns from stdin with -f -
Support the well-know convention of reading standard input instead of a
named file if "-" (dash) is specified.  GNU grep does the same.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-19 21:46:52 -07:00
Carlos Martín Nieto
e2a57aac8a Name make_*_path functions more accurately
Rename the make_*_path functions so it's clearer what they do, in
particlar make clear what the differnce between make_absolute_path and
make_nonrelative_path is by renaming them real_path and absolute_path
respectively. make_relative_path has an understandable name and is
renamed to relative_path to maintain the name convention.

The function calls have been replaced 1-to-1 in their usage.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-17 16:08:30 -07:00
Junio C Hamano
b2f6eab402 Merge branch 'maint'
* maint:
  Prepare draft release notes to 1.7.4.2
  gitweb: highlight: replace tabs with spaces
  make_absolute_path: return the input path if it points to our buffer
  valgrind: ignore SSE-based strlen invalid reads
  diff --submodule: split into bite-sized pieces
  cherry: split off function to print output lines
  branch: split off function that writes tracking info and commit subject
  standardize brace placement in struct definitions
  compat: make gcc bswap an inline function
  enums: omit trailing comma for portability

Conflicts:
	RelNotes
2011-03-16 16:59:30 -07:00
Junio C Hamano
afb497d472 Merge branch 'jn/maint-commit-missing-template' into maint
* jn/maint-commit-missing-template:
  commit: error out for missing commit message template
2011-03-16 16:47:26 -07:00
Junio C Hamano
43c1b6efb8 Merge branch 'lt/rename-no-extra-copy-detection' into maint
* lt/rename-no-extra-copy-detection:
  diffcore-rename: improve estimate_similarity() heuristics
  diffcore-rename: properly honor the difference between -M and -C
  for_each_hash: allow passing a 'void *data' pointer to callback
2011-03-16 16:47:26 -07:00
Junio C Hamano
4e530c5049 Merge branch 'jk/diffstat-binary' into maint
* jk/diffstat-binary:
  diff: don't retrieve binary blobs for diffstat
  diff: handle diffstat of rewritten binary files
2011-03-16 16:47:26 -07:00
Junio C Hamano
c9b7cc0473 Merge branch 'jn/test-terminal-punt-on-osx-breakage' into maint
* jn/test-terminal-punt-on-osx-breakage:
  tests: skip terminal output tests on OS X
2011-03-16 16:47:26 -07:00
Junio C Hamano
8209b7fb9b Merge branch 'jk/fail-null-clone' into maint
* jk/fail-null-clone:
  clone: die when trying to clone missing local path
2011-03-16 16:47:26 -07:00
Junio C Hamano
7633a5ab9a Merge branch 'mg/placeholders-are-lowercase' into maint
* mg/placeholders-are-lowercase:
  Make <identifier> lowercase in Documentation
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  CodingGuidelines: downcase placeholders in usage messages
2011-03-16 16:47:25 -07:00
Junio C Hamano
bd2700dbdf Merge branch 'mg/patch-id' into maint
* mg/patch-id:
  git-patch-id: do not trip over "no newline" markers
  git-patch-id: test for "no newline" markers
2011-03-16 16:47:25 -07:00
Junio C Hamano
5b8aac32fb Merge branch 'js/maint-merge-use-prepare-commit-msg-hook' into maint
* js/maint-merge-use-prepare-commit-msg-hook:
  merge: honor prepare-commit-msg hook
2011-03-16 16:47:25 -07:00
Carlos Martín Nieto
b406a2d3e3 valgrind: ignore SSE-based strlen invalid reads
Some versions of strlen use SSE to speed up the calculation and load 4
bytes at a time, even if it means reading past the end of the
allocated memory. This read is safe and when the strlen function is
inlined, it is not replaced by valgrind, which reports a
false-possitive.

Tell valgrind to ignore this particular error, as the read is, in
fact, safe. Current upstream-released version 3.6.1 is affected. Some
distributions have this fixed in their latest versions.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-16 13:19:56 -07:00
Junio C Hamano
663ee1a4c9 Merge branch 'jh/maint-do-not-track-non-branches'
* jh/maint-do-not-track-non-branches:
  branch/checkout --track: Ensure that upstream branch is indeed a branch
2011-03-15 14:22:13 -07:00
Piotr Krukowiecki
0986de94f9 Documentation: running test with --debug keeps "trash" directory
Signed-off-by: Piotr Krukowiecki <piotr.krukowiecki@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-15 14:18:34 -07:00
Junio C Hamano
ae4479d494 Merge branch 'pw/p4'
* pw/p4:
  git-p4: test clone @all
  git-p4: fix clone @all regression
2011-03-13 00:10:06 -08:00
Pete Wyckoff
f0c9fe0504 git-p4: test clone @all
Cloning a p4 depot by default generates a single commit.  The use
of the "@all" revision specifier instead tells git-p4 to import
all commits.  Check to make sure both these invocations work as
expected.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-13 00:06:25 -08:00
Junio C Hamano
66ecd2d053 Merge branch 'js/cherry-pick-usability'
* js/cherry-pick-usability:
  Teach commit about CHERRY_PICK_HEAD
  bash: teach __git_ps1 about CHERRY_PICK_HEAD
  Introduce CHERRY_PICK_HEAD
  t3507: introduce pristine-detach helper
2011-03-09 15:56:17 -08:00
Junio C Hamano
75618f1106 Merge branch 'js/checkout-untracked-symlink'
* js/checkout-untracked-symlink:
  do not overwrite untracked symlinks
  Demonstrate breakage: checkout overwrites untracked symlink with directory
2011-03-09 15:54:04 -08:00
Junio C Hamano
3814888a63 Merge branch 'so/submodule-no-update-first-time'
* so/submodule-no-update-first-time:
  t7406: "git submodule update {--merge|--rebase]" with new submodules
  submodule: no [--merge|--rebase] when newly cloned
2011-03-09 15:53:32 -08:00
Junio C Hamano
31f4da593b Merge branch 'maint'
* maint:
  Fix typo in t/README
  ls-remote documentation: <refs> argument is optional
  Add Author and Documentation sections to git-for-each-ref.txt
  Documentation: remove redundant colons in git-for-each-ref.txt
2011-03-09 14:20:39 -08:00
Mathias Lafeldt
681186ae3a Fix typo in t/README
Signed-off-by: Mathias Lafeldt <misfire@debugon.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-09 12:53:13 -08:00
Junio C Hamano
5cb3c9b7df Merge branch 'jn/maint-commit-missing-template'
* jn/maint-commit-missing-template:
  commit: error out for missing commit message template
2011-03-04 15:02:27 -08:00
Junio C Hamano
1538f21bfb Merge branch 'jk/diffstat-binary'
* jk/diffstat-binary:
  diff: don't retrieve binary blobs for diffstat
  diff: handle diffstat of rewritten binary files
2011-03-04 15:02:27 -08:00
Junio C Hamano
24161eb036 Merge branch 'lt/rename-no-extra-copy-detection'
* lt/rename-no-extra-copy-detection:
  diffcore-rename: improve estimate_similarity() heuristics
  diffcore-rename: properly honor the difference between -M and -C
  for_each_hash: allow passing a 'void *data' pointer to callback
2011-03-04 15:02:27 -08:00
Junio C Hamano
53d31d71b7 Merge branch 'jn/test-terminal-punt-on-osx-breakage'
* jn/test-terminal-punt-on-osx-breakage:
  tests: skip terminal output tests on OS X
2011-03-04 15:02:26 -08:00
Junio C Hamano
51aca1665b Merge branch 'jk/fail-null-clone'
* jk/fail-null-clone:
  clone: die when trying to clone missing local path
2011-03-04 15:02:26 -08:00
Junio C Hamano
f70f736bcb Merge branch 'svn-fe' of git://repo.or.cz/git/jrn
* 'svn-fe' of git://repo.or.cz/git/jrn: (31 commits)
  fast-import: make code "-Wpointer-arith" clean
  vcs-svn: teach line_buffer about temporary files
  vcs-svn: allow input from file descriptor
  vcs-svn: allow character-oriented input
  vcs-svn: add binary-safe read function
  t0081 (line-buffer): add buffering tests
  vcs-svn: tweak test-line-buffer to not assume line-oriented input
  tests: give vcs-svn/line_buffer its own test script
  vcs-svn: make test-line-buffer input format more flexible
  vcs-svn: teach line_buffer to handle multiple input files
  vcs-svn: collect line_buffer data in a struct
  vcs-svn: replace buffer_read_string memory pool with a strbuf
  vcs-svn: eliminate global byte_buffer
  fast-import: add 'ls' command
  vcs-svn: Allow change nodes for root of tree (/)
  vcs-svn: Implement Prop-delta handling
  vcs-svn: Sharpen parsing of property lines
  vcs-svn: Split off function for handling of individual properties
  vcs-svn: Make source easier to read on small screens
  vcs-svn: More dump format sanity checks
  ...
2011-02-28 16:33:45 -08:00
Junio C Hamano
fbfeeaf294 Merge branch 'lp/config-vername-check'
* lp/config-vername-check:
  Disallow empty section and variable names
  Sanity-check config variable names
2011-02-27 21:58:31 -08:00
Junio C Hamano
ecd75ddb6f Merge branch 'mg/placeholders-are-lowercase'
* mg/placeholders-are-lowercase:
  Make <identifier> lowercase in Documentation
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  Make <identifier> lowercase as per CodingGuidelines
  CodingGuidelines: downcase placeholders in usage messages
2011-02-27 21:58:30 -08:00
Junio C Hamano
c8cdbf2bad Merge branch 'mg/patch-id'
* mg/patch-id:
  git-patch-id: do not trip over "no newline" markers
  git-patch-id: test for "no newline" markers
2011-02-27 21:58:30 -08:00
Junio C Hamano
66a6a31420 Merge branch 'mz/rerere-remaining'
* mz/rerere-remaining:
  mergetool: don't skip modify/remove conflicts
  rerere "remaining"
2011-02-27 21:58:30 -08:00
Junio C Hamano
11e4b4fa49 Merge branch 'js/maint-merge-use-prepare-commit-msg-hook'
* js/maint-merge-use-prepare-commit-msg-hook:
  merge: honor prepare-commit-msg hook
2011-02-27 21:58:30 -08:00
Junio C Hamano
fc7ae9c156 Merge branch 'nd/hash-object-sanity'
* nd/hash-object-sanity:
  Make hash-object more robust against malformed objects

Conflicts:
	cache.h
2011-02-27 21:58:30 -08:00
Junio C Hamano
8d3a362028 Merge branch 'pw/p4'
* pw/p4:
  git-p4: support clone --bare
  git-p4: decode p4 wildcard characters
  git-p4: better message for "git-p4 sync" when not cloned
  git-p4: reinterpret confusing p4 message
  git-p4: accommodate new move/delete type in p4
  git-p4: add missing newline in initial import message
  git-p4: fix key error for p4 problem
  git-p4: test script
2011-02-27 21:58:30 -08:00
Junio C Hamano
c0791f365e Merge branch 'uk/checkout-ambiguous-ref'
* uk/checkout-ambiguous-ref:
  Rename t2019 with typo "amiguous" that meant "ambiguous"
  checkout: rearrange update_refs_for_switch for clarity
  checkout: introduce --detach synonym for "git checkout foo^{commit}"
  checkout: split off a function to peel away branchname arg
  checkout: fix bug with ambiguous refs

Conflicts:
	builtin/checkout.c
2011-02-27 21:58:29 -08:00
Junio C Hamano
8e949a4acc Merge branch 'mo/perl-bidi-pipe-envfix'
* mo/perl-bidi-pipe-envfix:
  perl: command_bidi_pipe() method should set-up git environmens
2011-02-27 21:58:28 -08:00
Junio C Hamano
42e3086bf6 Merge branch 'en/object-list-with-pathspec'
* en/object-list-with-pathspec:
  Add testcases showing how pathspecs are handled with rev-list --objects
  Make rev-list --objects work together with pathspecs
2011-02-27 21:17:36 -08:00
Junio C Hamano
d5c87a802d Merge branch 'nd/struct-pathspec'
* nd/struct-pathspec: (22 commits)
  t6004: add pathspec globbing test for log family
  t7810: overlapping pathspecs and depth limit
  grep: drop pathspec_matches() in favor of tree_entry_interesting()
  grep: use writable strbuf from caller for grep_tree()
  grep: use match_pathspec_depth() for cache/worktree grepping
  grep: convert to use struct pathspec
  Convert ce_path_match() to use match_pathspec_depth()
  Convert ce_path_match() to use struct pathspec
  struct rev_info: convert prune_data to struct pathspec
  pathspec: add match_pathspec_depth()
  tree_entry_interesting(): optimize wildcard matching when base is matched
  tree_entry_interesting(): support wildcard matching
  tree_entry_interesting(): fix depth limit with overlapping pathspecs
  tree_entry_interesting(): support depth limit
  tree_entry_interesting(): refactor into separate smaller functions
  diff-tree: convert base+baselen to writable strbuf
  glossary: define pathspec
  Move tree_entry_interesting() to tree-walk.c and export it
  tree_entry_interesting(): remove dependency on struct diff_options
  Convert struct diff_options to use struct pathspec
  ...
2011-02-27 21:17:36 -08:00
Jakub Narebski
e5ea66f9e5 gitweb: Make i18n (encoding) tests in t9500 leave clean state
The most important issue is that after unsetting `i18n.commitencoding'
config variable t9500 no longer will use author and comitter name
containing ISO-8859-1 characters, which are invalid UTF-8 characters.

Besides it is good practice in general to clean up the state in tests.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-27 15:36:33 -08:00
Jonathan Nieder
a62bbf8f01 Merge commit 'jn/svn-fe' of git://github.com/gitster/git into svn-fe
* git://github.com/gitster/git:
  vcs-svn: Allow change nodes for root of tree (/)
  vcs-svn: Implement Prop-delta handling
  vcs-svn: Sharpen parsing of property lines
  vcs-svn: Split off function for handling of individual properties
  vcs-svn: Make source easier to read on small screens
  vcs-svn: More dump format sanity checks
  vcs-svn: Reject path nodes without Node-action
  vcs-svn: Delay read of per-path properties
  vcs-svn: Combine repo_replace and repo_modify functions
  vcs-svn: Replace = Delete + Add
  vcs-svn: handle_node: Handle deletion case early
  vcs-svn: Use mark to indicate nodes with included text
  vcs-svn: Unclutter handle_node by introducing have_props var
  vcs-svn: Eliminate node_ctx.mark global
  vcs-svn: Eliminate node_ctx.srcRev global
  vcs-svn: Check for errors from open()
  vcs-svn: Allow simple v3 dumps (no deltas yet)

Conflicts:
	t/t9010-svn-fe.sh
	vcs-svn/svndump.c
2011-02-26 05:21:29 -06:00
Jonathan Nieder
cb3f87cf1b vcs-svn: allow input from file descriptor
Based-on-patch-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:59:37 -06:00
Jonathan Nieder
e832f43c1d vcs-svn: add binary-safe read function
buffer_read_string works well for non line-oriented input except for
one problem: it does not tell the caller how many bytes were actually
written.  This means that unless one is very careful about checking
for errors (and eof) the calling program cannot tell the difference
between the string "foo" followed by an early end of file and the
string "foo\0bar\0baz".

So introduce a variant that reports the length, too, a thinner wrapper
around strbuf_fread.  Its result is written to a strbuf so the caller
does not need to keep track of the number of bytes read.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:59:37 -06:00
Jonathan Nieder
d280f68313 t0081 (line-buffer): add buffering tests
POSIX makes the behavior of read(2) from a pipe fairly clear: a read
from an empty pipe will block until there is data available and any
other read will not block, prefering to return a partial result.
Likewise, fread(3) and fgets(3) are clearly specified to act as
though implemented by calling fgetc(3) in a simple loop.  But the
buffering behavior of fgetc is less clear.

Luckily, no sane platform is going to implement fgetc by calling the
equivalent of read(2) more than once.  fgetc has to be able to
return without filling its buffer to preserve errno when errors are
encountered anyway.  So let's assume the simpler behavior (trust) but
add some tests to catch insane platforms that violate that when they
come (verify).

First check that fread can handle a 0-length read from an empty fifo.
Because open(O_RDONLY) blocks until the writing end is open, open the
writing end of the fifo in advance in a subshell.

Next try short inputs from a pipe that is not filled all the way.

Lastly (two tests) try very large inputs from a pipe that will not fit
in the relevant buffers.  The first of these tests reads a little
more than 8192 bytes, which is BUFSIZ (the size of stdio's buffers)
on this Linux machine.  The second reads a little over 64 KiB (the
pipe capacity on Linux) and is not run unless requested by setting
the GIT_REMOTE_SVN_TEST_BIG_FILES environment variable.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:58:21 -06:00
Jonathan Nieder
7b990c9051 vcs-svn: tweak test-line-buffer to not assume line-oriented input
Do not expect an implicit newline after each input record.
Use a separate command to exercise buffer_skip_bytes.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:59 -06:00
Jonathan Nieder
232087fd99 tests: give vcs-svn/line_buffer its own test script
Split the line_buffer test into small pieces and move it to its
own file as preparation for adding more tests.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:59 -06:00
Jonathan Nieder
850c5ea44c vcs-svn: make test-line-buffer input format more flexible
Imitate the input format of test-obj-pool to support arbitrary
sequences of commands rather than alternating read/copy.  This should
make it easier to add tests that exercise other line_buffer functions.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:59 -06:00
David Barr
8dc6a373d2 fast-import: add 'ls' command
Lazy fast-import frontend authors that want to rely on the backend to
keep track of the content of the imported trees _almost_ have what
they need in the 'cat-blob' command (v1.7.4-rc0~30^2~3, 2010-11-28).
But it is not quite enough, since

 (1) cat-blob can be used to retrieve the content of files, but
     not their mode, and

 (2) using cat-blob requires the frontend to keep track of a name
     (mark number or object id) for each blob to be retrieved

Introduce an 'ls' command to complement cat-blob and take care of the
remaining needs.  The 'ls' command finds what is at a given path
within a given tree-ish (tag, commit, or tree):

	'ls' SP <dataref> SP <path> LF

or in fast-import's active commit:

	'ls' SP <path> LF

The response is a single line sent through the cat-blob channel,
imitating ls-tree output.  So for example:

	FE> ls :1 Documentation
	gfi> 040000 tree 9e6c2b599341d28a2a375f8207507e0a2a627fe9	Documentation
	FE> ls 9e6c2b599341d28a2a375f8207507e0a2a627fe9 git-fast-import.txt
	gfi> 100644 blob 4f92954396e3f0f97e75b6838a5635b583708870	git-fast-import.txt
	FE> ls :1 RelNotes
	gfi> 120000 blob b942e499449d97aeb50c73ca2bdc1c6e6d528743	RelNotes
	FE> cat-blob b942e499449d97aeb50c73ca2bdc1c6e6d528743
	gfi> b942e499449d97aeb50c73ca2bdc1c6e6d528743 blob 32
	gfi> Documentation/RelNotes/1.7.4.txt

The most interesting parts of the reply are the first word, which is
a 6-digit octal mode (regular file, executable, symlink, directory,
or submodule), and the part from the second space to the tab, which is
a <dataref> that can be used in later cat-blob, ls, and filemodify (M)
commands to refer to the content (blob, tree, or commit) at that path.

If there is nothing there, the response is "missing some/path".

The intent is for this command to be used to read files from the
active commit, so a frontend can apply patches to them, and to copy
files and directories from previous revisions.

For example, proposed updates to svn-fe use this command in place of
its internal representation of the repository directory structure.
This simplifies the frontend a great deal and means support for
resuming an import in a separate fast-import run (i.e., incremental
import) is basically free.

Signed-off-by: David Barr <david.barr@cordelta.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Improved-by: Sverre Rabbelier <srabbelier@gmail.com>
2011-02-26 04:57:58 -06:00
Jonathan Nieder
2140b14064 commit: error out for missing commit message template
When "git commit" was rewritten in C (v1.5.4-rc0~78^2~30,
2007-11-08), a subtle bug in --template was introduced.  If the
file named by a --template parameter is missing, previously git
would error out with a message:

	Commit template file does not exist.

but in the C version the --template parameter gets ignored and
the default template is used.

t7500 has two tests for this case which would have caught it, except
that with the default $EDITOR, the commit message template is left
unmodified, causing 'git commit' to error out and the test to
succeed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-25 12:13:55 -08:00
Libor Pechacek
2169ddc056 Disallow empty section and variable names
It is possible to break your repository config by creating an invalid key.  The
config parser in turn chokes on it:

  $ git init
  Initialized empty Git repository in /tmp/gittest/.git/
  $ git config .foo false
  $ git config core.bare
  fatal: bad config file line 6 in .git/config

This patch makes git-config reject keys which start or end with a dot and adds
tests for these cases.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-22 15:19:46 -08:00
Libor Pechacek
b09c53a3e3 Sanity-check config variable names
Sanity-check config variable names when adding and retrieving them.  As a side
effect code duplication between git_config_set_multivar and get_value (in
builtin/config.c) was removed and the common functionality was placed in
git_config_parse_key.

This breaks a test in t1300 which used invalid section-less keys in the tests
for "git -c". However, allowing such names there was useless, since there was
no way to set them via config file, and no part of git actually tried to use
section-less keys. This patch updates the test to use more realistic examples
as well as adding its own test.

Signed-off-by: Libor Pechacek <lpechacek@suse.cz>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-22 15:19:45 -08:00