summaryrefslogtreecommitdiffstats
path: root/diff-delta.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2016-02-10check_filename: tighten dwim-wildcard ambiguityJeff King4-31/+42
When specifying both revisions and pathnames, we allow "<rev> -- <pathspec>" to be spelled without the "--" as long as it is not ambiguous. The original logic was something like: 1. Resolve each item with get_sha1(). If successful, we know it can be a <rev>. Verify that it _isn't_ a filename, using verify_non_filename(), and complain of ambiguity otherwise. 2. If get_sha1() didn't succeed, make sure that it _is_ a file, using verify_filename(). If not, complain that it is neither a <rev> nor a <pathspec>. Both verify_filename() and verify_non_filename() rely on check_filename(), which definitely said "yes, this is a file" or "no, it is not" using lstat(). Commit 28fcc0b (pathspec: avoid the need of "--" when wildcard is used, 2015-05-02) introduced a convenience feature: check_filename() will consider anything with wildcard meta-characters as a possible filename, without even checking the filesystem. This works well for case 2. For such a wildcard, we would previously have died and said "it is neither". Post-28fcc0b, we assume it's a pathspec and proceed. But it makes some instances of case 1 worse. We may have an extended sha1 expression that contains meta-characters (e.g., "HEAD^{/foo.*bar}"), and we now complain that it's also a filename, due to the wildcard characters (even though that wildcard would not match anything in the filesystem). One solution would be to actually expand the pathname and see if it matches anything on the filesystem. But that's potentially expensive, and we do not have to be so rigorous for this DWIM magic (if you want rigor, use "--"). Instead, we can just use different rules for cases 1 and 2. When we know something is a rev, we will complain only if it meets a much higher standard for "this is also a file"; namely that it actually exists in the filesystem. Case 2 remains the same: we use the looser "it could be a filename" standard introduced by 28fcc0b. We can accomplish this by pulling the wildcard logic out of check_filename() and putting it into verify_filename(). Its partner verify_non_filename() does not need a change, since check_filename() goes back to implementing the "higher standard". Besides these two callers of check_filename(), there is one other: git-checkout does a similar DWIM itself. It hits this code path only after get_sha1() has returned failure, making it case 2, which gets the special wildcard treatment. Note that we drop the tests in t2019 in favor of a more complete set in t6133. t2019 was not the right place for them (it's about refname ambiguity, not dwim parsing ambiguity), and the second test explicitly checked for the opposite result of the case we are fixing here (which didn't really make any sense; as shown by the test_must_fail in the test, it would only serve to annoy people). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-02-10checkout: reorder check_filename conditionalJeff King1-1/+1
If we have a "--" flag, we should not be doing DWIM magic based on whether arguments can be filenames. Reorder the conditional to avoid the check_filename() call entirely in this case. The outcome is the same, but the short-circuit makes the dependency more clear. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-12t2019: skip test requiring '*' in a file name non WindowsJohannes Sixt1-1/+1
A test case introduced by ae454f61 (Add tests for wildcard "path vs ref" disambiguation) allocates a file named '*.c'. This does not work on Windows, because the OS forbids file names containing wildcard characters. The test case fails where the shell attempts to allocate the file. Skip the test on Windows. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-07-01Add tests for wildcard "path vs ref" disambiguationNguyễn Thái Ngọc Duy1-0/+26
Commit 28fcc0b (pathspec: avoid the need of "--" when wildcard is used - 2015-05-02) changes how the disambiguation rules work. This patch adds some tests to demonstrate, basically, if wildcard characters are in an argument: - if the argument is valid extended sha-1 syntax, "--" must be used - otherwise the argument is considered a path, even without "--" And wildcard can appear in extended sha-1 syntax, either as part of regex in ":/<regex>" or as the literal path in ":<path>". The latter case is less likely to happen in real world. But if you do ":/" a lot, you may need to type "--" more. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-05-03pathspec: avoid the need of "--" when wildcard is usedDuy Nguyen1-1/+3
When "--" is lacking from the command line and a command can take both revs and paths, the idea is if an argument can be seen as both an extended SHA-1 and a path, then "--" is required or git refuses to continue. It's currently implemented as: (1) if an argument is rev, then it must not exist in worktree (2) else, it must exist in worktree (3) else, "--" is required. These rules work for literal paths, but when non-literal pathspec is involved, it almost always requires the user to add "--" because it fails (2) and (1) is really rarely met (take "*.c" for example, (1) is met if there is a ref named "*.c"). This patch modifies the rules a bit by considering any valid (*) wildcard pathspec "exist in worktree". The rules become: (1) if an arg is a rev, then it must either exist in worktree or not be a valid wildcard pathspec. (2) else, it either exists in worktree or is a wildcard pathspec (3) else, "--" is required. With the new rules, "--" is not needed most of the time when wildcard pathspec is involved. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-30Git 2.4v2.4.0Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-28Update git-multimail to version 1.0.2Michael Haggerty2-24/+25
The only changes are to the README files, most notably the list of maintainers and the project URL. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-27Git 2.3.7v2.3.7Junio C Hamano4-3/+25
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-24status: document the -v/--verbose optionMichael Haggerty1-0/+8
Document `git status -v`, including its new doubled `-vv` form. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-23RelNotes: wordsmithingMichael Haggerty1-164/+172
Make many textual tweaks to the 2.4.0 release notes. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-23RelNotes: refer to the rebase -i "todo list", not "insn sheet"Michael Haggerty1-2/+2
"Todo list" is the name that is used in the user-facing documentation. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-23RelNotes: correct name of versionsort.prereleaseSuffixMichael Haggerty1-2/+2
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-23git tag: mention versionsort.prereleaseSuffix in manpageMichael Haggerty1-4/+7
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-22Git 2.4.0-rc3v2.4.0-rc3Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-21Git 2.3.6v2.3.6Junio C Hamano4-3/+17
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-21RelNotes: "merge --quiet" change has been revertedJunio C Hamano1-4/+0
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-21Hopefully the last batch for 2.4Junio C Hamano1-1/+18
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-18git-gui: set version 0.20gitgui-0.20.0Pat Thoyts1-1/+1
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2015-04-18git-gui: sv.po: Update Swedish translation (547t0f0u)Peter Krefting1-1431/+1562
Signed-off-by: Peter Krefting <peter@softwolves.pp.se> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2015-04-18git-gui i18n: Updated Bulgarian translation (547t,0f,0u)Alexander Shopov1-1498/+1528
Signed-off-by: Alexander Shopov <ash@kambanaria.org> Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
2015-04-17rev-list-options.txt: complete sentence about notes matchingMichael J Gruber1-2/+2
Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-16Revert "merge: pass verbosity flag down to merge-recursive"Junio C Hamano1-4/+0
This reverts commit 2bf15a3330a26183adc8563dbeeacc11294b8a01, whose intention was good, but the verbosity levels used in merge-recursive turns out to be rather uneven. For example, a merge of two branches with conflicting submodule updates used to report CONFLICT: output with --quiet but no longer (which *is* desired), while the final "Automatic merge failed; fix conflicts and then commit" message is still shown even with --quiet (which *is* inconsistent). Originally reported by Bryan Turner; it is too early to declare what the concensus is, but it seems that we would need to level the verbosity levels used in merge strategy backends before we can go forward. In the meantime, we'd revert to the old behaviour until that happens. cf. $gmane/267245
2015-04-14Git 2.4.0-rc2v2.4.0-rc2Junio C Hamano2-3/+20
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-14CodingGuidelines: update 'rough' rule countJulian Gindi1-1/+1
Changed inaccurate count of "rough rules" from three to the more generic 'a few'. Signed-off-by: Julian Gindi <juliangindi@gmail.com> Reviewed-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-13grep: correctly initialize help-all optionPatrick Steinhardt1-1/+1
The "help-all" option is being initialized with a wrong value. While being semantically wrong this can also cause a segmentation fault in gcc on ARMv7 hardfloat platforms with a hardened toolchain. Fix this by initializing with a NULL value. Signed-off-by: Patrick Steinhardt <ps@pks.im> Reviewed-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-13completion: fix global bash variable leak on __gitcompappendMárcio Almada1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-13t9814: guarantee only one source exists in git-p4 copy testsVitor Antunes1-15/+31
By using a tree with multiple identical files and allowing copy detection to choose any one of them, the check in the test is unnecessarily complex. We can simplify by: * Modify source file (file2) before copying the file. * Check that only file2 is the source in the output of "p4 filelog". * Remove all "case" statements and replace them with simple tests to check that source is "file2". Signed-off-by: Vitor Antunes <vitor.hda@gmail.com> Acked-by: Luke Diamand <luke@diamand.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-09connect.c: ignore extra colon after hostnameTorsten Bögershausen3-16/+24
Ignore an extra ':' at the end of the hostname in URL's like "ssh://example.com:/path/to/repo" The colon is meant to separate a port number from the hostname. If the port is empty, the colon should be ignored, see RFC 3986. It had been working for URLs with ssh:// scheme, but was unintentionally broken in 86ceb3, "allow ssh://user@[2001:db8::1]/repo.git" Reported-by: Reid Woodbury Jr. <reidw@rawsound.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-09l10n: TEAMS: Change repository URL of zh_CNJiang Xin1-1/+1
Repository URL of zh_CN l10n for Git has been changed over 2 years, update po/TEAMS for it. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-04-08l10n: ca.po: update translationAlex Henrie1-236/+236
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2015-04-07l10n: Updated Bulgarian translation of git (2305t,0f,0u)Alexander Shopov1-1436/+1456
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2015-04-07l10n: sv.po: Update Swedish translation (2305t0f0u)Peter Krefting1-241/+244
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2015-04-05l10n: de.po: translate one messageRalf Thielow1-239/+248
Translate one message came from git.pot update in 6eebb35 (l10n: git.pot: v2.4.0 round 2 (1 update)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-04-04diff-highlight: do not split multibyte charactersKyle J. McKay1-2/+7
When the input is UTF-8 and Perl is operating on bytes instead of characters, a diff that changes one multibyte character to another that shares an initial byte sequence will result in a broken diff display as the common byte sequence prefix will be separated from the rest of the bytes in the multibyte character. For example, if a single line contains only the unicode character U+C9C4 (encoded as UTF-8 0xEC, 0xA7, 0x84) and that line is then changed to the unicode character U+C9C0 (encoded as UTF-8 0xEC, 0xA7, 0x80), when operating on bytes diff-highlight will show only the single byte change from 0x84 to 0x80 thus creating invalid UTF-8 and a broken diff display. Fix this by putting Perl into character mode when splitting the line and then back into byte mode after the split is finished. The utf8::xxx functions require Perl 5.8 so we require that as well. Also, since we are mucking with code in the split_line function, we change a '*' quantifier to a '+' quantifier when matching the $COLOR expression which has the side effect of speeding everything up while eliminating useless '' elements in the returned array. Reported-by: Yi EungJun <semtlenori@gmail.com> Signed-off-by: Kyle J. McKay <mackyle@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-04l10n: fr.po v2.4.0 round 2Jean-Noel Avila1-255/+291
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
2015-04-03l10n: ru: updated Russian translationDimitriy Ryazantcev1-238/+238
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2015-04-03l10n: vi.po(2305t): Updated 1 new stringTran Ngoc Quan1-244/+247
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2015-04-03l10n: zh_CN: for git v2.4.0 l10n round 2Jiang Xin1-235/+235
Translate 1 update message (2305t0f0u) for git v2.4.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-04-03l10n: git.pot: v2.4.0 round 2 (1 update)Jiang Xin1-233/+233
Generate po/git.pot from v2.4.0-rc1 for git v2.4.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2015-04-03merge: pass verbosity flag down to merge-recursiveJeff King1-0/+4
This makes "git merge --quiet" really quiet when we call into merge-recursive. Note that we can't just pass our flag down as-is; the two parts of the code use different scales. We center at "0" as normal for git-merge (with "--quiet" giving a negative value), but merge-recursive uses "2" as its center. This patch passes a negative value to merge-recursive rather than "1", though, as otherwise the user would have to use "-qqq" to squelch all messages (but the downside is that the user cannot distinguish between levels 0-2 if without resorting to the GIT_MERGE_VERBOSITY variable). We may want to review and renormalize the message severities in merge-recursive, but that does not have to happen now. This is at least in improvement in the sense that we are respecting "--quiet" at all. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-02Git 2.4.0-rc1v2.4.0-rc1Junio C Hamano2-3/+4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-02push --signed: tighten what the receiving end can ask to signJunio C Hamano1-0/+23
Instead of blindly trusting the receiving side to give us a sensible nonce to sign, limit the length (max 256 bytes) and the alphabet (alnum and a few selected punctuations, enough to encode in base64) that can be used in nonce. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-02send-pack: unify error messages for unsupported capabilitiesRalf Thielow1-1/+1
If --signed is not supported, the error message names the remote "receiving end". If --atomic is not supported, the error message names the remote "server". Unify the naming to "receiving end" as we're in the context of "push". Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-02l10n: de.po: translate 'symbolic link' as 'symbolische Verknüpfung'Matthias Rüster1-9/+9
The use of 'symbolische Verknüpfung' for 'symbolic link' is more common than 'symbolischer Verweis'. Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-04-02l10n: de.po: translate 99 new messagesRalf Thielow1-851/+899
Translate 99 messages came from git.pot update in c2ea120 (l10n: git.pot: v2.4.0 round 1 (99 new, 92 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-04-02l10n: de.po: fix messages with abbreviated hashsRalf Thielow1-2/+2
The three dots in messages where the hash is abbreviated were misinterpreted and are fixed with this commit. Noticed-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-04-02l10n: de.po: add space before ellipsisPhillip Sz1-11/+11
Signed-off-by: Phillip Sz <phillip.szelat@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2015-04-02howto: document more tools for recovery corruptionJeff King1-0/+237
Long ago, I documented a corruption recovery I did and gave some C code that I used to help find a flipped bit. I had to fix a similar case recently, and I ended up writing a few more tools. I hope nobody ever has to use these, but it does not hurt to share them, just in case. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-02push-to-deploy: allow pushing into an unborn branch and updating itJunio C Hamano2-2/+74
Setting receive.denycurrentbranch to updateinstead and pushing into the current branch, when the working tree and the index is truly clean, is supposed to reset the working tree and the index to match the tree of the pushed commit. This did not work when pushing into an unborn branch. The code that drives push-to-checkout hook needs no change, as the interface is defined so that hook can decide what to do when the push is coming to an unborn branch and take an appropriate action since the beginning. Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-04-01fast-import doc: remove suggested 16-parent limitJonathan Nieder1-4/+0
Merges with an absurd number of parents are still a bad idea because they do not render well in tools like gitk, but if they are present in the repository being imported into git then there's no need to avoid reproducing them faithfully. In olden times, before v1.6.0-rc0~194 (2008-06-27), git commit-tree and higher-level tools built on top of it were limited to writing 16 parents for a commit. Nowadays normal git operations are happy to write more parents when asked, so the motivation for this note in the fast-import documentation is gone and we can remove it. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>