src/branch.c


Log

Author Commit Date CI Message
Carlos Martín Nieto 62d38a1d 2015-03-06T23:51:40 Add annotated commit versions of reflog-modifying functions 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.
nulltoken 05e644dd 2015-03-04T22:01:39 Drop trailing whitespaces
nulltoken 7eb76734 2015-03-04T22:01:20 branch: fix generated reflog message upon renaming
nulltoken 015d4b7b 2015-03-04T21:48:54 branch: fix generated reflog message upon creation
Carlos Martín Nieto 9a97f49e 2014-12-21T15:31:03 config: borrow refcounted references 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.
Carlos Martín Nieto 6bfb990d 2015-01-07T14:47:02 branch: don't accept a reflog message override 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.
Carlos Martín Nieto 659cf202 2015-01-07T12:23:05 Remove the signature from ref-modifying functions 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.
Carlos Martín Nieto 31bc6c04 2015-03-03T13:25:40 branch: do capture the error code We want to ignore GIT_ENOTFOUND, but for that we need to capture the error code from the reflog deletion.
Pierre-Olivier Latour 79863917 2015-03-02T10:24:54 git_branch_delete() should ignore errors from non-existing reflogs
Carlos Martín Nieto 5915d700 2014-11-17T14:28:22 branch: consider an empty upstream remote config as not found
Edward Thomson 02bc5233 2014-11-08T17:05:13 Merge pull request #2698 from libgit2/cmn/fetchhead-refactor Refactor fetchhead
Carlos Martín Nieto 82374d98 2014-11-08T20:00:17 branch: add getter for the upstream remote name This gets the value from branch.<foo>.remote.
Carlos Martín Nieto 209425ce 2014-11-08T13:25:51 remote: rename _load() to _lookup() This brings it in line with the rest of the lookup functions.
Carlos Martín Nieto ac99d86b 2014-05-07T11:34:32 repository: introduce a convenience config snapshot method 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.
Carlos Martín Nieto 29c4cb09 2014-03-15T03:53:36 Use config snapshotting This way we can assume we have a consistent view of the config situation when we're looking up remote, branch, pack-objects, etc.
Jacques Germishuys 3b4ba278 2014-04-03T15:50:21 Const correctness!
Carlos Martín Nieto 853b1407 2014-03-17T16:10:33 branch: constness fixes
Carlos Martín Nieto a07b1698 2014-03-07T15:40:53 branch: fix leak when checking against HEAD 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.
Linquize 59b1dbcd 2014-02-27T23:56:25 Do not allow git_branch_create() to force update branch
Ben Straub 59bb1126 2014-01-28T11:45:30 Provide good default reflog messages in branch api
Ben Straub b31ebfbc 2014-01-27T14:12:29 Add reflog params to git_branch_create
Ben Straub ccf6ce5c 2014-01-28T11:30:36 Ensure renaming a reference updates the reflog
Ben Straub 540c1809 2014-01-28T10:44:33 Add reflog parameters to git_branch_move
Ben Straub 48110f67 2014-01-28T10:31:54 Deleting a branch deletes its reflog
Russell Belfer 3cf11eef 2014-01-28T11:47:33 Misc cleanups
Carlos Martín Nieto bf522e08 2014-01-26T16:59:36 refspec: move to git_buf for outputting strings
Carlos Martín Nieto b25d87c9 2014-01-26T16:03:37 branch: move to git_buf when outputting newly-allocated strings Internally we already did everything with git_bufs, so this is just exposing those functions with public names.
Carlos Martín Nieto 0b28217b 2014-01-15T12:51:31 refs: remove the _with_log differentiation 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.
Brodie Rao 9eb45fc5 2014-01-12T23:29:44 branch: handle NULL pointers passed to git_branch_iterator_free() Signed-off-by: Brodie Rao <brodie@sf.io>
Russell Belfer 96869a4e 2013-12-03T16:45:39 Improve GIT_EUSER handling 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.
Arthur Schreiber a667ca82 2013-11-05T20:51:07 Change the git_branch_iterator_new and git_branch_next definitions to use git_branch_t.
Carlos Martín Nieto 8ec889a4 2013-11-02T14:07:02 branch: move from foreach to an iterator 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.
Carlos Martín Nieto 605da51a 2013-09-17T09:50:30 No such thing as an orphan branch 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.
Vicent Marti 09c2f91c 2013-06-17T18:48:02 branch: More obvious semantics in `foreach`
yorah 2ad7a4dc 2013-06-17T18:25:30 ref: free the last ref when cancelling git_branch_foreach() Also fixed an assert typo on nulltoken's HEAD
Vicent Marti 4e6e2ff2 2013-05-30T03:47:10 ...Aaaand this works
Vicent Marti 56960b83 2013-05-28T20:47:55 Liike this
Edward Thomson b6cc559a 2013-05-11T02:42:49 Merge pull request #1385 from carlosmn/refs-iter Introduce a refs iterator
Carlos Martín Nieto 9bd89d96 2013-05-04T16:49:39 Move a couple more functions to use iterators
Carlos Martín Nieto 2b562c3a 2013-05-04T16:32:58 refs: remove the OID/SYMBOLIC filtering 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.
Nikolai Vladimirov 3d42e9a3 2013-05-06T20:32:20 git_branch_set_upstream with local branches 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 ```
Russell Belfer 3e199f42 2013-05-01T04:18:46 Set error message for branch functions There were a couple of places where an error was being returned from branch related code but no error message was being set.
Carlos Martín Nieto 4330ab26 2013-04-20T04:43:28 remote: handle multiple refspecs 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.
Russell Belfer 38fd8121 2013-04-18T14:48:20 Fix win64 warnings
Carlos Martín Nieto d59942c2 2013-03-30T04:27:42 branch: add more upstream configuration management Add functions to set and unset the upstream configuration to complement the getter we already have.
Carlos Martín Nieto 97016f29 2013-03-30T09:30:29 branch: refactor git_branch_remote_name 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.
Carlos Martín Nieto a258d8e3 2013-03-30T03:39:19 branch: rename 'tracking' to 'upstream' The term 'tracking' is overloaded. Help distinguish what we mean by using 'upstream' for this part of the library.
Arkadiy Shapkin 10c06114 2013-03-17T04:46:46 Several warnings detected by static code analyzer fixed 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
Edward Thomson d00d5464 2013-03-01T15:37:33 immutable references and a pluggable ref database
nulltoken c1b5e8c4 2013-02-15T11:35:33 branch: Make git_branch_remote_name() cope with orphaned heads
Russell Belfer 390a3c81 2013-02-11T11:44:00 Merge pull request #1190 from nulltoken/topic/reset-paths reset: Allow the selective reset of pathspecs
Jameson Miller 2e3e8c88 2013-02-08T11:05:47 Teach remote branch to return its remote
nulltoken 3ad05221 2013-02-05T16:52:56 Fix MSVC compilation warnings Fix #1308
Sebastian Bauer c253056d 2013-01-24T20:44:17 Added git_branch_name(). This is a convenience function to get the branch name of a given ref. The returned branch name is compatible with the name that can be supplied e.g. to git_branch_lookup(). That is, the prefixes "refs/heads" or "refs/remotes" are omitted. Also added a new test for testing the new function.
nulltoken bf031581 2013-01-14T14:22:11 branch: Introduce git_branch_tracking_name()
nulltoken 28cbd2e2 2013-01-14T12:09:10 Fix indentations
Edward Thomson 359fc2d2 2013-01-08T17:07:25 update copyrights
nulltoken 37849a8e 2012-11-17T22:09:55 tracking: fix retrieval of the tracking ref of branch with empty merge and/or remote entry
Vicent Marti cfbe4be3 2012-11-17T19:54:47 More external API cleanup Conflicts: src/branch.c tests-clar/refs/branches/create.c
Ben Straub 2508cc66 2012-11-18T21:38:08 Rename ref and reflog apis for consistency
nulltoken b1a3a70e 2012-11-12T00:14:51 repository: Refine repository_head() error report
Edward Thomson b0f6e45d 2012-11-01T15:47:18 create FETCH_HEAD specially instead of as a ref file
nulltoken aba70781 2012-09-11T18:11:26 config: introduce git_config_rename_section()
nulltoken 0b98a8a4 2012-09-07T15:13:11 branch: remove config section upon deletion
nulltoken 383f164a 2012-09-07T17:55:30 branch: rename config section upon moving
nulltoken 8b05bea8 2012-10-19T17:07:39 errors: deploy GIT_EORPHANEDHEAD usage
nulltoken 0532e7bb 2012-10-19T20:34:33 branch: allow deletion of branch when HEAD's missing
nulltoken 62993b61 2012-10-11T14:08:32 branches: propagate EEXISTS upon creation
nulltoken 4ba23be1 2012-10-06T12:20:13 branch: deploy git_branch_is_head()
nulltoken 0c78f685 2012-10-06T10:41:53 branch: introduce git_branch_is_head()
nulltoken e16fc07f 2012-09-13T22:22:40 refspec: No remote tracking ref from a fetchspec-less remote
Vicent Marti 62eafd06 2012-08-27T14:54:52 Merge branch 'branch-delete-ref' into development Conflicts: include/git2/refs.h
nulltoken d1445b75 2012-08-27T15:24:27 branch: reduce code duplication
Vicent Marti 1c947daa 2012-08-23T15:47:29 branch: Change `git_branch_delete` to take a ref
Vicent Marti f0244463 2012-07-27T18:49:37 branch: Add `repository` argument to `create` Yes, we can get the repository from the owner of the object, but having it marked explicitly makes the API more consistent.
nulltoken 786a17cd 2012-07-20T16:41:41 branch: enforce git_branch_delete() parameter checking
nulltoken fb910281 2012-07-20T16:38:54 branch: introduce git_branch_tracking()
nulltoken bf9e8cc8 2012-07-20T16:34:08 branch: make git_branch_move() reference based
nulltoken eed378b6 2012-07-20T16:19:04 branch: introduce git_branch_lookup()
nulltoken b308c11e 2012-07-19T15:39:16 branch: change git_branch_create() to make it return a reference
nulltoken 326ca710 2012-07-19T15:32:58 branch: remove useless header
nulltoken d4827081 2012-06-21T18:48:36 branch: drop git_branch_list()
nulltoken a8fd805e 2012-06-21T18:29:38 branch: add git_branch_foreach()
Frederick Ros fa45d25f 2012-06-13T14:03:48 Fix issue #763
Vicent Martí 59d91979 2012-05-18T13:53:38 Merge pull request #710 from libgit2/breaking-changes Break everything before the release
Vicent Martí 904b67e6 2012-05-18T01:48:50 errors: Rename error codes
Vicent Martí e172cf08 2012-05-18T01:21:06 errors: Rename the generic return codes
Vicent Martí 2e2e9785 2012-05-18T00:42:24 Properly tag all `enums` with a `_t`
nulltoken 392eced6 2012-05-11T22:22:14 branch: retrieve symbolic references when listing the branches
nulltoken 341a7136 2012-05-13T10:17:52 branch: make git_branch_delete() return GIT_ENOTFOUND when the branch doesn't exist
Carlos Martín Nieto 6a625435 2012-04-12T23:40:41 branch: simplify error handling for git_branch_move() The cleanup needs to happen anyway, so set the error code and jump there instead of copying the code.
Carlos Martín Nieto 6a8bcfa4 2012-04-12T20:47:46 branch: plug leaks in git_branch_move() and _delete()
Carlos Martín Nieto 1a2b8725 2012-04-11T14:27:40 Typedefs don't have enum in front
nulltoken 4615f0f7 2012-04-09T03:22:14 branch: add git_branch_move()
nulltoken 731df570 2012-04-04T15:57:19 Add basic branch management API: git_branch_create(), git_branch_delete(), git_branch_list()