Commit Graph

24553 Commits

Author SHA1 Message Date
Nicolas Kaiser
803dbdb968 transport-helper.c: fix check for (size_t < 0)
'bytes' is of type size_t which is unsigned thus can't be negative.  But
the assigned write() returns ssize_t, and -1 on error.

For testing < 0, 'bytes' needs to be of a signed type.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-08 21:36:12 -08:00
Junio C Hamano
07873dc5dd Merge branch 'maint'
* maint:
  Documentation: fix a typo in git-apply.txt
  init: remove unnecessary check
2011-03-04 15:02:45 -08:00
Junio C Hamano
6d74e5c9db Merge branch 'mh/p4'
* mh/p4:
  git-p4 submit: prevent 'Jobs' section from being removed from p4 change log
2011-03-04 15:02:28 -08:00
Junio C Hamano
08fd8710e2 Merge branch 'mg/maint-difftool-vim-readonly'
* mg/maint-difftool-vim-readonly:
  mergetool-lib: call vim in readonly mode for diffs
2011-03-04 15:02:27 -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
63bf941e5a Merge branch 'jc/grep--no-index-pathspec-fix'
* jc/grep--no-index-pathspec-fix:
  grep --no-index: honor pathspecs correctly
2011-03-04 15:02:26 -08:00
Michał Kiedrowicz
964498e7f9 Documentation: fix a typo in git-apply.txt
git-apply accepts the --cached option, not --cache.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-04 10:05:00 -08:00
Nguyễn Thái Ngọc Duy
b31d20227a init: remove unnecessary check
git_dir must always be non-NULL so "if (git_dir)" is unnecessary.
Before this code, if git_dir == NULL, it will default to
DEFAULT_GIT_DIR_ENVIRONMENT.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-03 15:45:10 -08:00
Junio C Hamano
501ccd527d Merge branch 'maint'
* maint:
  verify-pack: add --stat-only to the synopsis section
2011-03-02 15:26:44 -08:00
Junio C Hamano
ec48d4bb7f verify-pack: add --stat-only to the synopsis section
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-01 11:26:22 -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
Jonathan Nieder
6288e3e180 fast-import: make code "-Wpointer-arith" clean
The dereference() function to peel a tree-ish and find the underlying
tree expects arithmetic to (void *) to work on byte addresses.  We
should be reading the text of objects through a char * anyway.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-28 15:25:12 -06:00
Junio C Hamano
afb0b7933f Start preparing release notes to 1.7.5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-28 12:28:20 -08:00
Junio C Hamano
8978166e53 Merge branch 'jh/push-default-upstream-configname'
* jh/push-default-upstream-configname:
  push.default: Rename 'tracking' to 'upstream'
2011-02-27 21:58:31 -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
7d5c884ead Merge branch 'nd/sorted-builtin-command-list'
* nd/sorted-builtin-command-list:
  git.c: reorder builtin command list
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
99f45c2a5d Merge branch 'js/detach-doc'
* js/detach-doc:
  git-checkout.txt: improve detached HEAD documentation
2011-02-27 21:58:30 -08:00
Junio C Hamano
5e3d39ba8a Merge branch 'va/p4'
* va/p4:
  git-p4: Add copy detection support
  git-p4: Improve rename detection support
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
28afcbfe8b Merge branch 'sp/maint-smart-http-sans-100-continue'
* sp/maint-smart-http-sans-100-continue:
  smart-http: Don't use Expect: 100-Continue
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
70ae2beadd Merge branch 'hv/mingw-fs-funnies'
* hv/mingw-fs-funnies:
  mingw_rmdir: set errno=ENOTEMPTY when appropriate
  mingw: add fallback for rmdir in case directory is in use
  mingw: make failures to unlink or move raise a question
  mingw: work around irregular failures of unlink on windows
  mingw: move unlink wrapper to mingw.c
2011-02-27 21:17:37 -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
Michael J Gruber
6e7293e3ed git-add: make -A description clearer vs. -u
Currently, it sounds as if "notice removal of files" distinguishes "-A"
from "-u", and there is no mention of the worktree.

But both notice the removal, and only "-A" adds changes from untracked
files. Say so.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-27 15:34:54 -08:00
Junio C Hamano
e3d3f7d204 Merge branch 'maint'
* maint:
  branch_merged: fix grammar in warning
2011-02-27 00:52:15 -08:00
Eric Hanchrow
62270f6b0a branch_merged: fix grammar in warning
Signed-off-by: Eric Hanchrow <eric.hanchrow@gmail.com>
Helped-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-02-27 00:29:58 -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
b1c9b798a6 vcs-svn: teach line_buffer about temporary files
It can sometimes be useful to write information temporarily to file,
to read back later.  These functions allow a program to use the
line_buffer facilities when doing so.

It works like this:

 1. find a unique filename with buffer_tmpfile_init.
 2. rewind with buffer_tmpfile_rewind.  This returns a stdio
    handle for writing.
 3. when finished writing, declare so with
    buffer_tmpfile_prepare_to_read.  The return value indicates
    how many bytes were written.
 4. read whatever portion of the file is needed.
 5. if finished, remove the temporary file with buffer_deinit.
    otherwise, go back to step 2,

The svn support would use this to buffer the postimage from delta
application until the length is known and fast-import can receive
the resulting blob.

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
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
cc193f1f0b vcs-svn: allow character-oriented input
buffer_read_char can be used in place of buffer_read_string(1) to
avoid consuming valuable static buffer space.  The delta applier will
use this to read variable-length integers one byte at a time.

Underneath, it is fgetc, wrapped so the line_buffer library can
maintain its role as gatekeeper of input.

Later it might be worth checking if fgetc_unlocked is faster ---
most line_buffer functions are not thread-safe anyway.

Helpd-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
Jonathan Nieder
e5e45ca1e3 vcs-svn: teach line_buffer to handle multiple input files
Collect the line_buffer state in a newly public line_buffer struct.
Callers can use multiple line_buffers to manage input from multiple
files at a time.

svn-fe's delta applier will use this to stream a delta from svnrdump
and the preimage it applies to from fast-import at the same time.

The tests don't take advantage of the new features, but I think that's
okay.  It is easier to find lingering examples of nonreentrant code by
searching for "static" in line_buffer.c.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:59 -06:00
Jonathan Nieder
d350822fa7 vcs-svn: collect line_buffer data in a struct
Prepare for the line_buffer lib to support input from multiple files,
by collecting global state in a struct that can be easily passed
around.

No API change yet.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:58 -06:00
Jonathan Nieder
deadcef4c1 vcs-svn: replace buffer_read_string memory pool with a strbuf
obj_pool is inherently global and does not use the standard growing
factor alloc_nr, which makes it feel out of place in the git codebase.
Plus it is overkill for this application: all that is needed is a
buffer that can grow between requests to accomodate larger strings.
Use a strbuf instead.

As a side effect, this improves the error handling: allocation
failures will result in a clean exit instead of segfaults.  It would
be nice to add a test case (using ulimit or failmalloc) but that can
wait for another day.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
2011-02-26 04:57:58 -06:00