summaryrefslogtreecommitdiff
path: root/src/branch.c
Commit message (Collapse)AuthorAgeFilesLines
* refdb: delete a ref's reflog upon deletioncmn/reflog-del-backendCarlos Martín Nieto2015-07-121-12/+1
| | | | | | Removing a reflog upon ref deletion is something which only some backends might wish to do. Backends which are database-backed may wish to archive a reflog, log-based ones may not need to do anything.
* branch: error out if we cannot find the remotecmn/upstream-matching-pushCarlos Martín Nieto2015-05-221-3/+6
| | | | | | | | | | | When we look for which remote corresponds to a remote-tracking branch, we look in the refspecs to see which ones matches. If none do, we should abort. We currently ignore the error message from this operation, so let's not do that anymore. As part of the test we're writing, let's test for the expected behaviour if we cannot find a refspec which tells us what the remote-tracking branch for a remote would look like.
* Add annotated commit versions of reflog-modifying functionsCarlos Martín Nieto2015-03-161-2/+24
| | | | | | | 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.
* Drop trailing whitespacesntk/reflog_branch_createnulltoken2015-03-041-1/+1
|
* branch: fix generated reflog message upon renamingnulltoken2015-03-041-1/+1
|
* branch: fix generated reflog message upon creationnulltoken2015-03-041-1/+1
|
* config: borrow refcounted referencescmn/config-borrow-entryCarlos Martín Nieto2015-03-031-20/+19
| | | | | | | | | | | | | | | This changes the get_entry() method to return a refcounted version of the config entry, which you have to free when you're done. This allows us to avoid freeing the memory in which the entry is stored on a refresh, which may happen at any time for a live config. For this reason, get_string() has been forbidden on live configs and a new function get_string_buf() has been added, which stores the string in a git_buf which the user then owns. The functions which parse the string value takea advantage of the borrowing to parse safely and then release the entry.
* branch: don't accept a reflog message overrideCarlos Martín Nieto2015-03-031-18/+11
| | | | | | | This namespace is about behaving like git's branch command, so let's do exactly that instead of taking a reflog message. This override is still available via the reference namespace.
* Remove the signature from ref-modifying functionsCarlos Martín Nieto2015-03-031-4/+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.
* branch: do capture the error codeCarlos Martín Nieto2015-03-031-1/+1
| | | | | We want to ignore GIT_ENOTFOUND, but for that we need to capture the error code from the reflog deletion.
* git_branch_delete() should ignore errors from non-existing reflogsPierre-Olivier Latour2015-03-021-1/+6
|
* branch: consider an empty upstream remote config as not foundCarlos Martín Nieto2014-11-171-0/+6
|
* Merge pull request #2698 from libgit2/cmn/fetchhead-refactorEdward Thomson2014-11-081-0/+23
|\ | | | | Refactor fetchhead
| * branch: add getter for the upstream remote nameCarlos Martín Nieto2014-11-081-0/+23
| | | | | | | | This gets the value from branch.<foo>.remote.
* | remote: rename _load() to _lookup()cmn/remote-lookupCarlos Martín Nieto2014-11-081-3/+3
|/ | | | This brings it in line with the rest of the lookup functions.
* repository: introduce a convenience config snapshot methodcmn/config-snapshotCarlos Martín Nieto2014-05-071-5/+2
| | | | | | Accessing the repository's config and immediately taking a snapshot of it is a common operation, so let's provide a convenience function for it.
* Use config snapshottingCarlos Martín Nieto2014-04-181-7/+11
| | | | | This way we can assume we have a consistent view of the config situation when we're looking up remote, branch, pack-objects, etc.
* Const correctness!Jacques Germishuys2014-04-031-3/+5
|
* branch: constness fixesCarlos Martín Nieto2014-03-171-1/+1
|
* branch: fix leak when checking against HEADCarlos Martín Nieto2014-03-071-5/+11
| | | | | | | | We look up a reference in order to figure out if it's the current branch, which we need to free once we're done with the check. As a bonus, only perform the check when we're passed the force flag, as it's a useless check otherwise.
* Do not allow git_branch_create() to force update branchLinquize2014-02-271-0/+13
|
* Provide good default reflog messages in branch apiBen Straub2014-01-301-9/+27
|
* Ensure renaming a reference updates the reflogBen Straub2014-01-301-1/+2
|
* Add reflog parameters to git_branch_moveBen Straub2014-01-301-1/+3
|
* Deleting a branch deletes its reflogBen Straub2014-01-301-0/+3
|
* Add reflog params to git_branch_createBen Straub2014-01-301-7/+9
|
* Misc cleanupsRussell Belfer2014-01-301-23/+16
|
* refspec: move to git_buf for outputting stringsCarlos Martín Nieto2014-01-271-2/+2
|
* branch: move to git_buf when outputting newly-allocated stringsCarlos Martín Nieto2014-01-271-72/+26
| | | | | Internally we already did everything with git_bufs, so this is just exposing those functions with public names.
* 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.
* branch: handle NULL pointers passed to git_branch_iterator_free()Brodie Rao2014-01-121-0/+3
| | | | Signed-off-by: Brodie Rao <brodie@sf.io>
* Improve GIT_EUSER handlingRussell Belfer2013-12-111-19/+22
| | | | | | | | | | | This adds giterr_user_cancel to return GIT_EUSER and clear any error message that is sitting around. As a result of using that in places, we need to be more thorough with capturing errors that happen inside a callback when used internally. To help with that, this also adds giterr_capture and giterr_restore so that when we internally use a foreach-type function that clears errors and converts them to GIT_EUSER, it is easier to restore not just the return value, but the actual error message text.
* Change the git_branch_iterator_new and git_branch_next definitions to use ↵Arthur Schreiber2013-11-051-2/+2
| | | | git_branch_t.
* branch: move from foreach to an iteratorCarlos Martín Nieto2013-11-051-32/+50
| | | | | | | | Create a git_branch_iterator type which is equivalent to the foreach but lets us write loops instead of callbacks. Since the introduction of git_reference_shorthand(), the added value of passing the name is reduced.
* No such thing as an orphan branchCarlos Martín Nieto2013-09-171-1/+1
| | | | | | | | | | | Unfortunately git-core uses the term "unborn branch" and "orphan branch" interchangeably. However, "orphan" is only really there for the checkout command, which has the `--orphan` option so it doesn't actually create the branch. Branches never have parents, so the distinction of a branch with no parents is odd to begin with. Crucially, the error messages deal with unborn branches, so let's use that.
* branch: More obvious semantics in `foreach`Vicent Marti2013-06-171-1/+5
|
* ref: free the last ref when cancelling git_branch_foreach()yorah2013-06-171-4/+2
| | | | Also fixed an assert typo on nulltoken's HEAD
* ...Aaaand this worksVicent Marti2013-05-301-5/+8
|
* Liike thisVicent Marti2013-05-281-7/+10
|
* Merge pull request #1385 from carlosmn/refs-iterEdward Thomson2013-05-111-27/+30
|\ | | | | Introduce a refs iterator
| * Move a couple more functions to use iteratorsCarlos Martín Nieto2013-05-111-27/+30
| |
| * refs: remove the OID/SYMBOLIC filteringCarlos Martín Nieto2013-05-111-1/+1
| | | | | | | | | | | | | | | | | | Nobody should ever be using anything other than ALL at this level, so remove the option altogether. As part of this, git_reference_foreach_glob is now implemented in the frontend using an iterator. Backends will later regain the ability of doing the glob filtering in the backend.
* | git_branch_set_upstream with local branchesNikolai Vladimirov2013-05-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently git_branch_set_upstream when passed a local branch creates invalid configuration, for ex. if we setup branch 'tracking_master' to track local 'master' libgit2 generates the following config ``` [branch "track_master"] remote = . merge = .refs/heads/track_master ``` The merge value is invalid and calling git_branch_upstream on 'tracking_master' results in invalid reference error. It should do: ``` [branch "track_master"] remote = . merge = refs/heads/master ```
* | Set error message for branch functionsRussell Belfer2013-05-011-2/+12
|/ | | | | There were a couple of places where an error was being returned from branch related code but no error message was being set.
* remote: handle multiple refspecsCarlos Martín Nieto2013-04-201-13/+9
| | | | | | | | | | | | | A remote can have a multitude of refspecs. Up to now our git_remote's have supported a single one for each fetch and push out of simplicity to get something working. Let the remotes and internal code know about multiple remotes and get the tests passing with them. Instead of setting a refspec, the external users can clear all and add refspecs. This should be enough for most uses, though we're still missing a querying function.
* Fix win64 warningsRussell Belfer2013-04-181-1/+1
|
* branch: add more upstream configuration managementCarlos Martín Nieto2013-04-111-1/+115
| | | | | Add functions to set and unset the upstream configuration to complement the getter we already have.
* branch: refactor git_branch_remote_nameCarlos Martín Nieto2013-03-311-25/+22
| | | | | | Return the size we'd need to write to instead of simply an error. Split the function into two to be used later by the upstream configuration functions.
* branch: rename 'tracking' to 'upstream'Carlos Martín Nieto2013-03-301-8/+8
| | | | | The term 'tracking' is overloaded. Help distinguish what we mean by using 'upstream' for this part of the library.
* Several warnings detected by static code analyzer fixedArkadiy Shapkin2013-03-181-1/+1
| | | | | | | Implicit type conversion argument of function to size_t type Suspicious sequence of types castings: size_t -> int -> size_t Consider reviewing the expression of the 'A = B == C' kind. The expression is calculated as following: 'A = (B == C)' Unsigned type is never < 0