summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-07-01archive-tar: drop return valueLibravatar Jeff King1-7/+4
We never do any error checks, and so never return anything but "0". Let's just drop this to simplify the code. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01archive-tar: write extended headers for far-future mtimeLibravatar Jeff King2-5/+18
The ustar format represents timestamps as seconds since the epoch, but only has room to store 11 octal digits. To express anything larger, we need to use an extended header. This is exactly the same case we fixed for the size field in the previous commit, and the solution here follows the same pattern. This is even mentioned as an issue in f2f0267 (archive-tar: use xsnprintf for trivial formatting, 2015-09-24), but since it only affected things far in the future, it wasn't deemed worth dealing with. But note that my calculations claiming thousands of years were off there; because our xsnprintf produces a NUL byte, we only have until the year 2242 to fix this. Given that this is just around the corner (geologically speaking, anyway), and because it's easy to fix, let's just make it work. Unlike the previous fix for "size", where we had to write an individual extended header for each file, we can write one global header (since we have only one mtime for the whole archive). There's a slight bit of trickiness there. We may already be writing a global header with a "comment" field for the commit sha1. So we need to write our new field into the same header. To do this, we push the decision of whether to write such a header down into write_global_extended_header(), which will now assemble the header as it sees fit, and will return early if we have nothing to write (in practice, we'll only have a large mtime if it comes from a commit, but this makes it also work if you set your system clock ahead such that time() returns a huge value). Note that we don't (and never did) handle negative timestamps (i.e., before 1970). This would probably not be too hard to support in the same way, but since git does not support negative timestamps at all, I didn't bother here. After writing the extended header, we munge the timestamp in the ustar headers to the maximum-allowable size. This is wrong, but it's the least-wrong thing we can provide to a tar implementation that doesn't understand pax headers (it's also what GNU tar does). Helped-by: René Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01archive-tar: write extended headers for file sizes >= 8GBLibravatar Jeff King2-4/+31
The ustar format has a fixed-length field for the size of each file entry which is supposed to contain up to 11 bytes of octal-formatted data plus a NUL or space terminator. These means that the largest size we can represent is 077777777777, or 1 byte short of 8GB. The correct solution for a larger file, according to POSIX.1-2001, is to add an extended pax header, similar to how we handle long filenames. This patch does that, and writes zero for the size field in the ustar header (the last bit is not mentioned by POSIX, but it matches how GNU tar behaves with --format=pax). This should be a strict improvement over the current behavior, which is to die in xsnprintf with a "BUG". However, there's some interesting history here. Prior to f2f0267 (archive-tar: use xsnprintf for trivial formatting, 2015-09-24), we silently overflowed the "size" field. The extra bytes ended up in the "mtime" field of the header, which was then immediately written itself, overwriting our extra bytes. What that means depends on how many bytes we wrote. If the size was 64GB or greater, then we actually overflowed digits into the mtime field, meaning our value was effectively right-shifted by those lost octal digits. And this patch is again a strict improvement over that. But if the size was between 8GB and 64GB, then our 12-byte field held all of the actual digits, and only our NUL terminator overflowed. According to POSIX, there should be a NUL or space at the end of the field. However, GNU tar seems to be lenient here, and will correctly parse a size up 64GB (minus one) from the field. So sizes in this range might have just worked, depending on the implementation reading the tarfile. This patch is mostly still an improvement there, as the 8GB limit is specifically mentioned in POSIX as the correct limit. But it's possible that it could be a regression (versus the pre-f2f0267 state) if all of the following are true: 1. You have a file between 8GB and 64GB. 2. Your tar implementation _doesn't_ know about pax extended headers. 3. Your tar implementation _does_ parse 12-byte sizes from the ustar header without a delimiter. It's probably not worth worrying about such an obscure set of conditions, but I'm documenting it here just in case. Helped-by: René Scharfe <l.s.r@web.de> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01t5000: test tar files that overflow ustar headersLibravatar Jeff King3-0/+74
The ustar format only has room for 11 (or 12, depending on some implementations) octal digits for the size and mtime of each file. For values larger than this, we have to add pax extended headers to specify the real data, and git does not yet know how to do so. Before fixing that, let's start off with some test infrastructure, as designing portable and efficient tests for this is non-trivial. We want to use the system tar to check our output (because what we really care about is interoperability), but we can't rely on it: 1. being able to read pax headers 2. being able to handle huge sizes or mtimes 3. supporting a "t" format we can parse So as a prerequisite, we can feed the system tar a reference tarball to make sure it can handle these features. The reference tar here was created with: dd if=/dev/zero seek=64G bs=1 count=1 of=huge touch -d @68719476737 huge tar cf - --format=pax | head -c 2048 using GNU tar. Note that this is not a complete tarfile, but it's enough to contain the headers we want to examine. Likewise, we need to convince git that it has a 64GB blob to output. Running "git add" on that 64GB file takes many minutes of CPU, and even compressed, the result is 64MB. So again, I pre-generated that loose object, and then took only the first 2k of it. That should be enough to generate 2MB of data before hitting an inflate error, which is plenty for us to generate the tar header (and then die of SIGPIPE while streaming the rest out). The tests are split so that we test as much as we can even with an uncooperative system tar. This actually catches the current breakage (which is that we die("BUG") trying to write the ustar header) on every system, and then on systems where we can, we go farther and actually verify the result. Helped-by: Robin H. Johnson <robbat2@gentoo.org> Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-07-01t9300: factor out portable "head -c" replacementLibravatar Jeff King2-20/+17
It is sometimes useful to be able to read exactly N bytes from a pipe. Doing this portably turns out to be surprisingly difficult in shell scripts. We want a solution that: - is portable - never reads more than N bytes due to buffering (which would mean those bytes are not available to the next program to read from the same pipe) - handles partial reads by looping until N bytes are read (or we see EOF) - is resilient to stray signals giving us EINTR while trying to read (even though we don't send them, things like SIGWINCH could cause apparently-random failures) Some possible solutions are: - "head -c" is not portable, and implementations may buffer (though GNU head does not) - "read -N" is a bash-ism, and thus not portable - "dd bs=$n count=1" does not handle partial reads. GNU dd has iflags=fullblock, but that is not portable - "dd bs=1 count=$n" fixes the partial read problem (all reads are 1-byte, so there can be no partial response). It does make a lot of write() calls, but for our tests that's unlikely to matter. It's fairly portable. We already use it in our tests, and it's unlikely that implementations would screw up any of our criteria. The most unknown one would be signal handling. - perl can do a sysread() loop pretty easily. On my Linux system, at least, it seems to restart the read() call automatically. If that turns out not to be portable, though, it would be easy for us to handle it. That makes the perl solution the least bad (because we conveniently omitted "length of code" as a criterion). It's also what t9300 is currently using, so we can just pull the implementation from there. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-13Git 2.9Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-12Merge tag 'l10n-2.9.0-rc0' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano10-15125/+19378
l10n-2.9.0-rc0 * tag 'l10n-2.9.0-rc0' of git://github.com/git-l10n/git-po: l10n: ko.po: Update Korean translation l10n: ru.po: update Russian translation l10n: de.po: translate 104 new messages l10n: zh_CN: review for git v2.9.0 l10n round 1 l10n: zh_CN: for git v2.9.0 l10n round 1 l10n: pt_PT: update Portuguese translation l10n: pt_PT: update according to git-gui glossary l10n: pt_PT: merge git.pot file l10n: Updated Bulgarian translation of git (2597t,0f,0u) l10n: sv.po: Update Swedish translation (2597t0f0u) l10n: fr.po v2.9.0rnd1 l10n: Updated Vietnamese translation (2597t) l10n: git.pot: v2.9.0 round 1 (104 new, 37 removed) l10n: fr.po Fixed grammar mistake
2016-06-12l10n: ko.po: Update Korean translationLibravatar Changwoo Ryu1-1393/+1799
2016-06-11Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruLibravatar Jiang Xin1-1404/+1767
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
2016-06-11l10n: ru.po: update Russian translationLibravatar Dimitriy Ryazantcev1-1404/+1767
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2016-06-10Hopefully the final last-minute update before 2.9 finalLibravatar Junio C Hamano1-3/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-10Merge branch 'jk/diff-compact-heuristic'Libravatar Junio C Hamano3-1/+13
It turns out that the earlier effort to update the heuristics may want to use a bit more time to mature. Turn it off by default. * jk/diff-compact-heuristic: diff: disable compaction heuristic for now
2016-06-10Merge branch 'jk/shell-portability'Libravatar Junio C Hamano4-4/+25
test fixes. * jk/shell-portability: t5500 & t7403: lose bash-ism "local" test-lib: add in-shell "env" replacement
2016-06-10Merge branch 'jc/t2300-setup'Libravatar Junio C Hamano1-1/+2
A test fix. * jc/t2300-setup: t2300: run git-sh-setup in an environment that better mimics the real life
2016-06-10diff: disable compaction heuristic for nowLibravatar Junio C Hamano3-1/+13
http://lkml.kernel.org/g/20160610075043.GA13411@sigill.intra.peff.net reports that a change to add a new "function" with common ending with the existing one at the end of the file is shown like this: def foo do_foo_stuff() + common_ending() +end + +def bar + do_bar_stuff() + common_ending() end when the new heuristic is in use. In reality, the change is to add the blank line before "def bar" and everything below, which is what the code without the new heuristic shows. Disable the heuristics by default, and resurrect the documentation for the option and the configuration variables, while clearly marking the feature as still experimental. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-10l10n: de.po: translate 104 new messagesLibravatar Ralf Thielow1-1428/+1882
Translate 104 new messages came from git.pot update in f517e50 (l10n: git.pot: v2.9.0 round 1 (104 new, 37 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2016-06-09l10n: zh_CN: review for git v2.9.0 l10n round 1Libravatar Ray Chen1-15/+15
Signed-off-by: Ray Chen <oldsharp@gmail.com> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2016-06-06Git 2.9-rc2Libravatar Junio C Hamano2-26/+7
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-06Sync with 2.8.4Libravatar Junio C Hamano2-1/+16
* maint: Git 2.8.4
2016-06-06Git 2.8.4Libravatar Junio C Hamano4-3/+18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-06Merge branch 'kb/msys2-tty' into maintLibravatar Junio C Hamano2-5/+56
The "are we talking with TTY, doing an interactive session?" detection has been updated to work better for "Git for Windows". * kb/msys2-tty: mingw: make isatty() recognize MSYS2's pseudo terminals (/dev/pty*)
2016-06-06Merge branch 'da/difftool' into maintLibravatar Junio C Hamano2-2/+30
"git difftool" learned to handle unmerged paths correctly in dir-diff mode. * da/difftool: difftool: handle unmerged files in dir-diff mode difftool: initialize variables for readability
2016-06-06Merge branch 'tb/core-eol-fix' into maintLibravatar Junio C Hamano4-189/+141
A couple of bugs around core.autocrlf have been fixed. * tb/core-eol-fix: convert.c: ident + core.autocrlf didn't work t0027: test cases for combined attributes convert: allow core.autocrlf=input and core.eol=crlf t0027: make commit_chk_wrnNNO() reliable
2016-06-06Merge branch 'ar/diff-args-osx-precompose' into maintLibravatar Junio C Hamano5-0/+47
Many commands normalize command line arguments from NFD to NFC variant of UTF-8 on OSX, but commands in the "diff" family did not, causing "git diff $path" to complain that no such path is known to Git. They have been taught to do the normalization. * ar/diff-args-osx-precompose: diff: run arguments through precompose_argv
2016-06-06Merge branch 'sb/submodule-helper-relative-path'Libravatar Junio C Hamano2-43/+20
A bash-ism "local" has been removed from "git submodule" scripted Porcelain. * sb/submodule-helper-relative-path: submodule: remove bashism from shell script
2016-06-06Merge branch 'sb/submodule-helper-list-signal-unmatch-via-exit-status'Libravatar Junio C Hamano2-7/+17
The way how "submodule--helper list" signals unmatch error to its callers has been updated. * sb/submodule-helper-list-signal-unmatch-via-exit-status: submodule--helper: offer a consistent API
2016-06-06l10n: zh_CN: for git v2.9.0 l10n round 1Libravatar Jiang Xin1-1575/+1800
Update 104 new translations (2596t1f0u) for git v2.9.0-rc0. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2016-06-03Almost ready for 2.9-rc2Libravatar Junio C Hamano1-0/+19
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-03Merge branch 'rs/apply-name-terminate'Libravatar Junio C Hamano1-2/+2
Code clean-up. * rs/apply-name-terminate: apply: remove unused parameters from name_terminate()
2016-06-03Merge branch 'rs/patch-id-use-skip-prefix'Libravatar Junio C Hamano1-13/+10
Code clean-up. * rs/patch-id-use-skip-prefix: patch-id: use starts_with() and skip_prefix()
2016-06-03Merge branch 'bd/readme.markdown-more'Libravatar Junio C Hamano1-5/+5
The mark-up in the top-level README.md file has been updated to typeset CLI command names differently from the body text. * bd/readme.markdown-more: README.md: format CLI commands with code syntax
2016-06-03Merge branch 'mm/makefile-developer-can-be-in-config-mak'Libravatar Junio C Hamano1-8/+9
"make DEVELOPER=1" worked as expected; setting DEVELOPER=1 in config.mak didn't. * mm/makefile-developer-can-be-in-config-mak: Makefile: add $(DEVELOPER_CFLAGS) variable Makefile: move 'ifdef DEVELOPER' after config.mak* inclusion
2016-06-03Merge branch 'em/man-bold-literal'Libravatar Junio C Hamano1-1/+1
The manpage output of our documentation did not render well in terminal; typeset literals in bold by default to make them stand out more. * em/man-bold-literal: Documentation: bold literals in man
2016-06-03Merge branch 'pa/cherry-pick-doc-typo'Libravatar Junio C Hamano1-1/+1
"git cherry-pick --help" had three instances of word "behavior", one of which was spelled "behaviour", which is updated to match the other two. * pa/cherry-pick-doc-typo: git-cherry-pick.txt: correct a small typo
2016-06-03Merge branch 'mr/send-email-doc-gmail-2fa'Libravatar Junio C Hamano1-1/+1
Typofix. * mr/send-email-doc-gmail-2fa: Documentation/git-send-email: fix typo in gmail 2FA section
2016-06-03Merge branch 'js/rebase-i-dedup-call-to-rerere'Libravatar Junio C Hamano1-1/+0
"git rebase -i", after it fails to auto-resolve the conflict, had an unnecessary call to "git rerere" from its very early days, which was spotted recently; the call has been removed. * js/rebase-i-dedup-call-to-rerere: rebase -i: remove an unnecessary 'rerere' invocation
2016-06-03Merge branch 'js/perf-rebase-i'Libravatar Junio C Hamano1-1/+4
The one in 'master' has a brown-paper-bag bug that breaks the perf test when used inside a usual Git repository with a working tree. * js/perf-rebase-i: perf: make the tests work without a worktree
2016-06-01Documentation/git-send-email: fix typo in gmail 2FA sectionLibravatar SZEDER Gábor1-1/+1
Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01t2300: run git-sh-setup in an environment that better mimics the real lifeLibravatar Junio C Hamano1-1/+2
When we run scripted Porcelains, "git" potty has set up the $PATH by prepending $GIT_EXEC_PATH, the path given by "git --exec-path=$there $cmd", etc. already. Because of this, scripted Porcelains can dot-source shell script library like git-sh-setup with simple dot without specifying any path. t2300 however dot-sources git-sh-setup without adjusting $PATH like the real "git" potty does. This has not been a problem so far, but once git-sh-setup wants to rely on the $PATH adjustment, just like any scripted Porcelains already do, it would become one. It cannot for example dot-source another shell library without specifying the full path to it by prefixing $(git --exec-path). Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01t5500 & t7403: lose bash-ism "local"Libravatar Junio C Hamano2-3/+2
In t5500::check_prot_host_port_path(), diagport is not a variable used elsewhere and the function is not recursively called so this can simply lose the "local", which may not be supported by shell (besides, the function liberally clobbers other variables without making them "local"). t7403::reset_submodule_urls() overrides the "root" variable used in the test framework for no good reason; its use is not about temporarily relocating where the test repositories are created. This assignment can be made not to clobber the variable by moving them into the subshells it already uses. Its value is always $TRASH_DIRECTORY, so we could use it instead there, and this function that is called only once and its two subshells may not be necessary (instead, the caller can use "git -C $there config" and set a value that is derived from $TRASH_DIRECTORY), but this is a minimum fix that is needed to lose "local". Helped-by: John Keeping <john@keeping.me.uk> Helped-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01submodule: remove bashism from shell scriptLibravatar Stefan Beller2-43/+20
Junio pointed out `relative_path` was using bashisms via the local variables. As the longer term goal is to rewrite most of the submodule code in C, do it now. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01submodule--helper: offer a consistent APILibravatar Stefan Beller2-7/+17
In 48308681 (2016-02-29, git submodule update: have a dedicated helper for cloning), the helper communicated errors back only via exit code, and dance with printing '#unmatched' in case of error was left to git-submodule.sh as it uses the output of the helper and pipes it into shell commands. This change makes the helper consistent by never printing '#unmatched' in the helper but always handling these piping issues in the actual shell script. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01Makefile: add $(DEVELOPER_CFLAGS) variableLibravatar Matthieu Moy1-9/+10
This does not change the behavior, but allows the user to tweak DEVELOPER_CFLAGS on the command-line or in a config.mak* file if needed. This also makes the code somewhat cleaner as it follows the pattern <initialisation of variables> <include statements> <actual build logic> by specifying which flags to activate in the first part, and actually activating them in the last one. Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-01test-lib: add in-shell "env" replacementLibravatar Jeff King2-1/+23
The one-shot environment variable syntax: FOO=BAR some-program is unportable when some-program is actually a shell function, like test_must_fail (on some shells FOO remains set after the function returns, and on others it does not). We sometimes get around this by using env, like: test_must_fail env FOO=BAR some-program But that only works because test_must_fail's arguments are themselves a command which can be run. You can't run: env FOO=BAR test_must_fail some-program because env does not know about our shell functions. So there is no equivalent for test_commit, for example, and one must resort to: ( FOO=BAR export FOO test_commit ) which is a bit verbose. Let's add a version of "env" that works _inside_ the shell, by creating a subshell, exporting variables from its argument list, and running the command. Its use is demonstrated on a currently-unportable case in t4014. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-31Git 2.9-rc1Libravatar Junio C Hamano2-40/+49
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-31Merge branch 'maint'Libravatar Junio C Hamano1-0/+28
* maint: More topics for 2.8.4
2016-05-31More topics for 2.8.4Libravatar Junio C Hamano1-0/+28
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-05-31Merge branch 'sb/submodule-deinit-all' into maintLibravatar Junio C Hamano3-10/+48
Correct faulty recommendation to use "git submodule deinit ." when de-initialising all submodules, which would result in a strange error message in a pathological corner case. * sb/submodule-deinit-all: submodule deinit: require '--all' instead of '.' for all submodules
2016-05-31Merge branch 'bn/http-cookiefile-config' into maintLibravatar Junio C Hamano2-3/+4
"http.cookieFile" configuration variable clearly wants a pathname, but we forgot to treat it as such by e.g. applying tilde expansion. * bn/http-cookiefile-config: http: expand http.cookieFile as a path Documentation: config: improve word ordering for http.cookieFile
2016-05-31Merge branch 'jk/test-send-sh-x-trace-elsewhere' into maintLibravatar Junio C Hamano2-3/+16
Running tests with '-x' option to trace the individual command executions is a useful way to debug test scripts, but some tests that capture the standard error stream and check what the command said can be broken with the trace output mixed in. When running our tests under "bash", however, we can redirect the trace output to another file descriptor to keep the standard error of programs being tested intact. * jk/test-send-sh-x-trace-elsewhere: test-lib: set BASH_XTRACEFD automatically