summaryrefslogtreecommitdiff
path: root/t
AgeCommit message (Collapse)AuthorFilesLines
2011-05-16Merge branch 'jc/t1506-shell-param-expansion-gotcha' into maintLibravatar Junio C Hamano1-2/+5
* jc/t1506-shell-param-expansion-gotcha: t1507: avoid "${parameter<op>'word'}" inside double-quotes
2011-05-16Merge branch 'jc/fix-add-u-unmerged' into maintLibravatar Junio C Hamano1-17/+7
* jc/fix-add-u-unmerged: Fix "add -u" that sometimes fails to resolve unmerged paths Conflicts: builtin/add.c
2011-05-16Merge branch 'jc/maint-branch-mergeoptions' into maintLibravatar Junio C Hamano1-0/+32
* jc/maint-branch-mergeoptions: merge: make branch.<name>.mergeoptions correctly override merge.<option> Conflicts: builtin/merge.c
2011-05-16Merge branch 'jc/maint-add-p-overlapping-hunks' into maintLibravatar Junio C Hamano1-0/+36
* jc/maint-add-p-overlapping-hunks: t3701: add-p-fix makes the last test to pass "add -p": work-around an old laziness that does not coalesce hunks add--interactive.perl: factor out repeated --recount option t3701: Editing a split hunk in an "add -p" session add -p: 'q' should really quit
2011-05-15Merge branch 'jm/mergetool-submodules' into maintLibravatar Junio C Hamano1-3/+287
* jm/mergetool-submodules: mergetool: Teach about submodules
2011-05-15Merge branch 'jk/format-patch-quote-special-in-from' into maintLibravatar Junio C Hamano1-0/+42
* jk/format-patch-quote-special-in-from: pretty: quote rfc822 specials in email addresses
2011-05-13Merge branch 'aw/maint-rebase-i-p-no-ff' into maintLibravatar Junio C Hamano1-1/+31
* aw/maint-rebase-i-p-no-ff: git-rebase--interactive.sh: preserve-merges fails on merges created with no-ff
2011-05-13Merge branch 'js/blame-parsename' into maintLibravatar Junio C Hamano2-2/+13
* js/blame-parsename: t/annotate-tests: Use echo & cat instead of sed blame: tolerate bogus e-mail addresses a bit better
2011-05-13Merge branch 'jk/merge-one-file-working-tree' into maintLibravatar Junio C Hamano1-0/+100
* jk/merge-one-file-working-tree: merge-one-file: fix broken merges with alternate work trees add tests for merge-index / merge-one-file
2011-05-13Merge branch 'jc/fix-diff-files-unmerged' into maintLibravatar Junio C Hamano13-22/+102
* jc/fix-diff-files-unmerged: diff-files: show unmerged entries correctly diff: remove often unused parameters from diff_unmerge() diff.c: return filepair from diff_unmerge() test: use $_z40 from test-lib
2011-05-13Merge branch 'mz/maint-rename-unmerged' into maintLibravatar Junio C Hamano1-0/+62
* mz/maint-rename-unmerged: diffcore-rename: don't consider unmerged path as source
2011-05-13t5400: Fix a couple of typosLibravatar Johan Herland1-2/+2
Signed-off-by: Johan Herland <johan@herland.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-09t1507: avoid "${parameter<op>'word'}" inside double-quotesLibravatar Junio C Hamano1-2/+5
Kacper Kornet noticed that a $variable in "word" in the above construct is not substituted by his pdksh. Modern POSIX compliant shells (e.g. dash, ksh, bash) all seem to interpret POSIX "2.6.2 Parameter Expansion" that says "word shall be subjected to tilde expansion, parameter expansion, command substitution, and arithmetic expansion" in ${parameter<op>word}, to mean that the word is expanded as if it appeared in dq pairs, so if the word were "'$variable'" (sans dq) it would expand to a single quote, the value of the $variable and then a single quote. Johannes Sixt reports that the behavior of quoting at the right of :- when the ${...:-...} expansion appears in double-quotes was debated recently at length at the Austin group. We can avoid this issue and future-proof the test by a slight rewrite. Helped-by: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-08t3701: add-p-fix makes the last test to passLibravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-06merge: make branch.<name>.mergeoptions correctly override merge.<option>Libravatar Junio C Hamano1-0/+32
The parsing of the additional command line parameters supplied to the branch.<name>.mergeoptions configuration variable was implemented at the wrong stage. If any merge-related variable came after we read branch.<name>.mergeoptions, the earlier value was overwritten. We should first read all the merge.* configuration, override them by reading from branch.<name>.mergeoptions and then finally read from the command line. This patch should fix it, even though I now strongly suspect that branch.<name>.mergeoptions that gives a single command line that needs to be parsed was likely to be an ill-conceived idea to begin with. Sigh... Helped-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-05t3701: fix here documentLibravatar Junio C Hamano1-3/+2
A broken here-document was not caught because end of file is taken by an implicit end of the here document (POSIX does not seem to say it is an error to lack the delimiter), and everything in the test just turned into a single "cat into a file". Noticed-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-05t/annotate-tests: Use echo & cat instead of sedLibravatar Brian Gernhardt1-1/+2
The use of the sed command "1i No robots allowed" caused the version of sed in OS X to die with sed: 1: "1i "No robots allowed"\n": command i expects \ followed by text Since this command was just trying to add a single line to the beginning of the file, do the same with "echo" followed by "cat". Unbreaks t8001 and t8002 on OS X 10.6.7 Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-04Merge branch 'jh/dirstat' into maintLibravatar Junio C Hamano6-7/+40
* jh/dirstat: --dirstat: In case of renames, use target filename instead of source filename Teach --dirstat not to completely ignore rearranged lines within a file --dirstat-by-file: Make it faster and more correct --dirstat: Describe non-obvious differences relative to --stat or regular diff
2011-05-04Merge branch 'jk/maint-stash-oob' into maintLibravatar Junio C Hamano1-5/+11
* jk/maint-stash-oob: stash: fix false positive in the invalid ref test. stash: fix accidental apply of non-existent stashes Conflicts: t/t3903-stash.sh
2011-05-04Merge branch 'dm/stash-k-i-p' into maintLibravatar Junio C Hamano2-0/+20
* dm/stash-k-i-p: stash: ensure --no-keep-index and --patch can be used in any order stash: add two more tests for --no-keep-index
2011-05-04Merge branch 'mg/reflog-with-options' into maintLibravatar Junio C Hamano1-0/+18
* mg/reflog-with-options: reflog: fix overriding of command line options t/t1411: test reflog with formats builtin/log.c: separate default and setup of cmd_log_init()
2011-05-04Merge branch 'jk/stash-loosen-safety' into maintLibravatar Junio C Hamano1-4/+16
* jk/stash-loosen-safety: stash: drop dirty worktree check on apply
2011-05-04Merge branch 'ar/clean-rmdir-empty' into maintLibravatar Junio C Hamano1-0/+7
* ar/clean-rmdir-empty: clean: unreadable directory may still be rmdir-able if it is empty
2011-05-04Merge branch 'mg/sha1-path-advise' into maintLibravatar Junio C Hamano1-5/+12
* mg/sha1-path-advise: sha1_name: Suggest commit:./file for path in subdir t1506: factor out test for "Did you mean..."
2011-04-29merge-one-file: fix broken merges with alternate work treesLibravatar Jeff King1-2/+2
The merge-one-file tool predates the invention of GIT_WORK_TREE. By the time GIT_WORK_TREE was invented, most people were using the merge-recursive strategy, which handles resolving internally. Therefore these features have had very little testing together. For the most part, merge-one-file just works with GIT_WORK_TREE; most of its heavy lifting is done by plumbing commands which do respect GIT_WORK_TREE properly. The one exception is a shell redirection which touches the worktree directly, writing results to the wrong place in the presence of a GIT_WORK_TREE variable. This means that merges won't even fail; they will silently produce incorrect results, throwing out the entire "theirs" side of files which need content-level merging! This patch makes merge-one-file chdir to the toplevel of the working tree (and exit if we don't have one). This most closely matches the assumption made by the original script (before separate work trees were invented), and matches what happens when the script is called as part of a merge strategy. While we're at it, we'll also error-check the call to cat. Merging a file in a subdirectory could in fact fail, as the redirection relies on the "checkout-index" call just prior to create leading directories. But we never noticed, since we ignored the error return from running cat. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29add tests for merge-index / merge-one-fileLibravatar Jeff King1-0/+100
There were no tests for either, except a brief use in t1200-tutorial. These tools are not used much these days, as most people use the merge-recursive strategy, which handles everything internally. However, they are used by the "octopus" and "resolve" strategies, as well as any custom strategies or merge scripts people have built around them. For example, together with read-tree, they are the simplest way to do a basic content-level merge without checking out the entire repository contents beforehand. This script adds a basic test of the tools to perform one content-level merge. It also shows a failure of the tools to work properly in the face of GIT_WORK_TREE or core.worktree. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29t3701: Editing a split hunk in an "add -p" sessionLibravatar Junio C Hamano1-0/+36
Arnaud Lacombe reported that with the recent change to reject overlapping hunks fed to "git apply", the edit mode of an "add -p" session that lazily feeds overlapping hunks without coalescing adjacent ones claim that the patch does not apply. Expose the problem to be fixed. Cf. http://thread.gmane.org/gmane.comp.version-control.git/170685/focus=171000 Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-29Merge branch 'mg/x-years-12-months' into maintLibravatar Junio C Hamano1-0/+1
* mg/x-years-12-months: date: avoid "X years, 12 months" in relative dates
2011-04-29blame: tolerate bogus e-mail addresses a bit betterLibravatar Josh Stone2-2/+12
The names and e-mails are sanitized by fmt_ident() when creating commits, so that they do not contain "<" nor ">", and the "committer" and "author" lines in the commit object will always be in the form: ("author" | "committer") name SP "<" email ">" SP timestamp SP zone When parsing the email part out, the current code looks for SP starting from the end of the email part, but the author could obfuscate the address as "author at example dot com". We should instead look for SP followed by "<", to match the logic of the side that formats these lines. Signed-off-by: Josh Stone <jistone@redhat.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-28git-rebase--interactive.sh: preserve-merges fails on merges created with no-ffLibravatar Andrew Wong1-1/+31
'git rebase' uses 'git merge' to preserve merges (-p). This preserves the original merge commit correctly, except when the original merge commit was created by 'git merge --no-ff'. In this case, 'git rebase' will fail to preserve the merge, because during 'git rebase', 'git merge' will simply fast-forward and skip the commit. For example: B / \ A---M / ---o---O---P---Q If we try to rebase M onto P, we lose the merge commit and this happens: A---B / ---o---O---P---Q To correct this, we simply do a "no fast-forward" on all merge commits when rebasing. Since by the time we decided to do a 'git merge' inside 'git rebase', it means there was a merge originally, so 'git merge' should always create a merge commit regardless of what the merge branches look like. This way, when rebase M onto P from the above example, we get: B / \ A---M / ---o---O---P---Q Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-26pretty: quote rfc822 specials in email addressesLibravatar Jeff King1-0/+42
If somebody has a name that includes an rfc822 special, we will output it literally in the "From:" header. This is usually OK, but certain characters (like ".") are supposed to be enclosed in double-quotes in a mail header. In practice, whether this matters may depend on your MUA. Some MUAs will happily take in: From: Foo B. Bar <author@example.com> without quotes, and properly quote the "." when they send the actual mail. Others may not, or may screw up harder things like: From: Foo "The Baz" Bar <author@example.com> For example, mutt will strip the quotes, thinking they are actual syntactic rfc822 quotes. So let's quote properly, and then (if necessary) we still apply rfc2047 encoding on top of that, which should make all MUAs happy. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-23Fix "add -u" that sometimes fails to resolve unmerged pathsLibravatar Junio C Hamano1-17/+7
"git add -u" updates the index with the updated contents from the working tree by internally running "diff-files" to grab the set of paths that are different from the index. Then it updates the index entries for the paths that are modified in the working tree, and deletes the index entries for the paths that are deleted in the working tree. It ignored the output from the diff-files that indicated that a path is unmerged. For these paths, it instead relied on the fact that an unmerged path is followed by the result of comparison between stage #2 (ours) and the working tree, and used that to update or delete such a path when it is used to record the resolution of a conflict. As the result, when a path did not have stage #2 (e.g. "we deleted while the other side added"), these unmerged stages were left behind, instead of recording what the user resolved in the working tree. Since we recently fixed "diff-files" to indicate if the corresponding path exists on the working tree for an unmerged path, we do not have to rely on the comparison with stage #2 anymore. We can instead tell the diff-files not to compare with higher stages, and use the unmerged output to update the index to reflect the state of the working tree. The changes to the test vector in t2200 illustrates the nature of the bug and the fix. The test expected stage #1 and #3 entries be left behind, but it was codifying the buggy behaviour. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-23diff-files: show unmerged entries correctlyLibravatar Junio C Hamano1-0/+87
Earlier, e9c8409 (diff-index --cached --raw: show tree entry on the LHS for unmerged entries., 2007-01-05) taught the command to show the object name and the mode from the entry coming from the tree side when comparing a tree with an unmerged index. This is a belated companion patch that teaches diff-files to show the mode from the entry coming from the working tree side, when comparing an unmerged index and the working tree. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-23test: use $_z40 from test-libLibravatar Junio C Hamano12-22/+15
There is no need to duplicate the definition of $_z40 and $_x40 that test-lib.sh supplies the test scripts. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-20date: avoid "X years, 12 months" in relative datesLibravatar Michael J Gruber1-0/+1
When relative dates are more than about a year ago, we start writing them as "Y years, M months". At the point where we calculate Y and M, we have the time delta specified as a number of days. We calculate these integers as: Y = days / 365 M = (days % 365 + 15) / 30 This rounds days in the latter half of a month up to the nearest month, so that day 16 is "1 month" (or day 381 is "1 year, 1 month"). We don't round the year at all, though, meaning we can end up with "1 year, 12 months", which is silly; it should just be "2 years". Implement this differently with months of size onemonth = 365/12 so that totalmonths = (long)( (days + onemonth/2)/onemonth ) years = totalmonths / 12 months = totalmonths % 12 In order to do this without floats, we write the first formula as totalmonths = (days*12*2 + 365) / (365*2) Tests and inspiration by Jeff King. Helped-by: Jeff King <peff@peff.net> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-14Merge branch 'maint'Libravatar Junio C Hamano2-1/+5
* maint: archive: document limitation of tar.umask config setting t3306,t5304: avoid clock skew issues git.txt: fix list continuation
2011-04-14t3306,t5304: avoid clock skew issuesLibravatar Michael J Gruber2-1/+5
On systems where the local time and file modification time may be out of sync (e.g. test directory on NFS) t3306 and t5305 can fail because prune compares times such as "now" (client time) with file modification times (server times for remote file systems). I.e., these are spurious test failures. Avoid this by setting the relevant modification times to the local time. Noticed on a system with as little as 2s time skew. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-13Merge branch 'js/checkout-untracked-symlink' into maintLibravatar Junio C Hamano1-1/+1
* js/checkout-untracked-symlink: t2021: mark a test as fixed
2011-04-13mergetool: Teach about submodulesLibravatar Jonathon Mah1-3/+287
When the index has conflicted submodules, mergetool used to mildly clobber the module, renaming it to mymodule.BACKUP.nnnn, then failing to copy it non-recursively. Recognize submodules and offer a resolution instead: Submodule merge conflict for 'Shared': {local}: submodule commit ad9f12e3e6205381bf2163a793d1e596a9e211d0 {remote}: submodule commit f5893fb70ec5646efcd9aa643c5136753ac89253 Use (l)ocal or (r)emote, or (a)bort? Selecting a commit will stage it, but not update the submodule (as git does had there been no conflict). Type changes are also supported, should the path be a submodule on one side, and a file, symlink, directory, or deleted on the other. Signed-off-by: Jonathon Mah <me@JonathonMah.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-12Merge branch 'js/checkout-untracked-symlink'Libravatar Junio C Hamano1-1/+1
* js/checkout-untracked-symlink: t2021: mark a test as fixed
2011-04-12Merge branch 'nd/init-gitdir'Libravatar Junio C Hamano1-1/+1
* nd/init-gitdir: t0001: guard a new test with SYMLINKS prerequisite
2011-04-12t2021: mark a test as fixedLibravatar Johannes Sixt1-1/+1
The failure was fixed by the previous commit. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11t0001: guard a new test with SYMLINKS prerequisiteLibravatar Johannes Sixt1-1/+1
Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11Teach --dirstat not to completely ignore rearranged lines within a fileLibravatar Johan Herland2-2/+1
Currently, the --dirstat analysis ignores when lines within a file are rearranged, because the "damage" calculated by show_dirstat() is 0. However, if the object name has changed, we already know that there is some damage, and it is unintuitive to claim there is _no_ damage. Teach show_dirstat() to assign a minimum amount of damage (== 1) to entries for which the analysis otherwise yields zero damage, to still represent that these files are changed, instead of saying that there is no change. Also, skip --dirstat analysis when the object names are the same (e.g. for a pure file rename). Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11--dirstat-by-file: Make it faster and more correctLibravatar Johan Herland2-0/+5
Currently, when using --dirstat-by-file, it first does the full --dirstat analysis (using diffcore_count_changes()), and then resets 'damage' to 1, if any damage was found by diffcore_count_changes(). But --dirstat-by-file is not interested in the file damage per se. It only cares if the file changed at all. In that sense it only cares if the blob object for a file has changed. We therefore only need to compare the object names of each file pair in the diff queue and we can skip the entire --dirstat analysis and simply set 'damage' to 1 for each entry where the object name has changed. This makes --dirstat-by-file faster, and also bypasses --dirstat's practice of ignoring rearranged lines within a file. The patch also contains an added testcase verifying that --dirstat-by-file now detects changes that only rearrange lines within a file. Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-11--dirstat: Describe non-obvious differences relative to --stat or regular diffLibravatar Johan Herland5-7/+36
Also add a testcase documenting the current behavior. Improved-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Johan Herland <johan@herland.net> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-07stash: ensure --no-keep-index and --patch can be used in any orderLibravatar Dan McGee1-1/+1
Don't assume one comes after the other on the command line. Use a three-state variable to track and check its value accordingly. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-07stash: add two more tests for --no-keep-indexLibravatar Dan McGee2-0/+20
One of these passes just fine; the other one exposes a problem where command line flag order matters for --no-keep-index and --patch interaction. Signed-off-by: Dan McGee <dpmcgee@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-06Merge branch 'nm/maint-conflicted-submodule-entries' into maintLibravatar Junio C Hamano1-6/+52
* nm/maint-conflicted-submodule-entries: submodule: process conflicting submodules only once
2011-04-06Merge branch 'jk/maint-remote-mirror-safer'Libravatar Junio C Hamano1-0/+78
* jk/maint-remote-mirror-safer: remote: deprecate --mirror remote: separate the concept of push and fetch mirrors remote: disallow some nonsensical option combinations