summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2018-01-25daemon: fix length computation in newline strippingLibravatar Jeff King2-4/+17
When git-daemon gets a pktline request, we strip off any trailing newline, replacing it with a NUL. Clients prior to 5ad312bede (in git v1.4.0) would send: git-upload-pack repo.git\n and we need to strip it off to understand their request. After 5ad312bede, we send the host attribute but no newline, like: git-upload-pack repo.git\0host=example.com\0 Both of these are parsed correctly by git-daemon. But if some client were to combine the two: git-upload-pack repo.git\n\0host=example.com\0 we don't parse it correctly. The problem is that we use the "len" variable to record the position of the NUL separator, but then decrement it when we strip the newline. So we start with: git-upload-pack repo.git\n\0host=example.com\0 ^-- len and end up with: git-upload-pack repo.git\0\0host=example.com\0 ^-- len This is arguably correct, since "len" tells us the length of the initial string, but we don't actually use it for that. What we do use it for is finding the offset of the extended attributes; they used to be at len+1, but are now at len+2. We can solve that by just leaving "len" where it is. We don't have to care about the length of the shortened string, since we just treat it like a C string. No version of Git ever produced such a string, but it seems like the daemon code meant to handle this case (and it seems like a reasonable thing for somebody to do in a 3rd-party implementation). Reported-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-25t/lib-git-daemon: add network-protocol helpersLibravatar Jeff King2-1/+58
All of our git-protocol tests rely on invoking the client and having it make a request of a server. That gives a nice real-world test of how the two behave together, but it doesn't leave any room for testing how a server might react to _other_ clients. Let's add a few test helper functions which can be used to manually conduct a git-protocol conversation with a remote git-daemon: 1. To connect to a remote git-daemon, we need something like "netcat". But not everybody will have netcat. And even if they do, the behavior with respect to half-duplex shutdowns is not portable (openbsd netcat has "-N", with others you must rely on "-q 1", which is racy). Here we provide a "fake_nc" that is capable of doing a client-side netcat, with sane half-duplex semantics. It relies on perl's IO::Socket::INET. That's been in the base distribution since 5.6.0, so it's probably available everywhere. But just to be on the safe side, we'll add a prereq. 2. To help tests speak and read pktline, this patch adds packetize() and depacketize() functions. I've put fake_nc() into lib-git-daemon.sh, since that's really the only server where we'd need to use a network socket. Whereas the pktline helpers may be of more general use, so I've added them to test-lib-functions.sh. Programs like upload-pack speak pktline, but can talk directly over stdio without a network socket. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-25daemon: handle NULs in extended attribute stringLibravatar Jeff King2-8/+9
If we receive a request with extended attributes after the NUL, we try to write those attributes to the log. We do so with a "%s" format specifier, which will only show characters up to the first NUL. That's enough for printing a "host=" specifier. But since dfe422d04d (daemon: recognize hidden request arguments, 2017-10-16) we may have another NUL, followed by protocol parameters, and those are not logged at all. Let's cut out the attempt to show the whole string, and instead log when we parse individual attributes. We could leave the "extended attributes (%d bytes) exist" part of the log, which in theory could alert us to attributes that fail to parse. But anything we don't parse as a "host=" parameter gets blindly added to the "protocol" attribute, so we'd see it in that part of the log. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-25daemon: fix off-by-one in logging extended attributesLibravatar Jeff King2-2/+13
If receive a request like: git-upload-pack /foo.git\0host=localhost we mark the offset of the NUL byte as "len", and then log the bytes after the NUL with a "%.*s" placeholder, using "pktlen - len" as the length, and "line + len + 1" as the start of the string. This is off-by-one, since the start of the string skips past the separating NUL byte, but the adjusted length includes it. Fortunately this doesn't actually read past the end of the buffer, since "%.*s" will stop when it hits a NUL. And regardless of what is in the buffer, packet_read() will always add an extra NUL terminator for safety. As an aside, the git.git client sends an extra NUL after a "host" field, too, so we'd generally hit that one first, not the one added by packet_read(). You can see this in the test output which reports 15 bytes, even though the string has only 14 bytes of visible data. But the point is that even a client sending unusual data could not get us to read past the end of the buffer, so this is purely a cosmetic fix. Reported-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-25t/lib-git-daemon: record daemon logLibravatar Jeff King1-4/+12
When we start git-daemon for our tests, we send its stderr log stream to a named pipe. We synchronously read the first line to make sure that the daemon started, and then dump the rest to descriptor 4. This is handy for debugging test output with "--verbose", but the tests themselves can't access the log data. Let's dump the log into a file, as well, so that future tests can check the log. There are a few subtleties worth calling out here: - we'll continue to send output to descriptor 4 for viewing/debugging, which would imply swapping out "cat" for "tee". But we want to ensure that there's no buffering, and "tee" doesn't have a standard way to ask for that. So we'll use a shell loop around "read" and "printf" instead. That ensures that after a request has been served, the matching log entries will have made it to the file. - the existing first-line shell loop used read/echo. We'll switch to consistently using "read -r" and "printf" to relay data as faithfully as possible. - we open the logfile for append, rather than just output. That makes it OK for tests to truncate the logfile without restarting the daemon (the OS will atomically seek to the end of the file when outputting each line). That allows tests to look at the log without worrying about pollution from earlier tests. Helped-by: Lucas Werkmeister <mail@lucaswerkmeister.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-25t5570: use ls-remote instead of clone for interp testsLibravatar Jeff King1-6/+3
We don't actually care about the clone operation here; we just want to know if we were able to actually contact the remote repository. Using ls-remote does that more efficiently, and without us having to worry about managing the tmp.git directory. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-21Git 2.16.1Libravatar Junio C Hamano3-2/+13
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-21Merge branch 'bc/hash-algo' into maintLibravatar Junio C Hamano2-1/+18
* bc/hash-algo: t5601-clone: test case-conflicting files on case-insensitive filesystem repository: pre-initialize hash algo pointer
2018-01-21t5601-clone: test case-conflicting files on case-insensitive filesystemLibravatar Eric Sunshine1-0/+17
A recently introduced regression caused a segfault at clone time on case-insensitive filesystems when filenames differing only in case are present. This bug has already been fixed (repository: pre-initialize hash algo pointer, 2018-01-18), but it's not the first time similar problems have arisen. Therefore, introduce a test to catch this case and protect against future regressions. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19repository: pre-initialize hash algo pointerLibravatar brian m. carlson1-1/+1
There are various git subcommands (among them, clone) which don't set up the repository (that is, they lack RUN_SETUP or RUN_SETUP_GENTLY) but end up needing to have information about the hash algorithm in use. Because the hash algorithm is part of struct repository and it's only initialized in repository setup, we can end up dereferencing a NULL pointer in some cases if we call one of these subcommands and look up the empty blob or empty tree values. A "git clone" of a project that has two paths that differ only in case suffers from this if it is run on a case insensitive platform. When the command attempts to check out one of these two paths after checking out the other one, the checkout codepath needs to see if the version that is already on the filesystem (which should not happen if the FS were case sensitive) is dirty, and it needs to exercise the hashing code at that point. In the future, we can add a command line option for this or read it from the configuration, but until we're ready to expose that functionality to the user, simply initialize the repository structure to use the current hash algorithm, SHA-1. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-17Git 2.16Libravatar Junio C Hamano2-3/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-16Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano12-20028/+22202
l10n for Git 2.16.0 round 2 * tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po: (24 commits) l10n: de.po: translate 72 new messages l10n: de.po: improve messages when a branch starts to track another ref l10n: bg.po: Updated Bulgarian translation (3288t) l10n: TEAMS: add zh_CN team members l10n: zh_CN: for git v2.16.0 l10n round 2 l10n: sv.po: Update Swedish translation (3288t0f0u) l10n: ru.po: update Russian translation l10n: TEAMS: Add ko team members l10n: ko.po: Update Korean translation l10n: fr.po 2.16 round 2 l10n: es.po: Spanish translation 2.16.0 round 2 l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2 l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed) l10n: es.po: Update Spanish Translation v2.16.0 l10n: fr.po v2.16.0 round 1 l10n: bg.po: Updated Bulgarian translation (3284t) l10n: sv.po: Update Swedish translation (3284t0f0u) l10n: fr.po: "worktree list" mistranslated as prune l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed) l10n: fixes to German translation ...
2018-01-15l10n: de.po: translate 72 new messagesLibravatar Ralf Thielow1-1934/+2172
Translate 72 new messages came from git.pot update in 18a907225 (l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)) and 005c62fe4 (l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
2018-01-15l10n: de.po: improve messages when a branch starts to track another refLibravatar Ralf Thielow1-8/+8
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2018-01-12RelNotes: minor typofixLibravatar SZEDER Gábor1-1/+1
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-11Git 2.16-rc2Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-11Merge branch 'jh/object-filtering'Libravatar Junio C Hamano1-1/+1
Hotfix for a topic already in 'master'. * jh/object-filtering: oidset: don't return value from oidset_init
2018-01-11Merge branch 'tg/worktree-create-tracking'Libravatar Junio C Hamano1-1/+1
Doc hotfix. * tg/worktree-create-tracking: Documentation/git-worktree.txt: add missing `
2018-01-11Merge branch 'js/test-with-ws-in-path'Libravatar Junio C Hamano1-4/+4
Hot fix to a test. * js/test-with-ws-in-path: t3900: add some more quotes
2018-01-11l10n: bg.po: Updated Bulgarian translation (3288t)Libravatar Alexander Shopov1-181/+203
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2018-01-11Documentation/git-worktree.txt: add missing `Libravatar Ralf Thielow1-1/+1
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10t3900: add some more quotesLibravatar Beat Bolli1-4/+4
In 89a70b80 ("t0302 & t3900: add forgotten quotes", 2018-01-03), quotes were added to protect against spaces in $HOME. In the test_when_finished command, two files are deleted which must be quoted individually. [jc: with \$HOME in the test_when_finished command quoted, as pointed out by j6t]. Signed-off-by: Beat Bolli <dev+git@drbeat.li> Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10RelNotes update before -rc2Libravatar Junio C Hamano1-0/+10
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10Merge branch 'js/perl-path-workaround-in-tests'Libravatar Junio C Hamano1-1/+16
* js/perl-path-workaround-in-tests: mingw: handle GITPERLLIB in t0021 in a Windows-compatible way
2018-01-10Merge branch 'ew/empty-merge-with-dirty-index'Libravatar Junio C Hamano2-1/+51
"git merge -s recursive" did not correctly abort when the index is dirty, if the merged tree happened to be the same as the current HEAD, which has been fixed. * ew/empty-merge-with-dirty-index: merge-recursive: do not look at the index during recursive merge
2018-01-10Merge branch 'ma/bisect-leakfix'Libravatar Junio C Hamano1-2/+4
A hotfix for a recent update that broke 'git bisect'. * ma/bisect-leakfix: bisect: fix a regression causing a segfault
2018-01-10Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'Libravatar Junio C Hamano2-3/+20
"git rebase -p -X<option>" did not propagate the option properly down to underlying merge strategy backend. * js/fix-merge-arg-quoting-in-rebase-p: rebase -p: fix quoting when calling `git merge`
2018-01-10mingw: handle GITPERLLIB in t0021 in a Windows-compatible wayLibravatar Johannes Schindelin1-1/+16
Git's assumption that all path lists are colon-separated is not only wrong on Windows, it is not even an assumption that is compatible with POSIX. In the interest of time, let's not try to fix this properly but simply work around the obvious breakage on Windows, where the MSYS2 Bash used by Git for Windows to interpret the Git's Unix shell scripts will automagically convert path lists in the environment to semicolon-separated lists of Windows paths (with drive letter and the corresponding colon and all that jazz). In other words, we simply look whether there is a semicolon in GITPERLLIB and split by semicolons if found instead of colons. This is not fool-proof, of course, as the path list could consist of a single path. But that is not the case in Git for Windows' test suite, there are always two paths in GITPERLLIB. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10l10n: TEAMS: add zh_CN team membersLibravatar Jiang Xin1-0/+1
Add Fangyi Zhou to zh_CN l10n team members. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2018-01-10l10n: zh_CN: for git v2.16.0 l10n round 2Libravatar Jiang Xin1-1920/+2144
Translate 72 messages (3288t0f0u) for git v2.16.0-rc1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: 依云 <lilydjwg@gmail.com> Reviewed-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
2018-01-10Merge branch 'master' of git://github.com/nafmo/git-l10n-svLibravatar Jiang Xin1-181/+197
* 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (3288t0f0u)
2018-01-10Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruLibravatar Jiang Xin1-1918/+2092
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
2018-01-09Merge branch 'jk/doc-diff-options'Libravatar Junio C Hamano1-0/+6
Doc update. * jk/doc-diff-options: docs/diff-options: clarify scope of diff-filter types
2018-01-09Merge branch 'bw/protocol-v1'Libravatar Junio C Hamano1-6/+4
Test fix for a topic already in 'master'. * bw/protocol-v1: http: fix v1 protocol tests with apache httpd < 2.4
2018-01-09Merge branch 'sg/travis-check-untracked'Libravatar Junio C Hamano4-2/+22
* sg/travis-check-untracked: travis-ci: check that all build artifacts are .gitignore-d travis-ci: don't store P4 and Git LFS in the working tree
2018-01-09Merge branch 'js/test-with-ws-in-path'Libravatar Junio C Hamano5-10/+10
Test fixes. * js/test-with-ws-in-path: t0302 & t3900: add forgotten quotes Allow the test suite to pass in a directory whose name contains spaces
2018-01-09Merge branch 'bc/submitting-patches-in-asciidoc'Libravatar Junio C Hamano1-1/+1
Doc readability update. * bc/submitting-patches-in-asciidoc: doc/SubmittingPatches: improve text formatting
2018-01-09Merge branch 'sg/travis-skip-identical-test'Libravatar Junio C Hamano6-2/+60
Avoid repeatedly testing the same tree in TravisCI that have been tested successfully already. * sg/travis-skip-identical-test: travis-ci: record and skip successfully built trees travis-ci: create the cache directory early in the build process travis-ci: print the "tip of branch is exactly at tag" message in color
2018-01-09Merge branch 'ab/dc-sha1-loose-ends'Libravatar Junio C Hamano2-3/+0
Tying loose ends for the recent integration work of collision-detecting SHA-1 implementation. * ab/dc-sha1-loose-ends: Makefile: NO_OPENSSL=1 should no longer imply BLK_SHA1=1
2018-01-09Merge branch 'sg/travis-fixes'Libravatar Junio C Hamano6-1/+22
Assorted updates for TravisCI integration. * sg/travis-fixes: travis-ci: only print test failures if there are test results available travis-ci: save prove state for the 32 bit Linux build travis-ci: don't install default addon packages for the 32 bit Linux build travis-ci: fine tune the use of 'set -x' in 'ci/*' scripts
2018-01-09l10n: sv.po: Update Swedish translation (3288t0f0u)Libravatar Peter Krefting1-181/+197
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2018-01-09Merge branch 'js/misc-git-gui-stuff' of ../git-guiLibravatar Junio C Hamano2-1/+27
* 'js/misc-git-gui-stuff' of ../git-gui: git-gui: allow Ctrl+T to toggle multiple paths git-gui: fix exception when trying to stage with empty file list git-gui: avoid exception upon Ctrl+T in an empty list git gui: fix staging a second line to a 1-line file
2018-01-09git-gui: allow Ctrl+T to toggle multiple pathsLibravatar Johannes Schindelin1-0/+13
It is possible to select multiple files in the "Unstaged Changes" and the "Staged Changes" lists. But when hitting Ctrl+T, surprisingly only one entry is handled, not all selected ones. Let's just use the same code path as for the "Stage To Commit" and the "Unstage From Commit" menu items. This fixes https://github.com/git-for-windows/git/issues/1012 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-09git-gui: fix exception when trying to stage with empty file listLibravatar Johannes Schindelin1-2/+10
If there is nothing to stage, there is nothing to stage. Let's not try to, even if the file list contains nothing at all. This fixes https://github.com/git-for-windows/git/issues/1075 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-09git-gui: avoid exception upon Ctrl+T in an empty listLibravatar Johannes Schindelin1-0/+4
Previously unstaged files can be staged by clicking on them and then pressing Ctrl+T. Conveniently, the next unstaged file is selected automatically so that the unstaged files can be staged by repeatedly pressing Ctrl+T. When a user hits Ctrl+T one time too many, though, Git GUI used to throw this exception: expected number but got "" expected number but got "" while executing "expr {int([lindex [$w tag ranges in_diff] 0])}" (procedure "toggle_or_diff" line 13) invoked from within "toggle_or_diff toggle .vpane.files.workdir.list " (command bound to event) Let's just avoid that by skipping the operation when there are no more files to stage. This fixes https://github.com/git-for-windows/git/issues/1060 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-09git gui: fix staging a second line to a 1-line fileLibravatar Johannes Schindelin1-0/+1
When a 1-line file is augmented by a second line, and the user tries to stage that single line via the "Stage Line" context menu item, we do not want to see "apply: corrupt patch at line 5". The reason for this error was that the hunk header looks like this: @@ -1 +1,2 @@ but the existing code expects the original range always to contain a comma. This problem is easily fixed by cutting the string "1 +1,2" (that Git GUI formerly mistook for the starting line) at the space. This fixes https://github.com/git-for-windows/git/issues/515 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-09Merge branch 'ew/empty-merge-with-dirty-index-maint' into ↵Libravatar Junio C Hamano2-1/+51
ew/empty-merge-with-dirty-index * ew/empty-merge-with-dirty-index-maint: merge-recursive: do not look at the index during recursive merge
2018-01-09merge-recursive: do not look at the index during recursive mergeLibravatar Junio C Hamano2-1/+51
When merging another branch into ours, if their tree is the same as the common ancestor's, we can declare that our tree represents the result of three-way merge. In such a case, the recursive merge backend incorrectly used to create a commit out of our index, even when the index has changes. A recent fix attempted to prevent this by adding a comparison between "our" tree and the index, but forgot that this check must be restricted only to the outermost merge. Inner merges performed by the recursive backend across merge bases are by definition made from scratch without having any local changes added to the index. The call to index_has_changes() during an inner merge is working on the index that has no relation to the merge being performed, preventing legitimate merges from getting carried out. Fix it by limiting the check to the outermost merge. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-09l10n: ru.po: update Russian translationLibravatar Dimitriy Ryazantcev1-1918/+2092
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2018-01-09l10n: TEAMS: Add ko team membersLibravatar Changwoo Ryu1-0/+2
Add Gwan-gyeong Mun and Sihyeon Jang. Signed-off-by: Changwoo Ryu <cwryu@debian.org>