summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2014-02-04t0060: add test for prefix_path on symlinks via absolute pathsLibravatar Martin Erik Werner1-0/+5
When symlinks in the working tree are manipulated using the absolute path, git dereferences them, and tries to manipulate the link target instead. This applies to most high-level commands but prefix_path is the common denominator for all of them. Add a known-breakage tests using the prefix_path function, which currently uses real_path, causing the dereference. Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> Reviewed-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-02-04t3004: add test for ls-files on symlinks via absolute pathsLibravatar Junio C Hamano1-0/+17
When symlinks in the working tree are manipulated using the absolute path, git dereferences them, and tries to manipulate the link target instead. This causes most high-level functions to misbehave when acting on symlinks given via absolute paths. For example $ git add /dir/repo/symlink attempts to add the target of the symlink rather than the symlink itself, which is usually not what the user intends to do. This is a regression introduced by 18e051a: setup: translate symlinks in filename when using absolute paths (which did not take symlinks inside the work tree into consideration). Add a known-breakage test using the ls-files function, checking both if the symlink leads to a target in the same directory, and a target in the above directory. Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com> Tested-by: Martin Erik Werner <martinerikwerner@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-01-13Merge branch 'mm/mv-file-to-no-such-dir-with-slash' into maintLibravatar Junio C Hamano1-0/+29
"git mv A B/", when B does not exist as a directory, should error out, but it didn't. * mm/mv-file-to-no-such-dir-with-slash: mv: let 'git mv file no-such-dir/' error out on Windows, too mv: let 'git mv file no-such-dir/' error out
2014-01-13Merge branch 'jk/rev-parse-double-dashes' into maintLibravatar Junio C Hamano1-0/+24
"git rev-parse <revs> -- <paths>" did not implement the usual disambiguation rules the commands in the "git log" family used in the same way. * jk/rev-parse-double-dashes: rev-parse: be more careful with munging arguments rev-parse: correctly diagnose revision errors before "--"
2014-01-13Merge branch 'jk/cat-file-regression-fix' into maintLibravatar Junio C Hamano1-0/+22
"git cat-file --batch=", an admittedly useless command, did not behave very well. * jk/cat-file-regression-fix: cat-file: handle --batch format with missing type/size cat-file: pass expand_data to print_object_or_die
2013-12-17Merge branch 'jk/two-way-merge-corner-case-fix' into maintLibravatar Junio C Hamano2-89/+104
"git am --abort" sometimes complained about not being able to write a tree with an 0{40} object in it. * jk/two-way-merge-corner-case-fix: t1005: add test for "read-tree --reset -u A B" t1005: reindent unpack-trees: fix "read-tree -u --reset A B" with conflicted index
2013-12-17Merge branch 'sb/sha1-loose-object-info-check-existence' into maintLibravatar Junio C Hamano1-0/+6
"git cat-file --batch-check=ok" did not check the existence of the named object. * sb/sha1-loose-object-info-check-existence: sha1_loose_object_info(): do not return success on missing object
2013-12-17Merge branch 'nd/magic-pathspec' into maintLibravatar Junio C Hamano1-0/+6
"git diff -- ':(icase)makefile'" was unnecessarily rejected at the command line parser. * nd/magic-pathspec: diff: restrict pathspec limitations to diff b/f case only
2013-12-12cat-file: handle --batch format with missing type/sizeLibravatar Jeff King1-0/+22
Commit 98e2092 taught cat-file to stream blobs with --batch, which requires that we look up the object type before loading it into memory. As a result, we now print the object header from information in sha1_object_info, and the actual contents from the read_sha1_file. We double-check that the information we printed in the header matches the content we are about to show. Later, commit 93d2a60 allowed custom header lines for --batch, and commit 5b08640 made type lookups optional. As a result, specifying a header line without the type or size means that we will not look up those items at all. This causes our double-checking to erroneously die with an error; we think the type or size has changed, when in fact it was simply left at "0". For the size, we can fix this by only doing the consistency double-check when we have retrieved the size via sha1_object_info. In the case that we have not retrieved the value, that means we also did not print it, so there is nothing for us to check that we are consistent with. We could do the same for the type. However, besides our consistency check, we also care about the type in deciding whether to stream or not. So instead of handling the case where we do not know the type, this patch instead makes sure that we always trigger a type lookup when we are printing, so that even a format without the type will stream as we would in the normal case. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-09rev-parse: correctly diagnose revision errors before "--"Libravatar Jeff King1-0/+24
Rev-parse understands that a "--" may separate revisions and filenames, and that anything after the "--" is taken as-is. However, it does not understand that anything before the token must be a revision (which is the usual rule implemented by the setup_revisions parser). Since rev-parse prefers revisions to files when parsing before the "--", we end up with the correct result (if such an argument is a revision, we parse it as one, and if it is not, it is an error either way). However, we misdiagnose the errors: $ git rev-parse foobar -- >/dev/null fatal: ambiguous argument 'foobar': unknown revision or path not in the working tree. Use '--' to separate paths from revisions, like this: 'git <command> [<revision>...] -- [<file>...]' $ >foobar $ git rev-parse foobar -- >/dev/null fatal: bad flag '--' used after filename In both cases, we should know that the real error is that "foobar" is meant to be a revision, but could not be resolved. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-04mv: let 'git mv file no-such-dir/' error outLibravatar Matthieu Moy1-0/+29
Git used to trim the trailing slash, and make the command equivalent to 'git mv file no-such-dir', which created the file no-such-dir (while the trailing slash explicitly stated that it could only be a directory). This patch skips the trailing slash removal for the destination path. The path with its trailing slash is passed to rename(2), which errors out with the appropriate message: $ git mv file no-such-dir/ fatal: renaming 'file' failed: Not a directory Original-patch-by: Duy Nguyen <pclouds@gmail.com> Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-02Sync with 1.8.4.5Libravatar Junio C Hamano1-0/+15
2013-12-02submodule: do not copy unknown update mode from .gitmodulesLibravatar Junio C Hamano1-0/+15
When submodule.$name.update is given as hint from the upstream in the .gitmodules file, we used to blindly copy it to .git/config, unless there already is a value defined for the submodule. However, there is no reason to expect that the update mode hinted by the upstream is available in the version of Git the user is using, and a really custom "!cmd" prepared by an upstream person running on Linux may not even be available to a user on Windows. It is simply irresponsible to copy the setting blindly and to attempt to use it during a later "submodule update" without validating it first. Just show the suggested value to the diagnostic output, and set the value to 'none' in the configuration, if it is not one of the ones that are known to be supported by this version of Git. Helped-by: Jens Lehmann <Jens.Lehmann@web.de> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-20diff: restrict pathspec limitations to diff b/f case onlyLibravatar Nguyễn Thái Ngọc Duy1-0/+6
builtin_diff_b_f() needs a path, not pathspec. Other modes in diff can deal with pathspec just fine. But because of the current GUARD_PATHSPEC() location, other modes also reject :(glob) and :(icase). Move GUARD_PATHSPEC(), and the "path" assignment statement, which is the reason of this GUARD_PATHSPEC(), inside builtin_diff_b_f(). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-18Merge branch 'nd/literal-pathspecs'Libravatar Junio C Hamano1-0/+7
Fixes a regression on 'master' since v1.8.4. * nd/literal-pathspecs: pathspec: stop --*-pathspecs impact on internal parse_pathspec() uses
2013-11-18Merge branch 'jx/branch-vv-always-compare-with-upstream'Libravatar Junio C Hamano1-11/+13
Hot-fix for a regression. * jx/branch-vv-always-compare-with-upstream: branch: fix --verbose output column alignment
2013-11-18branch: fix --verbose output column alignmentLibravatar Torstein Hegge1-11/+13
Commit f2e0873 (branch: report invalid tracking branch as gone) removed an early return from fill_tracking_info() in the path taken when 'git branch -v' lists a branch in sync with its upstream. This resulted in an unconditionally added space in front of the subject line: $ git branch -v * master f5eb3da commit pushed to upstream topic f935eb6 unpublished topic Instead, only add the trailing space if a decoration have been added. To catch this kind of whitespace breakage in the tests, be a bit less smart when filtering the output through sed. Signed-off-by: Torstein Hegge <hegge@resisty.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-08Merge branch 'jn/test-prereq-perl-doc' into maintLibravatar Junio C Hamano1-4/+11
The interaction between use of Perl in our test suite and NO_PERL has been clarified a bit. * jn/test-prereq-perl-doc: t/README: tests can use perl even with NO_PERL
2013-11-08Merge branch 'jc/upload-pack-send-symref' into maintLibravatar Junio C Hamano3-12/+17
One long-standing flaw in the pack transfer protocol used by "git clone" was that there was no way to tell the other end which branch "HEAD" points at, and the receiving end needed to guess. A new capability has been defined in the pack protocol to convey this information so that cloning from a repository with more than one branches pointing at the same commit where the HEAD is at now reliably sets the initial branch in the resulting repository. * jc/upload-pack-send-symref: t5570: Update for clone-progress-to-stderr branch t5570: Update for symref capability clone: test the new HEAD detection logic connect: annotate refs with their symref information in get_remote_head() connect.c: make parse_feature_value() static upload-pack: send non-HEAD symbolic refs upload-pack: send symbolic ref information as capability upload-pack.c: do not pass confusing cb_data to mark_our_ref() t5505: fix "set-head --auto with ambiguous HEAD" test
2013-11-08Merge branch 'jk/http-auth-redirects' into maintLibravatar Junio C Hamano3-1/+15
We did not handle cases where http transport gets redirected during the authorization request (e.g. from http:// to https://). * jk/http-auth-redirects: http.c: Spell the null pointer as NULL remote-curl: rewrite base url from info/refs redirects remote-curl: store url as a strbuf remote-curl: make refs_url a strbuf http: update base URLs when we see redirects http: provide effective url to callers http: hoist credential request out of handle_curl_result http: refactor options to http_get_* http_request: factor out curlinfo_strbuf http_get_file: style fixes
2013-11-07Merge branch 'mm/checkout-auto-track-fix' into maintLibravatar Junio C Hamano2-0/+27
"git checkout topic", when there is not yet a local "topic" branch but there is a unique remote-tracking branch for a remote "topic" branch, pretended as if "git checkout -t -b topic remote/$r/topic" (for that unique remote $r) was run. This hack however was not implemented for "git checkout topic --". * mm/checkout-auto-track-fix: checkout: proper error message on 'git checkout foo bar --' checkout: allow dwim for branch creation for "git checkout $branch --"
2013-11-07Merge branch 'jk/split-broken-ident' into maintLibravatar Junio C Hamano1-2/+7
The fall-back parsing of commit objects with broken author or committer lines were less robust than ideal in picking up the timestamps. * jk/split-broken-ident: split_ident: parse timestamp from end of line
2013-11-07Merge branch 'jc/revision-range-unpeel' into maintLibravatar Junio C Hamano1-0/+8
"git rev-list --objects ^v1.0^ v1.0" gave v1.0 tag itself in the output, but "git rev-list --objects v1.0^..v1.0" did not. * jc/revision-range-unpeel: revision: do not peel tags used in range notation
2013-11-06Merge branch 'fc/trivial'Libravatar Junio C Hamano4-4/+4
A random collection of style fixes and minor doc updates. * fc/trivial: setup: trivial style fixes run-command: trivial style fixes diff: trivial style fix revision: trivial style fixes pretty: trivial style fix describe: trivial style fixes transport-helper: trivial style fix sha1-name: trivial style cleanup branch: trivial style fix revision: add missing include doc/pull: clarify the illustrations t: replace pulls with merges merge: simplify ff-only option
2013-11-06sha1_loose_object_info(): do not return success on missing objectLibravatar Junio C Hamano1-0/+6
Since 052fe5ea (sha1_loose_object_info: make type lookup optional, 2013-07-12), sha1_loose_object_info() returns happily without checking if the object in question exists, which is not what the the caller sha1_object_info_extended() expects; the caller does not even bother checking the existence of the object itself. Noticed-by: Sven Brauch <svenbrauch@googlemail.com> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-04Merge branch 'bw/solaris-sed-tr-test-portability'Libravatar Junio C Hamano2-14/+21
* bw/solaris-sed-tr-test-portability: t4015: simplify sed command that is not even seen by sed Avoid difference in tr semantics between System V and BSD Change sed i\ usage to something Solaris' sed can handle
2013-11-04Merge branch 'jk/duplicate-objects-in-packs'Libravatar Junio C Hamano1-4/+4
Test fixup to a topic recently graduated. * jk/duplicate-objects-in-packs: Fix '\%o' for printf from coreutils
2013-11-04Merge branch 'jk/wrap-perl-used-in-tests'Libravatar Junio C Hamano29-54/+62
* jk/wrap-perl-used-in-tests: t: use perl instead of "$PERL_PATH" where applicable t: provide a perl() function which uses $PERL_PATH
2013-11-04Merge branch 'jn/test-prereq-perl-doc'Libravatar Junio C Hamano1-4/+11
* jn/test-prereq-perl-doc: t/README: tests can use perl even with NO_PERL
2013-11-04t1005: add test for "read-tree --reset -u A B"Libravatar Junio C Hamano1-0/+15
With a conflicted index, this used to give us an error. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-04t1005: reindentLibravatar Junio C Hamano2-89/+89
Just to update the style of this ancient test script to match our house style. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-04t4015: simplify sed command that is not even seen by sedLibravatar Junio C Hamano1-1/+0
Noticed by Andreas Schwab; \<LF> inside a double quotes pair is eaten by the shell to become an empty string and is not doing anything. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-11-01Merge branch 'js/tests-windows-port-fix'Libravatar Junio C Hamano6-14/+72
* js/tests-windows-port-fix: tests: undo special treatment of CRLF for Windows Windows: a test_cmp that is agnostic to random LF <> CRLF conversions t5300-pack-object: do not compare binary data using test_cmp
2013-11-01Merge branch 'js/test-help-format-windows-port-fix'Libravatar Junio C Hamano1-1/+1
* js/test-help-format-windows-port-fix: t3200: do not open a HTML manual page when DEFAULT_MAN_FORMAT is html
2013-11-01Merge branch 'jk/reset-p-current-head-fix'Libravatar Junio C Hamano2-6/+9
"git reset -p HEAD" has codepath to special case it from resetting to contents of other commits, but recent change broke it. * jk/reset-p-current-head-fix: reset: pass real rev name to add--interactive add-interactive: handle unborn branch in patch mode
2013-11-01Merge branch 'jk/for-each-ref-skip-parsing'Libravatar Junio C Hamano1-0/+4
* jk/for-each-ref-skip-parsing: for-each-ref: avoid loading objects to print %(objectname)
2013-11-01Merge branch 'jl/submodule-mv'Libravatar Junio C Hamano1-0/+26
Moving a regular file in a repository with a .gitmodules file was producing a warning 'Could not find section in .gitmodules where path=<filename>'. * jl/submodule-mv: mv: Fix spurious warning when moving a file in presence of submodules
2013-10-31t: replace pulls with mergesLibravatar Felipe Contreras4-4/+4
This is what the code intended. No functional changes. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-31Fix '\%o' for printf from coreutilsLibravatar Kacper Kornet1-4/+4
The printf utility provided by coreutils when interpreting '\%o' format does not recognize %o as formatting directive. For example printf '\%o 0 returns \%o and warning: ignoring excess arguments, starting with ‘0’, which results in failed tests in t5309-pack-delta-cycles.sh. In most shells the test ends with success as the printf is a builtin utility. Fix it by using '\\%o' which is interpreted consistently in all versions of printf. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-30t3200: do not open a HTML manual page when DEFAULT_MAN_FORMAT is htmlLibravatar Johannes Sixt1-1/+1
We have the build configuration option DEFAULT_MAN_FORMAT to choose a format different from man pages to be used by 'git help' when no format is requested explicitly. Since 65db0443 (Set the default help format to html for msys builds, 2013-06-04) we use html on Windows by default. There is one test in t3200-branch.sh that invokes a help page. The intent of the redirections applied to the command invocation is to avoid that the man page viewer interferes with the automated test. But when the default format is not "man", this does not have the intended effect, and the HTML manual page is opened during the test run. Request "man" format explicitly to keep the test silent. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-30Merge branch 'tr/valgrind-test-fix'Libravatar Junio C Hamano1-99/+34
* tr/valgrind-test-fix: Revert "test-lib: allow prefixing a custom string before "ok N" etc." Revert "test-lib: support running tests under valgrind in parallel"
2013-10-30Merge branch 'nd/magic-pathspec'Libravatar Junio C Hamano1-0/+15
All callers to parse_pathspec() must choose between getting no pathspec or one path that is limited to the current directory when there is no paths given on the command line, but there were two callers that violated this rule, triggering a BUG(). * nd/magic-pathspec: Fix calling parse_pathspec with no paths nor PATHSPEC_PREFER_* flags
2013-10-30Merge branch 'nd/gc-lock-against-each-other'Libravatar Junio C Hamano1-0/+5
* nd/gc-lock-against-each-other: gc: remove gc.pid file at end of execution
2013-10-30Merge branch 'mm/checkout-auto-track-fix'Libravatar Junio C Hamano2-0/+27
"git checkout topic", when there is not yet a local "topic" branch but there is a unique remote-tracking branch for a remote "topic" branch, pretended as if "git checkout -t -b topic remote/$r/topic" (for that unique remote $r) was run. This hack however was not implemented for "git checkout topic --". * mm/checkout-auto-track-fix: checkout: proper error message on 'git checkout foo bar --' checkout: allow dwim for branch creation for "git checkout $branch --"
2013-10-30Merge branch 'sg/t3600-nul-sha1-fix'Libravatar Junio C Hamano1-7/+4
* sg/t3600-nul-sha1-fix: t3600: fix broken "choking git rm" test
2013-10-30Merge branch 'jc/upload-pack-send-symref'Libravatar Junio C Hamano3-14/+18
One long-standing flaw in the pack transfer protocol used by "git clone" was that there was no way to tell the other end which branch "HEAD" points at, and the receiving end needed to guess. A new capability has been defined in the pack protocol to convey this information so that cloning from a repository with more than one branches pointing at the same commit where the HEAD is at now reliably sets the initial branch in the resulting repository. * jc/upload-pack-send-symref: t5570: Update for clone-progress-to-stderr branch t5570: Update for symref capability clone: test the new HEAD detection logic connect: annotate refs with their symref information in get_remote_head() connect.c: make parse_feature_value() static upload-pack: send non-HEAD symbolic refs upload-pack: send symbolic ref information as capability upload-pack.c: do not pass confusing cb_data to mark_our_ref() t5505: fix "set-head --auto with ambiguous HEAD" test
2013-10-30Merge branch 'jk/http-auth-redirects'Libravatar Junio C Hamano3-1/+15
Handle the case where http transport gets redirected during the authorization request better. * jk/http-auth-redirects: http.c: Spell the null pointer as NULL remote-curl: rewrite base url from info/refs redirects remote-curl: store url as a strbuf remote-curl: make refs_url a strbuf http: update base URLs when we see redirects http: provide effective url to callers http: hoist credential request out of handle_curl_result http: refactor options to http_get_* http_request: factor out curlinfo_strbuf http_get_file: style fixes
2013-10-30t5570: Update for clone-progress-to-stderr branchLibravatar Brian Gernhardt1-2/+1
git clone now reports its progress to standard error, which throws off t5570. Using test_i18ngrep instead of test_cmp allows the test to be more flexible by only looking for the expected error and ignoring any other output from the program. Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-30Avoid difference in tr semantics between System V and BSDLibravatar Ben Walton1-12/+18
Solaris' tr (both /usr/bin/ and /usr/xpg4/bin) uses the System V semantics for tr whereby string1's length is truncated to the length of string2 if string2 is shorter. The BSD semantics, as used by GNU tr see string2 padded to the length of string1 using the final character in string2. POSIX explicitly doesn't specify the correct behavior here, making both equally valid. This difference means that Solaris' native tr implementations produce different results for tr ":\t\n" "\0" than GNU tr. This breaks a few tests in t0008-ignores.sh. Possible fixes for this are to make string2 be "\0\0\0" or "[\0*]". Instead, use perl to perform these transliterations which means we don't need to worry about the difference at all. Since we're replacing tr with perl, we also use perl to replace the sed invocations used to transform the files. Replace four identical transforms with a function named broken_c_unquote. Replace the other two identical transforms with a fuction named broken_c_unquote_verbose. Signed-off-by: Ben Walton <bdwalton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-10-30for-each-ref: avoid loading objects to print %(objectname)Libravatar Jeff King1-0/+4
If you ask for-each-ref to print each ref and its object, like: git for-each-ref --format='%(objectname) %(refname)' this should involve little more work than looking at the ref files (and packed-refs) themselves. However, for-each-ref will actually load each object from disk just to print its sha1. For most repositories, this isn't a big deal, but it can be noticeable if you have a large number of refs to print. Here are best-of-five timings for the command above on a repo with ~10K refs: [before] real 0m0.112s user 0m0.092s sys 0m0.016s [after] real 0m0.014s user 0m0.012s sys 0m0.000s This patch checks for %(objectname) and %(objectname:short) before we actually parse the object (and the rest of the code is smart enough to avoid parsing if we have filled all of our placeholders). Note that we can't simply move the objectname parsing code into the early loop. If the "deref" form %(*objectname) is used, then we do need to parse the object in order to peel the tag. So instead of moving the code, we factor it out into a separate function that can be called for both cases. While we're at it, we add some basic tests for the dereferenced placeholders, which were not tested at all before. This helps ensure we didn't regress that case. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>