Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-21t: convert fgrep usage to "grep -F"Đoàn Trần Công Danh
Despite POSIX states that: > The old egrep and fgrep commands are likely to be supported for many > years to come as implementation extensions, allowing historical > applications to operate unmodified. GNU grep 3.8 started to warn[1]: > The egrep and fgrep commands, which have been deprecated since > release 2.5.3 (2007), now warn that they are obsolescent and should > be replaced by grep -E and grep -F. Prepare for their removal in the future. [1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-30tests: add missing double quotes to included library pathsÆvar Arnfjörð Bjarmason
Fix inclusion errors which would occur if the $TEST_DIRECTORY had $IFS whitespace in it. See d42bab442d7 (core.fsyncmethod: tests for batch mode, 2022-04-04) and a242c150ebb (vimdiff: integrate layout tests in the unit tests framework ('t' folder), 2022-03-30) for the two relevant commits. Both were first released with v2.37.0-rc0 (and were also part of v2.37.0). Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-04-06core.fsyncmethod: tests for batch modeNeeraj Singh
Add test cases to exercise batch mode for: * 'git add' * 'git stash' * 'git update-index' * 'git unpack-objects' These tests ensure that the added data winds up in the object database. In this change we introduce a new test helper lib-unique-files.sh. The goal of this library is to create a tree of files that have different oids from any other files that may have been created in the current test repo. This helps us avoid missing validation of an object being added due to it already being in the repo. Signed-off-by: Neeraj Singh <neerajsi@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-13t0000-t3999: detect and signal failure within loopEric Sunshine
Failures within `for` and `while` loops can go unnoticed if not detected and signaled manually since the loop itself does not abort when a contained command fails, nor will a failure necessarily be detected when the loop finishes since the loop returns the exit code of the last command it ran on the final iteration, which may not be the command which failed. Therefore, detect and signal failures manually within loops using the idiom `|| return 1` (or `|| exit 1` within subshells). Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-13tests: apply modern idiom for signaling test failureEric Sunshine
Simplify the way these tests signal failure by employing the modern idiom of making the `if` or `case` statement resolve to false when an error is detected. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-12-13tests: fix broken &&-chains in compound statementsEric Sunshine
The top-level &&-chain checker built into t/test-lib.sh causes tests to magically exit with code 117 if the &&-chain is broken. However, it has the shortcoming that the magic does not work within `{...}` groups, `(...)` subshells, `$(...)` substitutions, or within bodies of compound statements, such as `if`, `for`, `while`, `case`, etc. `chainlint.sed` partly fills in the gap by catching broken &&-chains in `(...)` subshells, but bugs can still lurk behind broken &&-chains in the other cases. Fix broken &&-chains in compound statements in order to reduce the number of possible lurking bugs. Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Reviewed-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-10-08ls-files: fix a trivial dir_clear() leakÆvar Arnfjörð Bjarmason
Fix an edge case that was missed when the dir_clear() call was added in eceba532141 (dir: fix problematic API to avoid memory leaks, 2020-08-18), we need to also clean up when we're about to exit with non-zero. That commit says, on the topic of the dir_clear() API and UNLEAK(): [...]two of them clearly thought about leaks since they had an UNLEAK(dir) directive, which to me suggests that the method to free the data was too unclear. I think that 0e5bba53af7 (add UNLEAK annotation for reducing leak false positives, 2017-09-08) which added the UNLEAK() makes it clear that that wasn't the case, rather it was the desire to avoid the complexity of freeing the memory at the end of the program. This does add a bit of complexity, but I think it's worth it to just fix these leaks when it's easy in built-ins. It allows them to serve as canaries for underlying APIs that shouldn't be leaking, it encourages us to make those freeing APIs nicer for all their users, and it prevents other leaking regressions by being able to mark the entire test as TEST_PASSES_SANITIZE_LEAK=true. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-05-14Merge branch 'ow/no-dryrun-in-add-i'Junio C Hamano
"git add -i --dry-run" does not dry-run, which was surprising. The combination of options has taught to error out. * ow/no-dryrun-in-add-i: add: die if both --dry-run and --interactive are given
2021-05-07add: die if both --dry-run and --interactive are givenØystein Walle
The interactive machinery does not obey --dry-run. Die appropriately if both flags are passed. Signed-off-by: Øystein Walle <oystwa@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-04-09add: include magic part of pathspec on --refresh errorMatheus Tavares
When `git add --refresh <pathspec>` doesn't find any matches for the given pathspec, it prints an error message using the `match` field of the `struct pathspec_item`. However, this field doesn't contain the magic part of the pathspec. Instead, let's use the `original` field. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-26Merge branch 'mt/add-chmod-fixes'Junio C Hamano
Various fixes on "git add --chmod". * mt/add-chmod-fixes: add: propagate --chmod errors to exit status add: mark --chmod error string for translation add --chmod: don't update index when --dry-run is used
2021-02-24add: propagate --chmod errors to exit statusMatheus Tavares
If `add` encounters an error while applying the --chmod changes, it prints a message to stderr, but exits with a success code. This might have been an oversight, as the command does exit with a non-zero code in other situations where it cannot (or refuses to) update all of the requested paths (e.g. when some of the given paths are ignored). So make the exit behavior more consistent by also propagating --chmod errors to the exit status. Note: the test "all statuses changed in folder if . is given" uses paths added by previous test cases, some of which might be symbolic links. Because `git add --chmod` will now fail with such paths, this test would depend on whether all the previous tests were executed, or only some of them. Avoid that by running the test on a fresh repo with only regular files. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-24add: mark --chmod error string for translationMatheus Tavares
This error message is intended for humans, so mark it for translation. Also use error() instead of fprintf(stderr, ...), to make the corresponding line a bit cleaner, and to display the "error:" prefix, which helps classifying the nature/severity of the message. Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-24add --chmod: don't update index when --dry-run is usedMatheus Tavares
`git add --chmod` applies the mode changes even when `--dry-run` is used. Fix that and add some tests for this option combination. Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-02-11tests: remove most uses of test_i18ncmpÆvar Arnfjörð Bjarmason
As a follow-up to d162b25f956 (tests: remove support for GIT_TEST_GETTEXT_POISON, 2021-01-20) remove most uses of test_i18ncmp via a simple s/test_i18ncmp/test_cmp/g search-replacement. I'm leaving t6300-for-each-ref.sh out due to a conflict with in-flight changes between "master" and "seen", as well as the prerequisite itself due to other changes between "master" and "next/seen" which add new test_i18ncmp uses. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-03-23t: fix whitespace around &&Andrei Rybak
Add missing spaces before '&&' and switch tabs around '&&' to spaces. Also fix the space after redirection operator in t3701 while we're here. These issues were found using `git grep '[^ ]&&$'` and `git grep -P '&&\t' t/`. Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-02-06add: change advice config variables used by the add APIHeba Waly
advice.addNothing config variable is used to control the visibility of two advice messages in the add library. This config variable is replaced by two new variables, whose names are more clear and relevant to the two cases. Also add the two new variables to the documentation. Signed-off-by: Heba Waly <heba.waly@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-01-15add: use advise function to display hintsHeba Waly
Use the advise function in advice.c to display hints to the users, as it provides a neat and a standard format for hint messages, i.e: the text is colored in yellow and the line starts by the word "hint:". Also this will enable us to control the messages using advice.* configuration variables. Signed-off-by: Heba Waly <heba.waly@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-10add: error appropriately on repository with no commitsKyle Meyer
The previous commit made 'git add' abort when given a repository that doesn't have a commit checked out. However, the output upon failure isn't appropriate: % git add repo warning: adding embedded git repository: repo hint: You've added another git repository inside your current repository. hint: [...] error: unable to index file 'repo/' fatal: adding files failed The hint doesn't apply in this case, and the error message doesn't tell the user why 'repo' couldn't be added to the index. Provide better output by teaching add_to_index() to error when given a git directory where HEAD can't be resolved. To avoid the embedded repository warning and hint, call check_embedded_repo() only after add_file_to_index() succeeds because, in general, its output doesn't make sense if adding to the index fails. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-10dir: do not traverse repositories with no commitsKyle Meyer
When treat_directory() encounters a directory that is not in the index and DIR_NO_GITLINKS is unset, it calls resolve_gitlink_ref() to decide if a directory looks like a repository, in which case the directory won't be traversed. As a result, 'status -uall' and 'ls-files -o' will show only the directory, even when there are untracked files within the directory. For the unusual case where a repository doesn't have a commit checked out, resolve_gitlink_ref() returns -1 because HEAD cannot be resolved, and the directory is treated as a normal directory (i.e. traversal does not stop at the repository boundary). The status and ls-files commands above list untracked files within the repository rather than showing only the top-level directory. And if 'git add' is called on a repository with no commit checked out, any untracked files under the repository are added as blobs in the top-level project, a behavior that is unlikely to be what the caller intended. The above case is a corner case in an already unusual situation of the working tree containing a repository that is not a tracked submodule, but we might as well treat anything that looks like a repository consistently. Loosen the "looks like a repository" criteria in treat_directory() by replacing resolve_gitlink_ref() with is_nonbare_repository_dir(), one of the checks that is performed downstream when resolve_gitlink_ref() is called. As the required update to t3700-add shows, calling 'git add' on a repository with no commit checked out will now raise an error. While this is the desired behavior, note that the output isn't yet appropriate. The next commit will improve this output. Signed-off-by: Kyle Meyer <kyle@kyleam.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-01-18abspath_part_inside_repo: respect core.ignoreCaseJohannes Schindelin
If the file system is case-insensitive, we really must be careful to ignore differences in case only. This fixes https://github.com/git-for-windows/git/issues/735 Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-08-20Merge branch 'ab/test-must-be-empty-for-master'Junio C Hamano
Test updates. * ab/test-must-be-empty-for-master: tests: make use of the test_must_be_empty function
2018-07-30tests: make use of the test_must_be_empty functionÆvar Arnfjörð Bjarmason
Change various tests that use an idiom of the form: >expect && test_cmp expect actual To instead use: test_must_be_empty actual The test_must_be_empty() wrapper was introduced in ca8d148daf ("test: test_must_be_empty helper", 2013-06-09). Many of these tests have been added after that time. This was mostly found with, and manually pruned from: git grep '^\s+>.*expect.* &&$' t Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-07-17t3000-t3999: fix broken &&-chainsEric Sunshine
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-03-27t/helper: merge test-chmtime into test-toolNguyễn Thái Ngọc Duy
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06Merge branch 'ex/deprecate-empty-pathspec-as-match-all'Junio C Hamano
The final step to make an empty string as a pathspec element illegal. We started this by first deprecating and warning a pathspec that has such an element in 2.11 (Nov 2016). Hopefully we can merge this down to the 'master' by the end of the year? A deprecation warning period that is about 1 year does not sound too bad. * ex/deprecate-empty-pathspec-as-match-all: pathspec: die on empty strings as pathspec t0027: do not use an empty string as a pathspec element
2017-08-08t3700: fix broken test under !POSIXPERMRené Scharfe
76e368c378 (t3700: fix broken test under !SANITY) explains that the test 'git add --chmod=[+-]x changes index with already added file' can fail if xfoo3 is still present as a symlink from a previous test and deletes it with rm(1). That still leaves it present in the index, which causes the test to fail if POSIXPERM is not defined. Get rid of it by calling "git reset --hard" as well, as 76e368c378 already mentioned in passing. Helped-by: Adam Dinwoodie <adam@dinwoodie.org> Signed-off-by: Rene Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-06-23pathspec: die on empty strings as pathspecEmily Xie
An empty string as a pathspec element matches all paths. A buggy script, however, could accidentally assign an empty string to a variable that then gets passed to a Git command invocation, e.g.: path=... compute a path to be removed in $path ... git rm -r "$path" which would unintentionally remove all paths in the current directory. The fix for this issue comprises of two steps. Step 1, which warns that empty strings as pathspecs will become invalid, has already been implemented in commit d426430 ("pathspec: warn on empty strings as pathspec", 2016-06-22). This patch is step 2. It removes the warning and throws an error instead. Signed-off-by: Emily Xie <emilyxxie@gmail.com> Reported-by: David Turner <novalis@novalis.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-10-26Merge branch 'ex/deprecate-empty-pathspec-as-match-all'Junio C Hamano
An empty string used as a pathspec element has always meant 'everything matches', but it is too easy to write a script that finds a path to remove in $path and run 'git rm "$paht"', which ends up removing everything. Start warning about this use of an empty string used for 'everything matches' and ask users to use a more explicit '.' for that instead. The hope is that existing users will not mind this change, and eventually the warning can be turned into a hard error, upgrading the deprecation into removal of this (mis)feature. * ex/deprecate-empty-pathspec-as-match-all: pathspec: warn on empty strings as pathspec
2016-10-20t3700: fix broken test under !SANITYJunio C Hamano
An "add --chmod=+x" test recently added by 610d55af0f ("add: modify already added files when --chmod is given", 2016-09-14) used "xfoo3" as a test file. The paths xfoo[1-3] were used by earlier tests for symbolic links but they were expected to have been removed by the time the execution reached this new test. The removal with "git reset --hard" however happened in a pair of earlier tests, both of which are protected by POSIXPERM,SANITY prerequisites. Platforms and test environments that lacked these would have seen xfoo3 as a leftover symbolic link that points at somewhere else at this point of the sequence, and the chmod test would have given a wrong result. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-22t3700-add: do not check working tree file mode without POSIXPERMJohannes Sixt
A recently introduced test checks the result of 'git status' after setting the executable bit on a file. This check does not yield the expected result when the filesystem does not support the executable bit. What we care about is that a file added with "--chmod=+x" has executable bit in the index and that "--chmod=+x" (or any other options for that matter) does not muck with working tree files. The former is tested by other existing tests, so let's check the latter more explicitly and only under POSIXPERM prerequisite. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-21t3700-add: create subdirectory gentlyJohannes Sixt
The subdirectory 'sub' is created early in the test file. Later, a test case removes it during its clean-up actions. However, this test case is protected by POSIXPERM. Consequently, 'sub' remains when the POSIXPERM prerequisite is not satisfied. Later, a recently introduced test case creates 'sub' again. Use -p with mkdir so that it does not fail if 'sub' already exists. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-09-15add: modify already added files when --chmod is givenThomas Gummerer
When the chmod option was added to git add, it was hooked up to the diff machinery, meaning that it only works when the version in the index differs from the version on disk. As the option was supposed to mirror the chmod option in update-index, which always changes the mode in the index, regardless of the status of the file, make sure the option behaves the same way in git add. Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-02t3700: add a test_mode_in_index helper functionIngo Brückl
The case statement to check the file mode of a staged file appears a number of times. Simplify the test by utilizing a test_mode_in_index helper function. Signed-off-by: Ingo Brückl <ib@wupperonline.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-02t3700: merge two tests into oneIngo Brückl
Depending on the underlying platform a chmod may be a noop. Although it wouldn't harm the result of the '--chmod=-x' test, there is a more robust way to make sure the --chmod option works both ways. Merge the two separate tests for the --chmod option into one, checking both permissions on the same file. Signed-off-by: Ingo Brückl <ib@wupperonline.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-02t3700: remove unwanted leftover files before running new testsIngo Brückl
When an earlier test that has prerequisite is skipped, files used by later tests may be left in the working tree in an unexpected state. For example, a test runs this sequence: echo foo >xfoo1 && chmod 755 xfoo1 to create an executable file xfoo1, expecting that xfoo1 does not exist before it runs in the test sequence. However, the absence of this file depends on "git reset --hard" done in an earlier test, that is skipped when SANITY prerequisite is not met, and worse yet, xfoo1 originally is created as a symbolic link, which means the chmod does not affect the modes of xfoo1 as this test expects. Fix this by starting the test with "rm -f xfoo1" to make sure the file is created from scratch, and do the same to other similar tests. Signed-off-by: Ingo Brückl <ib@wupperonline.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-23pathspec: warn on empty strings as pathspecEmily Xie
An empty string as a pathspec element matches all paths. A buggy script, however, could accidentally assign an empty string to a variable that then gets passed to a Git command invocation, e.g.: path=... compute a path to be removed in $path ... git rm -r "$paht" which would unintentionally remove all paths in the current directory. The fix for this issue requires a two-step approach. As there may be existing scripts that knowingly use empty strings in this manner, the first step simply gives a warning that (1) tells that an empty string will become an invalid pathspec element and (2) asks the user to use "." if they mean to match all. For step two, a follow-up patch several release cycles later will remove the warning and throw an error instead. This patch is the first step. Signed-off-by: Emily Xie <emilyxxie@gmail.com> Reported-by: David Turner <novalis@novalis.org> Mentored-by: Michail Denchev <mdenchev@gmail.com> Thanks-to: Sarah Sharp <sarah@thesharps.us> and James Sharp <jamey@minilop.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-08add: add --chmod=+x / --chmod=-x optionsEdward Thomson
The executable bit will not be detected (and therefore will not be set) for paths in a repository with `core.filemode` set to false, though the users may still wish to add files as executable for compatibility with other users who _do_ have `core.filemode` functionality. For example, Windows users adding shell scripts may wish to add them as executable for compatibility with users on non-Windows. Although this can be done with a plumbing command (`git update-index --add --chmod=+x foo`), teaching the `git-add` command allows users to set a file executable with a command that they're already familiar with. Signed-off-by: Edward Thomson <ethomson@edwardthomson.com> Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-12-29t/t3700-add.sh: use the $( ... ) construct for command substitutionElia Pinto
The Git CodingGuidelines prefer the $(...) construct for command substitution instead of using the backquotes `...`. The backquoted form is the traditional method for command substitution, and is supported by POSIX. However, all but the simplest uses become complicated quickly. In particular, embedded command substitutions and/or the use of double quotes require careful escaping with the backslash character. The patch was generated by: for _f in $(find . -name "*.sh") do perl -i -pe 'BEGIN{undef $/;} s/`(.+?)`/\$(\1)/smg' "${_f}" done and then carefully proof-read. Signed-off-by: Elia Pinto <gitter.spiros@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-21add: ignore only ignored filesMichael J Gruber
"git add foo bar" adds neither foo nor bar when bar is ignored, but dies to let the user recheck their command invocation. This becomes less helpful when "git add foo.*" is subject to shell expansion and some of the expanded files are ignored. "git add --ignore-errors" is supposed to ignore errors when indexing some files and adds the others. It does ignore errors from actual indexing attempts, but does not ignore the error "file is ignored" as outlined above. This is unexpected. Change "git add foo bar" to add foo when bar is ignored, but issue a warning and return a failure code as before the change. That is, in the case of trying to add ignored files we now act the same way (with or without "--ignore-errors") in which we act for more severe indexing errors when "--ignore-errors" is specified. Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-12-26add: don't complain when adding empty project rootNguyễn Thái Ngọc Duy
This behavior was added in 07d7bed (add: don't complain when adding empty project root - 2009-04-28) then broken by 84b8b5d (remove match_pathspec() in favor of match_pathspec_depth() - 2013-07-14). Reinstate it. Noticed-by: Thomas Ferris Nicolaisen <tfnico@gmail.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-08tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)Johannes Sixt
There are many instances where the treatment of symbolic links in the object model and the algorithms are tested, but where it is not necessary to actually have a symbolic link in the worktree. Make adjustments to the tests and remove the SYMLINKS prerequisite when appropriate in trivial cases, where "trivial" means: - merely a replacement of 'ln -s a b && git add b' by test_ln_s_add is needed; - a test for symbolic link on the file system can be split off (and remains protected by SYMLINKS); - existing code is equivalent to test_ln_s_add. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-02-17refresh_index: do not show unmerged path that is outside pathspecJunio C Hamano
When running "git add --refresh <pathspec>", we incorrectly showed the path that is unmerged even if it is outside the specified pathspec, even though we did honor pathspec and refreshed only the paths that matched. Note that this cange does not affect "git update-index --refresh"; for hysterical raisins, it does not take a pathspec (it takes real paths) and more importantly itss command line options are parsed and executed one by one as they are encountered, so "git update-index --refresh foo" means "first refresh the index, and then update the entry 'foo' by hashing the contents in file 'foo'", not "refresh only entry 'foo'". Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-04-14i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-add "did not match any files" messageÆvar Arnfjörð Bjarmason
Make the "did not match any files" message translatable, and skip the test that checks for it when the C_LOCALE_OUTPUT prereq is not present. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-10i18n: git-add "The following paths are ignored" messageÆvar Arnfjörð Bjarmason
The tests t2204 (.gitignore) and t3700 (add) explicitly check for these messages, so while at it, split each relevant test into a part that just checks "git add"'s exit status and a part that checks porcelain output. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-08-18tests: A SANITY test prereq for testing if we're rootÆvar Arnfjörð Bjarmason
Some tests depend on not being able to write to files after chmod -w. This doesn't work when running the tests as root. Change test-lib.sh to test if this works, and if so it sets a new SANITY test prerequisite. The tests that use this previously failed when run under root. There was already a test for this in t3600-rm.sh, added by Junio C Hamano in 2283645 in 2006. That check now uses the new SANITY prerequisite. Some of this was resurrected from the "Tests in Cygwin" thread in May 2009: http://thread.gmane.org/gmane.comp.version-control.git/116729/focus=118385 Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-26t3700-add: fix dependence on stdout and stderr bufferingJohannes Sixt
One test case checked the stdout and stderr of 'git add' by constructing a single 'expect' file that contained both streams. But when the command runs, the order of stdout and stderr output is unpredictable because it depends on how the streams are buffered. At least on Windows, the buffering is different from what the test case expected. Hence, check the two output texts separately. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Acked-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-20t/t3700: convert two uses of negation operator '!' to use test_must_failBrandon Casey
These two lines use the negation '!' operator to negate the result of a simple command. Since these commands do not contain any pipes or other complexities, the test_must_fail function can be used and is preferred since it will additionally detect termination due to a signal. This was noticed because the second use of '!' does not include a space between the '!' and the opening parens. Ksh interprets this as follows: !(pattern-list) Matches anything except one of the given patterns. Ksh performs a file glob using the pattern-list and then tries to execute the first file in the list. If a space is added between the '!' and the open parens, then Ksh will not interpret it as a pattern list, but in this case, it is preferred to use test_must_fail, so lets do so. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-07-13git add: Add the "--ignore-missing" option for the dry runJens Lehmann
Sometimes it is useful to know if a file or directory will be ignored before it is added to the work tree. An example is "git submodule add", where it would be really nice to be able to fail with an appropriate error message before the submodule is cloned and checked out. Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>