summaryrefslogtreecommitdiff
path: root/src/fetchhead.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert usage of `git_buf_free` to new `git_buf_dispose`Patrick Steinhardt2018-06-101-5/+5
|
* remote: append to FETCH_HEAD rather than overwrite for each refspecCarlos Martín Nieto2017-12-261-1/+1
| | | | | | | | We treat each refspec on its own, but the code currently overwrites the contents of FETCH_HEAD so we end up with the entries for the last refspec we processed. Instead, truncate it before performing the updates and append to it when updating the references.
* Make sure to always include "common.h" firstPatrick Steinhardt2017-07-031-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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.
* repository: rename `path_repository` and `path_gitlink`Patrick Steinhardt2017-02-131-2/+2
| | | | | | | | | | | | | The `path_repository` variable is actually confusing to think about, as it is not always clear what the repository actually is. It may either be the path to the folder containing worktree and .git directory, the path to .git itself, a worktree or something entirely different. Actually, the intent of the variable is to hold the path to the gitdir, which is either the .git directory or the bare repository. Rename the variable to `gitdir` to avoid confusion. While at it, also rename `path_gitlink` to `gitlink` to improve consistency.
* giterr_set: consistent error messagesEdward Thomson2016-12-291-8/+8
| | | | | | | | 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
* common: use PRIuZ for size_t in `giterr_set` callsPatrick Steinhardt2016-11-141-8/+8
|
* fetchhead: deal with quotes in branch namesCarlos Martín Nieto2014-04-241-1/+1
| | | | | | | | | The current FETCH_HEAD parsing code assumes that a quote must end the branch name. Git however allows for quotes as part of a branch name, which causes us to consider the FETCH_HEAD file as invalid. Instead of searching for a single quote char, search for a quote char followed by SP, which is not a valid part of a ref name.
* One more rename/cleanup for callback err functionsRussell Belfer2013-12-111-1/+1
|
* Some callback error check style cleanupsRussell Belfer2013-12-111-5/+6
| | | | I find this easier to read...
* Remove converting user error to GIT_EUSERRussell Belfer2013-12-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This changes the behavior of callbacks so that the callback error code is not converted into GIT_EUSER and instead we propagate the return value through to the caller. Instead of using the giterr_capture and giterr_restore functions, we now rely on all functions to pass back the return value from a callback. To avoid having a return value with no error message, the user can call the public giterr_set_str or some such function to set an error message. There is a new helper 'giterr_set_callback' that functions can invoke after making a callback which ensures that some error message was set in case the callback did not set one. In places where the sign of the callback return value is meaningful (e.g. positive to skip, negative to abort), only the negative values are returned back to the caller, obviously, since the other values allow for continuing the loop. The hardest parts of this were in the checkout code where positive return values were overloaded as meaningful values for checkout. I fixed this by adding an output parameter to many of the internal checkout functions and removing the overload. This added some code, but it is probably a better implementation. There is some funkiness in the network code where user provided callbacks could be returning a positive or a negative value and we want to rely on that to cancel the loop. There are still a couple places where an user error might get turned into GIT_EUSER there, I think, though none exercised by the tests.
* Further EUSER and error propagation fixesRussell Belfer2013-12-111-2/+2
| | | | | | | | | | | | | This continues auditing all the places where GIT_EUSER is being returned and making sure to clear any existing error using the new giterr_user_cancel helper. As a result, places that relied on intercepting GIT_EUSER but having the old error preserved also needed to be cleaned up to correctly stash and then retrieve the actual error. Additionally, as I encountered places where error codes were not being propagated correctly, I tried to fix them up. A number of those fixes are included in the this commit as well.
* Merge pull request #1956 from libgit2/cmn/fetch-default-headVicent Martí2013-11-111-0/+6
|\ | | | | Remote revamp (director's cut)
| * remote: create FETCH_HEAD with a refspecless remoteCarlos Martín Nieto2013-11-011-0/+6
| | | | | | | | | | | | When downloading the default branch due to lack of refspecs, we still need to write out FETCH_HEAD with the tip we downloaded, unfortunately with a format that doesn't match what we already have.
* | move mode_t to filebuf_open instead of _commitEdward Thomson2013-11-041-2/+2
|/
* immutable references and a pluggable ref databaseEdward Thomson2013-03-071-1/+0
|
* update copyrightsEdward Thomson2013-01-081-1/+1
|
* Fix -Wmaybe-uninitialized warningMichael Schubert2012-12-221-1/+1
|
* fetchhead reading/iteratingEdward Thomson2012-12-191-8/+178
|
* create FETCH_HEAD specially instead of as a ref fileEdward Thomson2012-11-111-0/+126