summaryrefslogtreecommitdiff
path: root/src/reset.c
Commit message (Collapse)AuthorAgeFilesLines
* str: introduce `git_str` for internal, `git_buf` is externalethomson/gitstrEdward Thomson2021-10-171-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix coding style for pointerpunkymaniac2021-09-091-1/+1
| | | | Make some syntax change to follow coding style.
* reset: use GIT_ASSERTEdward Thomson2020-11-271-6/+7
|
* git_error: use new names in internal APIs and usageEdward Thomson2019-01-221-5/+5
| | | | | Move to the `git_error` name in the internal API for error-related functions.
* object_type: use new enumeration namesethomson/index_fixesEdward Thomson2018-12-011-2/+2
| | | | Use the new object_type enumeration names within the codebase.
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-1/+1
|
* Merge pull request #4288 from pks-t/pks/include-fixupsEdward Thomson2017-08-151-0/+1
|\ | | | | Include fixups
| * Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Next to including several files, our "common.h" header also declares various macros which are then used throughout the project. As such, we have to make sure to always include this file first in all implementation files. Otherwise, we might encounter problems or even silent behavioural differences due to macros or defines not being defined as they should be. So in fact, our header and implementation files should make sure to always include "common.h" first. This commit does so by establishing a common include pattern. Header files inside of "src" will now always include "common.h" as its first other file, separated by a newline from all the other includes to make it stand out as special. There are two cases for the implementation files. If they do have a matching header file, they will always include this one first, leading to "common.h" being transitively included as first file. If they do not have a matching header file, they instead include "common.h" as first file themselves. This fixes the outlined problems and will become our standard practice for header and source files inside of the "src/" from now on.
* | git_reset_*: pass parameters as const pointersAndrey Davydov2017-06-301-5/+5
|/
* giterr_set: consistent error messagesEdward Thomson2016-12-291-1/+1
| | | | | | | | Error messages should be sentence fragments, and therefore: 1. Should not begin with a capital letter, 2. Should not conclude with punctuation, and 3. Should not end a sentence and begin a new one
* annotated_commit: provide refs and descriptionethomson/annotated_commit_refsEdward Thomson2016-04-261-1/+1
| | | | | | | | | | | Differentiate between the ref_name used to create an annotated_commit (that can subsequently be used to look up the reference) and the description that we resolved this with (which _cannot_ be looked up). The description is used for things like reflogs (and may be a ref name, and ID something that we revparsed to get here), while the ref name must actually be a reference name, and is used for things like rebase to return to the initial branch.
* reset: perform the checkout before moving HEAD or the indexcmn/reset-dir-fileCarlos Martín Nieto2015-12-091-6/+6
| | | | | | This keeps the state of the workdir the same as one from HEAD, removing a source of possible confusion when calculating the work that is to be done.
* diff/status: introduce conflictsEdward Thomson2015-05-281-0/+1
| | | | | | | | | | | When diffing against an index, return a new `GIT_DELTA_CONFLICTED` delta type for items that are conflicted. For a single file path, only one delta will be produced (despite the fact that there are multiple entries in the index). Index iterators now have the (optional) ability to return conflicts in the index. Prior to this change, they would be omitted, and callers (like diff) would omit conflicted index entries entirely.
* reset: `git_checkout_options` is `const`Edward Thomson2015-04-201-3/+3
|
* Add annotated commit versions of reflog-modifying functionsCarlos Martín Nieto2015-03-161-2/+22
| | | | | | | We do not always want to put the id directly into the reflog, but we want to speicfy what a user typed. For this use-case we provide annotated version of a few functions which let the caller specify what user-friendly name was used when asking for the operation.
* Removed unnecessary GIT_CHECKOUT_SKIP_UNMERGED for GIT_RESET_HARDPierre-Olivier Latour2015-03-081-1/+1
|
* reset: remove reflog message overrideCarlos Martín Nieto2015-03-031-8/+5
| | | | | This function is meant to simulate what git does in the reset command, so we should include the reflog message in that.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-2/+1
| | | | | | | | | | 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.
* git_reset: const the git_signature argEdward Thomson2014-10-261-1/+1
|
* Allow to propagate checkout callbacks to git HARD resetSven Strickroth2014-08-031-0/+4
| | | | Signed-off-by: Sven Strickroth <email@cs-ware.de>
* Fix reset for staged deletesRussell Belfer2014-04-211-3/+8
|
* Merge pull request #2028 from libgit2/options-namesVicent Marti2014-03-071-1/+1
|\ | | | | Rename options structures
| * git_checkout_opts -> git_checkout_optionsBen Straub2014-03-061-1/+1
| |
* | Plug a few leaks in the testsCarlos Martín Nieto2014-03-071-0/+1
|/
* Add reflog parameters to git_resetBen Straub2014-02-031-2/+10
|
* diff: rename the file's 'oid' to 'id'Carlos Martín Nieto2014-01-251-1/+1
| | | | In the same vein as the previous commits in this series.
* index: rename an entry's id to 'id'Carlos Martín Nieto2014-01-251-1/+1
| | | | This was not converted when we converted the rest, so do it now.
* 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.
* clean up state metadata more consistentlyEdward Thomson2013-12-021-1/+1
|
* Merge pull request #1897 from libgit2/split-patch-from-diffVicent Martí2013-10-221-5/+6
|\ | | | | RFC: Proposed reworking of diff APIs
| * Diff API cleanupRussell Belfer2013-10-151-3/+4
| | | | | | | | | | | | | | | | This lays groundwork for separating formatting options from diff creation options. This groups the formatting flags separately from the diff list creation flags and reorders the options. This also tweaks some APIs to further separate code that uses patches from code that just looks at git_diffs.
| * Rename diff objects and split patch.hRussell Belfer2013-10-111-2/+2
| | | | | | | | | | | | This makes no functional change to diff but renames a couple of the objects and splits the new git_patch (formerly git_diff_patch) into a new header file.
* | checkout (from index) can write conflictsEdward Thomson2013-10-161-1/+1
|/
* Fix trailing whitespacesnulltoken2013-05-151-1/+1
|
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-40/+3
|
* reset: Introduce git_reset_default()nulltoken2013-02-051-0/+74
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* reset: Fix a memory leaknulltoken2013-01-061-2/+1
|
* Reorder operations in git resetRussell Belfer2013-01-041-39/+30
| | | | | | | | | | | | | | | | This corrects the order of operations in git reset so that the checkout to reset the working directory content is done before the HEAD is moved. This allows us to use the HEAD and the index content to know what files can / should safely be reset. Unfortunately, there are still some cases where the behavior of this revision differs from core git. Notable, a file which has been added to the index but is not present in the HEAD is considered to be tracked by core git (and thus removable by a reset command) whereas since this loads the target state into the index prior to resetting, it will consider such a file to be untracked and won't touch it. That is a larger fix that I'll defer to a future commit.
* reset: Cannot soft reset with a conflicted indexnulltoken2013-01-041-42/+24
|
* expose merge metadata cleanupEdward Thomson2013-01-031-1/+1
|
* Deploy GIT_CHECKOUT_OPTS_INITBen Straub2012-11-301-2/+1
|
* Updates to reset.hRussell Belfer2012-11-271-1/+1
|
* Rename ref and reflog apis for consistencyBen Straub2012-11-271-3/+3
|
* Add explicit git_index ptr to diff and checkoutRussell Belfer2012-11-141-1/+1
| | | | | | | | A number of diff APIs and the `git_checkout_index` API take a `git_repository` object an operate on the index. This updates them to take a `git_index` pointer explicitly and only fall back on the `git_repository` index if the index input is NULL. This makes it easier to operate on a temporary index.
* Rework checkout with new strategy optionsRussell Belfer2012-11-091-4/+1
| | | | | | | | | | | | | | | | | | This is a major reworking of checkout strategy options. The checkout code is now sensitive to the contents of the HEAD tree and the new options allow you to update the working tree so that it will match the index content only when it previously matched the contents of the HEAD. This allows you to, for example, to distinguish between removing files that are in the HEAD but not in the index, vs just removing all untracked files. Because of various corner cases that arise, etc., this required some additional capabilities in rmdir and other utility functions. This includes the beginnings of an implementation of code to read a partial tree into the index based on a pathspec, but that is not enabled because of the possibility of creating conflicting index entries.
* Merge pull request #990 from ben/clone-callbacksVicent Martí2012-10-251-2/+2
|\ | | | | Progress callbacks
| * index: remove read_tree() progress indicatornulltoken2012-10-191-1/+1
| | | | | | | | | | | | | | | | git_index_read_tree() was exposing a parameter to provide the user with a progress indicator. Unfortunately, due to the recursive nature of the tree walk, the maximum number of items to process was unknown. Thus, the indicator was only counting processed entries, without providing any information how the number of remaining items.
| * Convert checkout_index to use progress callbackBen Straub2012-10-191-1/+1
| |
* | GIT_EUNMERGEDEdward Thomson2012-10-241-0/+1
| |