summaryrefslogtreecommitdiff
path: root/tests/stash
Commit message (Collapse)AuthorAgeFilesLines
* tests: declare functions statically where appropriateEdward Thomson2021-11-112-4/+4
|
* path: separate git-specific path functions from utilEdward Thomson2021-11-092-17/+17
| | | | | | Introduce `git_fs_path`, which operates on generic filesystem paths. `git_path` will be kept for only git-specific path functionality (for example, checking for `.git` in a path).
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-172-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | libgit2 has two distinct requirements that were previously solved by `git_buf`. We require: 1. A general purpose string class that provides a number of utility APIs for manipulating data (eg, concatenating, truncating, etc). 2. A structure that we can use to return strings to callers that they can take ownership of. By using a single class (`git_buf`) for both of these purposes, we have confused the API to the point that refactorings are difficult and reasoning about correctness is also difficult. Move the utility class `git_buf` to be called `git_str`: this represents its general purpose, as an internal string buffer class. The name also is an homage to Junio Hamano ("gitstr"). The public API remains `git_buf`, and has a much smaller footprint. It is generally only used as an "out" param with strict requirements that follow the documentation. (Exceptions exist for some legacy APIs to avoid breaking callers unnecessarily.) Utility functions exist to convert a user-specified `git_buf` to a `git_str` so that we can call internal functions, then converting it back again.
* reflog: allow adding entries with newlines in their messagePatrick Steinhardt2019-10-181-0/+20
| | | | | | | | | | | | | | | | | | Currently, the reflog disallows any entries that have a message with newlines, as that would effectively break the reflog format, which may contain a single line per entry, only. Upstream git behaves a bit differently, though, especially when considering stashes: instead of rejecting any reflog entry with newlines, git will simply replace newlines with spaces. E.g. executing 'git stash push -m "foo\nbar"' will create a reflog entry with "foo bar" as entry message. This commit adjusts our own logic to stop rejecting commit messages with newlines. Previously, this logic was part of `git_reflog_append`, only. There is a second place though where we add reflog entries, which is the serialization code in the filesystem refdb. As it didn't contain any sanity checks whatsoever, the refdb would have been perfectly happy to write malformatted reflog entries to the disk. This is being fixed with the same logic as for the reflog itself.
* fileops: rename to "futils.h" to match function signaturesPatrick Steinhardt2019-07-205-5/+5
| | | | | | | | | Our file utils functions all have a "futils" prefix, e.g. `git_futils_touch`. One would thus naturally guess that their definitions and implementation would live in files "futils.h" and "futils.c", respectively, but in fact they live in "fileops.h". Rename the files to match expectations.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-9/+9
| | | | Use the new object_type enumeration names within the codebase.
* Merge pull request #4702 from tiennou/fix/coverityPatrick Steinhardt2018-07-201-1/+1
|\ | | | | Assorted Coverity fixes
| * tests: add missing cl_git_pass to testsEtienne Samson2018-07-061-1/+1
| | | | | | Reported by Coverity, CID 1393678-1393697.
* | treewide: remove use of C++ style commentsPatrick Steinhardt2018-07-131-2/+2
|/ | | | | | | | | C++ style comment ("//") are not specified by the ISO C90 standard and thus do not conform to it. While libgit2 aims to conform to C90, we did not enforce it until now, which is why quite a lot of these non-conforming comments have snuck into our codebase. Do a tree-wide conversion of all C++ style comments to the supported C style comments to allow us enforcing strict C90 compliance in a later commit.
* Fix last references to deprecated git_buf_freeSven Strickroth2018-06-181-1/+1
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Merge pull request #4436 from pks-t/pks/packfile-stream-freeEdward Thomson2018-06-111-2/+2
|\ | | | | pack: rename `git_packfile_stream_free`
| * Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-2/+2
| |
* | stash test: free the commitEdward Thomson2018-06-111-0/+1
| |
* | stash test: free the referenceEdward Thomson2018-06-101-0/+1
| |
* | Fix stash save bug with fast path index checkDavid Turner2018-06-061-0/+40
|/ | | | | | | | | | | | If the index contains stat data for a modified file, and the file is not racily dirty, and there exists an untracked working tree directory alphabetically after that file, and there are no other changes to the repo, then git_stash_save would fail. It would confuse the untracked working tree directory for the modified file, because they have the same sha: zero. The wt directory has a sha of zero because it's a directory, and the file would have a zero sha because we wouldn't read the file -- we would just know that it doesn't match the index. To fix this confusion, we simply check mode as well as SHA.
* stash: const up conflict paramsEdward Thomson2015-06-291-1/+1
|
* stash: test we apply using reflog-like indicesEdward Thomson2015-06-261-0/+34
|
* stash: stage new files when unstashing themEdward Thomson2015-06-251-2/+50
| | | | | Files that were new (staged additions) in the stash tree should be staged when unstashing, even when not applying the index.
* stash: don't allow apply with staged changesEdward Thomson2015-06-251-1/+18
|
* stash apply: add a newly staged file to testsEdward Thomson2015-06-251-8/+19
|
* stash tests: ensure we save the workdir fileEdward Thomson2015-06-233-11/+26
| | | | | | Ensure that when a file is added in the index and subsequently modified in the working directory, the stashed working directory tree contains the actual working directory contents.
* Fixed index being double-freed in stash testsPierre-Olivier Latour2015-06-201-2/+0
|
* Fixed build warnings on Xcode 6.1Pierre-Olivier Latour2015-06-021-1/+7
|
* Rename GIT_EMERGECONFLICT to GIT_ECONFLICTEdward Thomson2015-05-291-5/+5
| | | | | | | | | | We do not error on "merge conflicts"; on the contrary, merge conflicts are a normal part of merging. We only error on "checkout conflicts", where a change exists in the index or the working directory that would otherwise be overwritten by performing the checkout. This *may* happen during merge (after the production of the new index that we're going to checkout) but it could happen during any checkout.
* Fix a few leaksCarlos Martín Nieto2015-05-131-0/+2
| | | | | The interesting one is the notification macro, which was returning directly on a soft-abort instead of going through the cleanup.
* stash_apply: provide progress callbacksEdward Thomson2015-05-111-0/+45
|
* stash_apply: provide its own options structureEdward Thomson2015-05-111-17/+38
|
* stash: test checkout notify callbacksEdward Thomson2015-05-111-0/+52
|
* stash: return GIT_EMERGECONFLICT on merge conflictEdward Thomson2015-05-111-1/+1
|
* stash: refactor to use merge_iteratorsEdward Thomson2015-05-111-12/+12
|
* stash apply: check out a tree, not piecewiseEdward Thomson2015-05-111-2/+2
|
* Added git_stash_apply() and git_stash_pop() APIsPierre-Olivier Latour2015-05-111-0/+215
|
* Merge pull request #2913 from ethomson/stash_fixupEdward Thomson2015-03-031-0/+19
|\ | | | | stash: correctly stash wd modified/index deleted
| * stash: correctly stash wd modified/index deletedEdward Thomson2015-02-181-0/+19
| |
* | repository: remove log message override for switching the active branchCarlos Martín Nieto2015-03-031-1/+1
| | | | | | | | | | | | We want to use the "checkout: moving from ..." message in order to let git know when a change of branch has happened. Make the convenience functions for this goal write this message.
* | Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-2/+2
|/ | | | | | | | | | The signature for the reflog is not something which changes dynamically. Almost all uses will be NULL, since we want for the repository's default identity to be used, making it noise. In order to allow for changing the identity, we instead provide git_repository_set_ident() and git_repository_ident() which allow a user to override the choice of signature.
* p_mkdir != mkdir on win32Edward Thomson2014-10-031-2/+2
|
* Added test for stashing files in ignored directoriesJacques Germishuys2014-09-241-0/+17
|
* oid: Export `git_oid_tostr_s` instead of `_allocfmt`vmg/tostr_sVicent Marti2014-08-181-7/+1
| | | | | | The old `allocfmt` is of no use to callers, as they are not able to free the returned buffer. Export a new API that returns a static string that doesn't need to be freed.
* Introduce cl_assert_equal_oidEdward Thomson2014-07-011-4/+4
|
* Make checkout match diff for untracked/ignored dirRussell Belfer2014-04-222-1/+6
| | | | | | | | | | | | | | | | | | When diff finds an untracked directory, it emulates Git behavior by looking inside the directory to see if there are any untracked items inside it. If there are only ignored items inside the dir, then diff considers it ignored, even if there is no direct ignore rule for it. Checkout was not copying this behavior - when it found an untracked directory, it just treated it as untracked. Unfortunately, when combined with GIT_CHECKOUT_REMOVE_UNTRACKED, this made is seem that checkout (and stash, which uses checkout) was removing ignored items when you had only asked it to remove untracked ones. This commit moves the logic for advancing past an untracked dir while scanning for non-ignored items into an iterator helper fn, and uses that for both diff and checkout.
* Failing test for stashing a buried ignored fileRussell Belfer2014-04-221-0/+13
|
* Make stash and checkout ignore contained reposRussell Belfer2014-04-222-9/+21
| | | | | | | | | | | To emulate git, stash should not remove untracked git repositories inside the parent repo, and checkout's REMOVE_UNTRACKED should also skip over these items. `git stash` actually prints a warning message for these items. That should be possible with a checkout notify callback if you wanted to, although it would require a bit of extra logic as things are at the moment.
* Make submodules externally refcountedRussell Belfer2014-03-251-0/+3
| | | | | | | | `git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
* Remove ignored files from the working directory if they were stashedJacques Germishuys2014-03-041-0/+2
|
* Add reflog params to git_repository_detach_headBen Straub2014-02-041-1/+1
|
* refs: remove the _with_log differentiationCarlos Martín Nieto2014-01-151-1/+1
| | | | | | Any well-behaved program should write a descriptive message to the reflog whenever it updates a reference. Let's make this more prominent by removing the version without the reflog parameters.
* Rename tests-clar to testsBen Straub2013-11-146-0/+796