summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2011-09-22fast-import: don't allow to tag empty branchLibravatar Dmitry Ivankov1-0/+12
'reset' command makes fast-import start a branch from scratch. It's name is kept in lookup table but it's sha1 is null_sha1 (special value). 'tag' command can be used to tag a branch by it's name. lookup_branch() is used it that case and it doesn't check for null_sha1. So fast-import writes a tag for null_sha1 object instead of giving a error. Add a check to deny tagging an empty branch and add a corresponding test. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-28Merge branch 'di/fast-import-tagging'Libravatar Junio C Hamano1-0/+67
* di/fast-import-tagging: fast-import: allow to tag newly created objects fast-import: add tests for tagging blobs
2011-08-28Merge branch 'di/fast-import-deltified-tree'Libravatar Junio C Hamano1-0/+41
* di/fast-import-deltified-tree: fast-import: prevent producing bad delta fast-import: add a test for tree delta base corruption
2011-08-28Merge branch 'di/fast-import-ident'Libravatar Junio C Hamano2-0/+135
* di/fast-import-ident: fsck: improve committer/author check fsck: add a few committer name tests fast-import: check committer name more strictly fast-import: don't fail on omitted committer name fast-import: add input format tests
2011-08-28Merge branch 'va/p4-branch-import'Libravatar Junio C Hamano1-0/+200
* va/p4-branch-import: git-p4: Add simple test case for branch import git-p4: Allow branch definition with git config git-p4: Allow filtering Perforce branches by user git-p4: Correct branch base depot path detection git-p4: Process detectCopiesHarder with --bool git-p4: Add test case for copy detection git-p4: Add test case for rename detection git-p4: Add description of rename/copy detection options git-p4: Allow setting rename/copy detection threshold
2011-08-25Merge branch 'jc/merge-reword'Libravatar Junio C Hamano1-3/+3
* jc/merge-reword: merge: reword the final message
2011-08-25Merge branch 'mg/branch-set-upstream-previous'Libravatar Junio C Hamano1-0/+14
* mg/branch-set-upstream-previous: branch.c: use the parsed branch name
2011-08-25Merge branch 'di/fast-import-doc'Libravatar Junio C Hamano1-0/+47
* di/fast-import-doc: doc/fast-import: document feature import-marks-if-exists
2011-08-25Merge branch 'jn/plug-empty-tree-leak'Libravatar Junio C Hamano1-1/+26
* jn/plug-empty-tree-leak: merge-recursive: take advantage of hardcoded empty tree revert: plug memory leak in "cherry-pick root commit" codepath
2011-08-23Merge branch 'rt/zlib-smaller-window'Libravatar Junio C Hamano22-7/+73
* rt/zlib-smaller-window: test: consolidate definition of $LF Tolerate zlib deflation with window size < 32Kb
2011-08-23Merge branch 'jn/maint-test-return'Libravatar Junio C Hamano2-9/+13
* jn/maint-test-return: t3900: do not reference numbered arguments from the test script test: cope better with use of return for errors test: simplify return value of test_run_
2011-08-23Merge branch 'cb/maint-ls-files-error-report'Libravatar Junio C Hamano1-0/+70
* cb/maint-ls-files-error-report: ls-files: fix pathspec display on error
2011-08-23fast-import: allow to tag newly created objectsLibravatar Dmitry Ivankov1-0/+26
fast-import allows to tag objects by sha1 and to query sha1 of objects being imported. So it should allow to tag these objects, make it do so. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-23fast-import: add tests for tagging blobsLibravatar Dmitry Ivankov1-0/+41
fast-import allows to create an annotated tag that annotates a blob, via mark or direct sha1 specification. For mark it works, for sha1 it tries to read the object. It tries to do so via read_sha1_file, and then checks the size to be at least 46. That's weird, let's just allow to (annotated) tag any object referenced by sha1. If the object originates from our packfile, we still fail though. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22git-p4: Add simple test case for branch importLibravatar Vitor Antunes1-0/+64
Create a basic branch structure in P4 and clone it with git-p4. Also, make an update on P4 side and check if git-p4 imports it correctly. The branch structure is created in such a way that git-p4 will fail to import updates if patch "git-p4: Correct branch base depot path detection" is not applied. Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22git-p4: Add test case for copy detectionLibravatar Vitor Antunes1-0/+83
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-22git-p4: Add test case for rename detectionLibravatar Vitor Antunes1-0/+53
Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-19branch.c: use the parsed branch nameLibravatar Michael J Gruber1-0/+14
When setting up tracking info, branch.c uses the given branch specifier ("name"). Use the parsed name ("ref.buf") instead so that git branch --set-upstream @{-1} foo sets up tracking info for the previous branch rather than for a branch named "@{-1}". Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-18Merge branch 'db/am-skip-blank-at-the-beginning'Libravatar Junio C Hamano1-0/+18
* db/am-skip-blank-at-the-beginning: am: ignore leading whitespace before patch
2011-08-17Merge branch 'mh/check-attr-relative'Libravatar Junio C Hamano1-21/+69
* mh/check-attr-relative: (29 commits) test-path-utils: Add subcommand "prefix_path" test-path-utils: Add subcommand "absolute_path" git-check-attr: Normalize paths git-check-attr: Demonstrate problems with relative paths git-check-attr: Demonstrate problems with unnormalized paths git-check-attr: test that no output is written to stderr Rename git_checkattr() to git_check_attr() git-check-attr: Fix command-line handling to match docs git-check-attr: Drive two tests using the same raw data git-check-attr: Add an --all option to show all attributes git-check-attr: Error out if no pathnames are specified git-check-attr: Process command-line args more systematically git-check-attr: Handle each error separately git-check-attr: Extract a function error_with_usage() git-check-attr: Introduce a new variable git-check-attr: Extract a function output_attr() Allow querying all attributes on a file Remove redundant check Remove redundant call to bootstrap_attr_stack() Extract a function collect_all_attrs() ...
2011-08-17Merge branch 'js/bisect-no-checkout'Libravatar Junio C Hamano1-3/+172
* js/bisect-no-checkout: bisect: add support for bisecting bare repositories bisect: further style nitpicks bisect: replace "; then" with "\n<tab>*then" bisect: cleanup whitespace errors in git-bisect.sh. bisect: add documentation for --no-checkout option. bisect: add tests for the --no-checkout option. bisect: introduce --no-checkout support into porcelain. bisect: introduce support for --no-checkout option. bisect: add tests to document expected behaviour in presence of broken trees. bisect: use && to connect statements that are deferred with eval. bisect: move argument parsing before state modification.
2011-08-17Merge branch 'rc/histogram-diff'Libravatar Junio C Hamano3-159/+180
* rc/histogram-diff: xdiff/xhistogram: drop need for additional variable xdiff/xhistogram: rely on xdl_trim_ends() xdiff/xhistogram: rework handling of recursed results xdiff: do away with xdl_mmfile_next() Make test number unique xdiff/xprepare: use a smaller sample size for histogram diff xdiff/xprepare: skip classification teach --histogram to diff t4033-diff-patience: factor out tests xdiff/xpatience: factor out fall-back-diff function xdiff/xprepare: refactor abort cleanups xdiff/xprepare: use memset()
2011-08-17Merge branch 'js/ref-namespaces'Libravatar Junio C Hamano1-0/+85
* js/ref-namespaces: ref namespaces: tests ref namespaces: documentation ref namespaces: Support remote repositories via upload-pack and receive-pack ref namespaces: infrastructure Fix prefix handling in ref iteration functions
2011-08-17doc/fast-import: document feature import-marks-if-existsLibravatar Dmitry Ivankov1-0/+47
fast-import command-line option --import-marks-if-exists was introduced in commit dded4f1 (fast-import: Introduce --import-marks-if-exists, 2011-01-15) --import-marks option can be set via a "feature" command in a fast-import stream and --import-marks-if-exists had support for such specification from the very beginning too due to some shared codebase. Though the documentation for this feature wasn't written in dded4f1. Add the documentation for "feature import-marks-if-exists=<file>". Also add a minimalistic test for it. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-16Merge branch 'jk/tag-list-multiple-patterns' into maintLibravatar Junio C Hamano1-0/+5
* jk/tag-list-multiple-patterns: tag: accept multiple patterns for --list
2011-08-16Merge branch 'jl/submodule-update-quiet' into maintLibravatar Junio C Hamano1-2/+4
* jl/submodule-update-quiet: submodule: update and add must honor --quiet flag
2011-08-16Merge branch 'jl/submodule-add-relurl-wo-upstream' into maintLibravatar Junio C Hamano1-0/+10
* jl/submodule-add-relurl-wo-upstream: submodule add: clean up duplicated code submodule add: allow relative repository path even when no url is set submodule add: test failure when url is not configured in superproject Conflicts: git-submodule.sh
2011-08-16Merge branch 'js/ls-tree-error' into maintLibravatar Junio C Hamano1-0/+24
* js/ls-tree-error: Ensure git ls-tree exits with a non-zero exit code if read_tree_recursive fails. Add a test to check that git ls-tree sets non-zero exit code on error.
2011-08-16Merge branch 'jk/fast-export-quote-path' into maintLibravatar Junio C Hamano1-1/+27
* jk/fast-export-quote-path: fast-export: quote paths in output
2011-08-16Merge branch 'jc/maint-reset-unmerged-path' into maintLibravatar Junio C Hamano1-0/+15
* jc/maint-reset-unmerged-path: reset [<commit>] paths...: do not mishandle unmerged paths
2011-08-16Merge branch 'jc/submodule-sync-no-auto-vivify' into maintLibravatar Junio C Hamano1-2/+13
* jc/submodule-sync-no-auto-vivify: submodule add: always initialize .git/config entry submodule sync: do not auto-vivify uninteresting submodule
2011-08-16Merge branch 'bc/submodule-foreach-stdin-fix-1.7.4' into maintLibravatar Junio C Hamano1-0/+18
* bc/submodule-foreach-stdin-fix-1.7.4: git-submodule.sh: preserve stdin for the command spawned by foreach t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin
2011-08-16Merge branch 'aw/rebase-i-p' into maintLibravatar Junio C Hamano3-3/+29
* aw/rebase-i-p: rebase -i -p: include non-first-parent commits in todo list
2011-08-16Merge branch 'jk/combine-diff-binary-etc' into maintLibravatar Junio C Hamano1-0/+212
* jk/combine-diff-binary-etc: combine-diff: respect textconv attributes refactor get_textconv to not require diff_filespec combine-diff: handle binary files as binary combine-diff: calculate mode_differs earlier combine-diff: split header printing into its own function
2011-08-16revert: plug memory leak in "cherry-pick root commit" codepathLibravatar Jonathan Nieder1-1/+26
The empty tree passed as common ancestor to merge_trees() when cherry-picking a parentless commit is allocated on the heap and never freed. Leaking such a small one-time allocation is not a very big problem, but now that "git cherry-pick" can cherry-pick multiple commits it can start to add up. Avoid the leak by storing the fake tree exactly once in the BSS section (i.e., use a static). While at it, let's add a test to make sure cherry-picking multiple parentless commits continues to work. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-14fast-import: prevent producing bad deltaLibravatar Dmitry Ivankov1-1/+1
To produce deltas for tree objects fast-import tracks two versions of tree's entries - base and current one. Base version stands both for a delta base of this tree, and for a entry inside a delta base of a parent tree. So care should be taken to keep it in sync. tree_content_set cuts away a whole subtree and replaces it with a new one (or NULL for lazy load of a tree with known sha1). It keeps a base sha1 for this subtree (needed for parent tree). And here is the problem, 'subtree' tree root doesn't have the implied base version entries. Adjusting the subtree to include them would mean a deep rewrite of subtree. Invalidating the subtree base version would mean recursive invalidation of parents' base versions. So just mark this tree as do-not-delta me. Abuse setuid bit for this purpose. tree_content_replace is the same as tree_content_set except that is is used to replace the root, so just clearing base sha1 here (instead of setting the bit) is fine. [di: log message] Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-14fast-import: add a test for tree delta base corruptionLibravatar Dmitry Ivankov1-0/+41
fast-import is able to write imported tree objects in delta format. It holds a tree structure in memory where each tree entry may have a delta base sha1 assigned. When delta base data is needed it is reconstructed from this in-memory structure. Though sometimes the delta base data doesn't match the delta base sha1 so wrong or even corrupt pack is produced. Add a small test that produces a corrupt pack. It uses just tree copy and file modification commands aside from the very basic commit and blob commands. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11ls-files: fix pathspec display on errorLibravatar Clemens Buchacher1-0/+70
The following sequence of commands reveals an issue with error reporting of relative paths: $ mkdir sub $ cd sub $ git ls-files --error-unmatch ../bbbbb error: pathspec 'b' did not match any file(s) known to git. $ git commit --error-unmatch ../bbbbb error: pathspec 'b' did not match any file(s) known to git. This bug is visible only if the normalized path (i.e., the relative path from the repository root) is longer than the prefix. Otherwise, the code skips over the normalized path and reads from an unused memory location which still contains a leftover of the original command line argument. So instead, use the existing facilities to deal with relative paths correctly. Also fix inconsistency between "checkout" and "commit", e.g. $ cd Documentation $ git checkout nosuch.txt error: pathspec 'Documentation/nosuch.txt' did not match... $ git commit nosuch.txt error: pathspec 'nosuch.txt' did not match... by propagating the prefix down the codepath that reports the error. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11test: consolidate definition of $LFLibravatar Junio C Hamano5-9/+4
As we seem to need this variable that holds a single LF character in many places, define it in test-lib.sh and let the test scripts use it. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11Tolerate zlib deflation with window size < 32KbLibravatar Roberto Tyley18-0/+71
Git currently reports loose objects as 'corrupt' if they've been deflated using a window size less than 32Kb, because the experimental_loose_object() function doesn't recognise the header byte as a zlib header. This patch makes the function tolerant of all valid window sizes (15-bit to 8-bit) - but doesn't sacrifice it's accuracy in distingushing the standard loose-object format from the experimental (now abandoned) format. On memory constrained systems zlib may use a much smaller window size - working on Agit, I found that Android uses a 4KB window; giving a header byte of 0x48, not 0x78. Consequently all loose objects generated appear 'corrupt', which is why Agit is a read-only Git client at this time - I don't want my client to generate Git repos that other clients treat as broken :( This patch makes Git tolerant of different deflate settings - it might appear that it changes experimental_loose_object() to the point where it could incorrectly identify the experimental format as the standard one, but the two criteria (bitmask & checksum) can only give a false result for an experimental object where both of the following are true: 1) object size is exactly 8 bytes when uncompressed (bitmask) 2) [single-byte in-pack git type&size header] * 256 + [1st byte of the following zlib header] % 31 = 0 (checksum) As it happens, for all possible combinations of valid object type (1-4) and window bits (0-7), the only time when the checksum will be divisible by 31 is for 0x1838 - ie object type *1*, a Commit - which, due the fields all Commit objects must contain, could never be as small as 8 bytes in size. Given this, the combination of the two criteria (bitmask & checksum) always correctly determines the buffer format, and is more tolerant than the previous version. The alternative to this patch is simply removing support for the experimental format, which I am also totally cool with. References: Android uses a 4KB window for deflation: http://android.git.kernel.org/?p=platform/libcore.git;a=blob;f=luni/src/main/native/java_util_zip_Deflater.cpp;h=c0b2feff196e63a7b85d97cf9ae5bb2583409c28;hb=refs/heads/gingerbread#l53 Code snippet searching for false positives with the zlib checksum: https://gist.github.com/1118177 Signed-off-by: Roberto Tyley <roberto.tyley@guardian.co.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11am: ignore leading whitespace before patchLibravatar David Barr1-0/+18
Some web-based email clients prepend whitespace to raw message transcripts to workaround content-sniffing in some browsers. Adjust the patch format detection logic to ignore leading whitespace. So now you can apply patches from GMail with "git am" in three steps: 1. choose "show original" 2. tell the browser to "save as" (for example by pressing Ctrl+S) 3. run "git am" on the saved file This fixes a regression introduced by v1.6.4-rc0~15^2~2 (git-am foreign patch support: autodetect some patch formats, 2009-05-27). GMail support was first introduced to "git am" by v1.5.4-rc0~274^2 (Make mailsplit and mailinfo strip whitespace from the start of the input, 2007-11-01). Signed-off-by: David Barr <davidbarr@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11fsck: improve committer/author checkLibravatar Dmitry Ivankov1-3/+3
fsck allows a name with > character in it like "name> <email>". Also for "name email>" fsck says "missing space before email". More precisely, it seeks for a first '<', checks that ' ' preceeds it. Then seeks to '<' or '>' and checks that it is the '>'. Missing space is reported if either '<' is not found or it's not preceeded with ' '. Change it to following. Seek to '<' or '>', check that it is '<' and is preceeded with ' '. Seek to '<' or '>' and check that it is '>'. So now "name> <email>" is rejected as "bad name". More strict name check is the only change in what is accepted. Report 'missing space' only if '<' is found and is not preceeded with a space. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11fsck: add a few committer name testsLibravatar Dmitry Ivankov1-0/+36
fsck reports "missing space before <email>" for committer string equal to "name email>" or to "". It'd be nicer to say "missing email" for the second string and "name is bad" (has > in it) for the first one. Add a failing test for these messages. For "name> <email>" no error is reported. Looks like a bug, so add such a failing test." Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11fast-import: check committer name more strictlyLibravatar Dmitry Ivankov1-5/+5
The documentation declares following identity format: (<name> SP)? LT <email> GT where name is any string without LF and LT characters. But fast-import just accepts any string up to first GT instead of checking the whole format, and moreover just writes it as is to the commit object. git-fsck checks for [^<\n]* <[^<>\n]*> format. Note that the space is mandatory. And the space quirk is already handled via extending the string to the left when needed. Modify fast-import input identity format to a slightly stricter one - deny LF, LT and GT in both <name> and <email>. And check for it. This is stricter then git-fsck as fsck accepts "Name> <email>" currently, but soon fsck check will be adjusted likewise. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11fast-import: don't fail on omitted committer nameLibravatar Dmitry Ivankov1-1/+1
fast-import format declares 'committer_name SP' to be optional in 'committer_name SP LT email GT'. But for a (commit) object SP is obligatory while zero length committer_name is ok. git-fsck checks that SP is present, so fast-import must prepend it if the name SP part is omitted. It doesn't do so and thus for "LT email GT" ident it writes a bad object. Name cannot contain LT or GT, ident always comes after SP in fast-import. So if ident starts with LT reuse the SP as if a valid 'SP LT email GT' ident was passed. This fixes a ident parsing bug for a well-formed fast-import input. Though the parsing is still loose and can accept a ill-formed input. Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11fast-import: add input format testsLibravatar Dmitry Ivankov1-0/+99
Documentation/git-fast-import.txt says that git-fast-import is strict about it's input format. But committer/author field parsing is a bit loose. Invalid values can be unnoticed and written out to the commit, either with format-conforming input or with non-format-conforming one. Add one passing and one failing test for empty/absent committer name with well-formed input. And a failed test with unnoticed ill-formed input. Reported-by: SASAKI Suguru <sss.sonik@gmail.com> Signed-off-by: Dmitry Ivankov <divanorama@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11t3900: do not reference numbered arguments from the test scriptLibravatar Johannes Sixt1-2/+2
The call to test_expect_success is nested inside a function, whose arguments the test code wants to access. But it is not specified that any unexpanded $1, $2, $3, etc in the test code will access the surrounding function's arguments. Rather, they will access the arguments of the function that happens to eval the test code. In this case, the reference is intended to supply '-m message' to a call of 'git commit --squash'. Remove it because -m is optional and the test case does not check for it. There are tests in t7500 that check combinations of --squash and -m. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-11Merge branch 'jk/fast-export-quote-path'Libravatar Junio C Hamano1-1/+27
* jk/fast-export-quote-path: fast-export: quote paths in output
2011-08-11Merge branch 'rs/grep-function-context'Libravatar Junio C Hamano1-0/+14
* rs/grep-function-context: grep: long context options grep: add option to show whole function as context
2011-08-09bisect: add support for bisecting bare repositoriesLibravatar Jon Seymour1-0/+31
This enhances the support for bisecting history in bare repositories. The "git bisect" command no longer needs to be run inside a repository with a working tree; it defaults to --no-checkout when run in a bare repository. Two tests are included to demonstrate this behaviour. Suggested-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jon Seymour <jon.seymour@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>