summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* apply: clarify read_old_data() is about no-index casejc/apply-with-crlfJunio C Hamano2017-08-161-1/+9
| | | | | | | | | | | | | | | With the previous fixes to CRLF handling in place, read_old_data() knows what it wants convert_to_git() to do with respect to CRLF. In fact, this codepath is about applying a patch to a file in the filesystem, which may not exist in the index, or may exist but may not match what is recorded in the index, or in the extreme case, we may not even be in a Git repository. If convert_to_git() peeked at the index while doing its work, it *would* be a bug. Pass NULL instead of &the_index to the function to make sure we catch future bugs to clarify this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* apply: localize the CRLF business to read_old_data()Junio C Hamano2017-08-161-16/+14
| | | | | | | | | | | | | | | | | | | | | | | Previous changes passed a new APPLY_FLAGS_CR_AT_EOL option down from load_preimage() to read_old_data(), because the last function in that callchain needs to decide how its call to convert_to_git() function is made on the data read from the working tree. The load_preimage() function and its direct callees, however, are not limited to the case where the patch is applied to the data in the working tree (i.e. "git apply" that is working as a better "patch -p1"), unlike read_old_data(), which deals only with the patch target in the working tree. They are also responsible for driving "git apply --cached" and "git apply --index", both of which take the current index contents into account and do not need the new special-casing of CRLF. Exposing APPLY_FLAGS_CR_AT_EOL bit to them is misleading. Instead, just pass the "struct patch" down the same callchain, and have read_old_data() look at its crlf_in_old member to make the necessary decision. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* apply: only pay attention to CRLF in the preimageJunio C Hamano2017-08-161-6/+11
| | | | | | | | | | | | | The newly added "patch.has_crlf" member wants to indicate if the incoming patch expects any CRLF line in the patch target, and parse_fragment() implements that logic for "git apply". Rename the member to "patch.crlf_in_old" to clarify what it means, and fix the logic in parse_fragment() so that it also works correctly when running "git apply -R", where '+' lines correspond to the patch target. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* apply: remove unused field apply_state.flagsJunio C Hamano2017-08-162-4/+2
| | | | | | | | The previous step added the "flags" member to apply_state, but it is never used. Remove it and move the bit assignment macro to apply.c as that is just a private implementation detail. Signed-off-by: Junio C Hamano <gitster@pobox.com>
* apply: file commited with CRLF should roundtrip diff and applyTorsten Bögershausen2017-08-164-11/+79
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a file had been commited with CRLF and core.autocrlf is true, the following does not roundtrip, `git apply` fails: printf "Added line\r\n" >>file && git diff >patch && git checkout -- . && git apply patch Before applying the patch, the file from working tree is converted into the index format (clean filter, CRLF conversion, ...) Here, when commited with CRLF, the line endings should not be converted. Analyze the patch if there is any context line with CRLF, or if any line with CRLF is to be removed. If yes, the new flag has_crlf is set in "struct patch", and two things will happen: - read_old_data() will not convert CRLF into LF by calling convert_to_git(..., SAFE_CRLF_KEEP_CRLF); - The WS_CR_AT_EOL bit is set in the "white space rule", CRLF are no longer treated as white space. Reported-by: Anthony Sottile <asottile@umich.edu> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* convert: add SAFE_CRLF_KEEP_CRLFTorsten Bögershausen2017-08-162-5/+8
| | | | | | | | | | | | | | | | When convert_to_git() is called, the caller may want to keep CRLF to be kept as CRLF (and not converted into LF). This will be used in the next commit, when apply works with files that have CRLF and patches are applied onto these files. Add the new value "SAFE_CRLF_KEEP_CRLF" to safe_crlf. Prepare convert_to_git() to be able to run the clean filter, skip the CRLF conversion and run the ident filter. Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Git 2.14.1v2.14.1Junio C Hamano2017-08-043-2/+6
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge tag 'v2.13.5' into maintJunio C Hamano2017-08-0414-2/+130
|\
| * Git 2.13.5v2.13.5Junio C Hamano2017-08-013-2/+6
| | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| * Merge tag 'v2.12.4' into maintJunio C Hamano2017-08-0113-2/+126
| |\
| | * Git 2.12.4v2.12.4Junio C Hamano2017-07-303-2/+6
| | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | * Merge tag 'v2.11.3' into maint-2.12Junio C Hamano2017-07-3011-0/+116
| | |\ | | | | | | | | | | | | Git 2.11.3
| | | * Git 2.11.3v2.11.3Junio C Hamano2017-07-303-2/+6
| | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | * Merge tag 'v2.10.4' into maint-2.11Junio C Hamano2017-07-3010-0/+112
| | | |\ | | | | | | | | | | | | | | | Git 2.10.4
| | | | * Git 2.10.4v2.10.4Junio C Hamano2017-07-303-2/+6
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | * Merge tag 'v2.9.5' into maint-2.10Junio C Hamano2017-07-309-0/+108
| | | | |\ | | | | | | | | | | | | | | | | | | Git 2.9.5
| | | | | * Git 2.9.5v2.9.5maint-2.9Junio C Hamano2017-07-303-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | * Merge tag 'v2.8.6' into maint-2.9Junio C Hamano2017-07-308-0/+104
| | | | | |\ | | | | | | | | | | | | | | | | | | | | | Git 2.8.6
| | | | | | * Git 2.8.6v2.8.6maint-2.8Junio C Hamano2017-07-303-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | * Merge tag 'v2.7.6' into maint-2.8Junio C Hamano2017-07-307-0/+100
| | | | | | |\ | | | | | | | | | | | | | | | | | | | | | | | | Git 2.7.6
| | | | | | | * Git 2.7.6v2.7.6maint-2.7Junio C Hamano2017-07-303-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | | * Merge branch 'jk/ssh-funny-url' into maint-2.7Junio C Hamano2017-07-286-0/+75
| | | | | | | |\
| | | | | | | | * connect: reject paths that look like command line optionsJeff King2017-07-283-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we get a repo path like "-repo.git", we may try to invoke "git-upload-pack -repo.git". This is going to fail, since upload-pack will interpret it as a set of bogus options. But let's reject this before we even run the sub-program, since we would not want to allow any mischief with repo names that actually are real command-line options. You can still ask for such a path via git-daemon, but there's no security problem there, because git-daemon enters the repo itself and then passes "." on the command line. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | | | * connect: reject dashed arguments for proxy commandsJeff King2017-07-282-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If you have a GIT_PROXY_COMMAND configured, we will run it with the host/port on the command-line. If a URL contains a mischievous host like "--foo", we don't know how the proxy command may handle it. It's likely to break, but it may also do something dangerous and unwanted (technically it could even do something useful, but that seems unlikely). We should err on the side of caution and reject this before we even run the command. The hostname check matches the one we do in a similar circumstance for ssh. The port check is not present for ssh, but there it's not necessary because the syntax is "-p <port>", and there's no ambiguity on the parsing side. It's not clear whether you can actually get a negative port to the proxy here or not. Doing: git fetch git://remote:-1234/repo.git keeps the "-1234" as part of the hostname, with the default port of 9418. But it's a good idea to keep this check close to the point of running the command to make it clear that there's no way to circumvent it (and at worst it serves as a belt-and-suspenders check). Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | | | * connect: factor out "looks like command line option" checkJeff King2017-07-283-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We reject hostnames that start with a dash because they may be confused for command-line options. Let's factor out that notion into a helper function, as we'll use it in more places. And while it's simple now, it's not clear if some systems might need more complex logic to handle all cases. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | | | * t5813: add test for hostname starting with dashJeff King2017-07-281-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per the explanation in the previous patch, this should be (and is) rejected. Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | | | | | | | * connect: reject ssh hostname that begins with a dashJunio C Hamano2017-07-281-0/+3
| | | | | | | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When commands like "git fetch" talk with ssh://$rest_of_URL/, the code splits $rest_of_URL into components like host, port, etc., and then spawns the underlying "ssh" program by formulating argv[] array that has: - the path to ssh command taken from GIT_SSH_COMMAND, etc. - dashed options like '-batch' (for Tortoise), '-p <port>' as needed. - ssh_host, which is supposed to be the hostname parsed out of $rest_of_URL. - then the command to be run on the other side, e.g. git upload-pack. If the ssh_host ends up getting '-<anything>', the argv[] that is used to spawn the command becomes something like: { "ssh", "-p", "22", "-<anything>", "command", "to", "run", NULL } which obviously is bogus, but depending on the actual value of "<anything>", will make "ssh" parse and use it as an option. Prevent this by forbidding ssh_host that begins with a "-". Noticed-by: Joern Schneeweisz of Recurity Labs Reported-by: Brian at GitLab Signed-off-by: Junio C Hamano <gitster@pobox.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
| | * | | | | | Merge branch 'jk/lib-proto-disable-cleanup' into maint-2.12Junio C Hamano2017-07-301-2/+6
| | |\ \ \ \ \ \
| | | * | | | | | t/lib-proto-disable: restore protocol.allow after config testsJeff King2017-07-281-2/+6
| | |/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tests for protocol.allow actually set that variable in the on-disk config, run a series of tests, and then never clean up after themselves. This means that whatever tests we run after have protocol.allow=never, which may influence their results. In most cases we either exit after running these tests, or do another round of test_proto(). In the latter case, this happens to work because: 1. Tests of the GIT_ALLOW_PROTOCOL environment variable override the config. 2. Tests of the specific config "protocol.foo.allow" override the protocol.allow config. 3. The next round of protocol.allow tests start off by setting the config to a known value. However, it's a land-mine waiting to trap somebody adding new tests to one of the t581x test scripts. Let's make sure we clean up after ourselves. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Git 2.14v2.14.0Junio C Hamano2017-08-042-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Merge branch 'ah/patch-id-doc'Junio C Hamano2017-08-041-3/+0
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Docfix. * ah/patch-id-doc: doc: remove unsupported parameter from patch-id
| * | | | | | | | doc: remove unsupported parameter from patch-idah/patch-id-docAndreas Heiduk2017-07-281-3/+0
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The patch is read from standard input and not from a parameter. Signed-off-by: Andreas Heiduk <asheiduk@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Merge branch 'as/diff-options-grammofix'Junio C Hamano2017-08-041-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A grammofix. * as/diff-options-grammofix: diff-options doc: grammar fix
| * | | | | | | | diff-options doc: grammar fixas/diff-options-grammofixAnthony Sottile2017-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Anthony Sottile <asottile@umich.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | | Merge tag 'l10n-2.14.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano2017-08-029-15801/+17022
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | l10n for Git 2.14.0 round 2 * tag 'l10n-2.14.0-rnd2' of git://github.com/git-l10n/git-po: l10n: zh_CN: review for git v2.14.0 l10n l10n: ko.po: Update Korean translation l10n: zh_CN: for git v2.14.0 l10n round 2 l10n: de.po: various fixes in German translation l10n: ru.po: update Russian translation l10n: fr.po v2.14.0 rnd 2 l10n: fr.po Fix some french typos l10n: fr.po Fix typo l10n: fr.po Fix some translations l10n: de.po: update German translation l10n: vi.po (3213t): Updated 9 new strings l10n: Update Catalan translation l10n: bg.po: Updated Bulgarian translation (3213t)
| * | | | | | | | | l10n: zh_CN: review for git v2.14.0 l10nJiang Xin2017-08-022-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed-by: 依云 <lilydjwg@gmail.com> Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | | | | | | | | l10n: ko.po: Update Korean translationChangwoo Ryu2017-08-011-13/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Changwoo Ryu <cwryu@debian.org>
| * | | | | | | | | l10n: zh_CN: for git v2.14.0 l10n round 2Jiang Xin2017-08-011-3165/+3147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Translate new l10n messages for git 2.14.0, and update translations on "stash". Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * | | | | | | | | l10n: de.po: various fixes in German translationHartmut Henkel2017-07-301-27/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Hartmut Henkel <henkel@vh-s.de> Helped-by: Stefan Beller <sbeller@google.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
| * | | | | | | | | Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruJiang Xin2017-07-301-3027/+3137
| |\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
| | * | | | | | | | | l10n: ru.po: update Russian translationDimitriy Ryazantcev2017-07-301-3027/+3137
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
| * | | | | | | | | | Merge branch 'master' of https://github.com/ralfth/git-po-deJiang Xin2017-07-271-3010/+3181
| |\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of https://github.com/ralfth/git-po-de: l10n: de.po: update German translation
| | * | | | | | | | | | l10n: de.po: update German translationRalf Thielow2017-07-261-3010/+3181
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| * | | | | | | | | | | Merge branch 'fr_l10n_v2.14.0rnd2' of git://github.com/jnavila/gitJiang Xin2017-07-271-3038/+3222
| |\ \ \ \ \ \ \ \ \ \ \ | | |/ / / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'fr_l10n_v2.14.0rnd2' of git://github.com/jnavila/git: l10n: fr.po v2.14.0 rnd 2 l10n: fr.po Fix some french typos l10n: fr.po Fix typo l10n: fr.po Fix some translations
| | * | | | | | | | | | l10n: fr.po v2.14.0 rnd 2Jean-Noel Avila2017-07-271-3009/+3193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jean-noel.avila@scantech.fr>
| | * | | | | | | | | | l10n: fr.po Fix some french typosSylvestre Ledru2017-07-271-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Sylvestre Ledru <sylvestre@debian.org>
| | * | | | | | | | | | l10n: fr.po Fix typoLouis2017-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Louis <spalax@gresille.org>
| | * | | | | | | | | | l10n: fr.po Fix some translationsHugues Peccatte2017-07-271-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Hugues Peccatte <hugues.peccatte@aareon.fr> Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| * | | | | | | | | | | Merge branch 'master' of https://github.com/Softcatala/git-poJiang Xin2017-07-261-3453/+4119
| |\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of https://github.com/Softcatala/git-po: l10n: Update Catalan translation
| | * | | | | | | | | | | l10n: Update Catalan translationJordi Mas2017-07-241-3453/+4119
| | |/ / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Jordi Mas <jmas@softcatala.org>