Commit Graph

57 Commits

Author SHA1 Message Date
Ben Straub
bde336ea51 Add version fields and init macros for public input structs. 2012-11-30 12:55:45 -08:00
Russell Belfer
ca94e031fa Various minor commenting fixes 2012-11-27 15:28:48 -08:00
Ben Straub
f4a62c306d Typedef enums. 2012-11-27 14:13:03 -08:00
Ben Straub
c9fc4a6ff9 API updates for repository.h 2012-11-27 13:44:49 -08:00
nulltoken
6091457e76 repo: ensure is_empty() checks there are no refs 2012-11-17 07:20:08 -08:00
nulltoken
b1a3a70ed1 repository: Refine repository_head() error report 2012-11-12 00:14:51 +01:00
nulltoken
31966d20e3 repo: enhance git_repository_state() detection 2012-10-27 16:45:59 +02:00
Edward Thomson
632d8b230b reset changes for merge 2012-10-24 20:24:37 -05:00
Vicent Marti
875b16eb54 repository: Typo 2012-10-19 23:44:49 +02:00
nulltoken
8b05bea870 errors: deploy GIT_EORPHANEDHEAD usage 2012-10-19 22:01:53 +02:00
nulltoken
44af67a8b6 repository: introduce git_repository_set_head() 2012-09-17 10:48:35 +02:00
nulltoken
4ebe38bd58 repository: introduce git_repository_set_head_detached() 2012-09-17 10:48:35 +02:00
nulltoken
3f4c3072ea repository: introduce git_repository_detach_head() 2012-09-17 10:48:34 +02:00
nulltoken
cc548c7b0f repository: fix documentation typo 2012-09-17 10:48:33 +02:00
Russell Belfer
a13fb55afd Add tests and improve param checks
Fixed some minor `git_repository_hashfile` issues:

- Fixed incorrect doc (saying that repo could be NULL)
- Added checking of object type value to acceptable ones
- Added more tests for various parameter permutations
2012-09-11 17:26:21 -07:00
Russell Belfer
47bfa0be6d Add git_repository_hashfile to hash with filters
The existing `git_odb_hashfile` does not apply text filtering
rules because it doesn't have a repository context to evaluate
the correct rules to apply.  This adds a new hashfile function
that will apply repository-specific filters (based on config,
attributes, and filename) before calculating the hash.
2012-09-11 15:01:09 -07:00
Russell Belfer
e9ca852e4d Fix warnings and merge issues on Win64 2012-08-23 09:20:17 -07:00
Russell Belfer
ca1b6e5409 Add template dir and set gid to repo init
This extends git_repository_init_ext further with support for
initializing the repository from an external template directory
and with support for the "create shared" type flags that make a
set GID repository directory.

This also adds tests for much of the new functionality to the
existing `repo/init.c` test suite.

Also, this adds a bunch of new utility functions including a
very general purpose `git_futils_mkdir` (with the ability to
make paths and to chmod the paths post-creation) and a file
tree copying function `git_futils_cp_r`.  Also, this includes
some new path functions that were useful to keep the code
simple.
2012-08-22 16:07:19 -07:00
Russell Belfer
662880ca60 Add git_repository_init_ext for power initters
The extended version of repository init adds support for many
of the things that you can do with `git init` and sets up
structures that will make it easier to extend further in the
future.
2012-08-22 16:06:22 -07:00
Carlos Martín Nieto
074841ec6a repository: add a getter and remove function for git's prepared message
The 'git revert/cherry-pick/merge -n' commands leave .git/MERGE_MSG
behind so that git-commit can find it. As we don't yet support these
operations, users who are shelling out to let git perform these
operations haven't had a convenient way to get this message.

These functions allow the user to retrieve the message and remove it
when she's created the commit.
2012-08-01 18:39:20 +02:00
Carlos Martín Nieto
6782245e51 repo: add git_repository_wrap_odb() to wrap an ODB
Primarily useful when used together with git_odb_backend_one_pack().
2012-07-21 16:24:13 +02:00
Russell Belfer
991a56c704 Add flag to write gitlink on setting repo workdir
This added a flag to the `git_repository_set_workdir()` function
that enables generation of a `.git` gitlink file that links the
new workdir to the parent repository.  Essentially, the flag tells
the function to write out the changes to disk to permanently set
the workdir of the repository to the new path.

If you pass this flag as true, then setting the workdir to something
other than the default workdir (i.e. the parent of the .git repo
directory), will create a plain file named ".git" with the standard
gitlink contents "gitdir: <repo-path>", and also update the
"core.worktree" and "core.bare" config values.

Setting the workdir to the default repo workdir will clear the
core.worktree flag (but still permanently set core.bare to false).

BTW, the libgit2 API does not currently provide a function for
clearing the workdir and converting a non-bare repo into a bare one.
2012-07-10 23:19:47 -07:00
Bruce Mitchener
d73c94b21c Fix spelling errors. 2012-05-19 20:26:52 +07:00
Vicent Martí
e172cf082e errors: Rename the generic return codes 2012-05-18 01:26:26 +02:00
Russell Belfer
7784bcbbee Refactor git_repository_open with new options
Add a new command `git_repository_open_ext` with extended options
that control how searching for a repository will be done.  The
existing `git_repository_open` and `git_repository_discover` are
reimplemented on top of it.  We may want to change the default
behavior of `git_repository_open` but this commit does not do that.

Improve support for "gitdir" files where the work dir is separate
from the repo and support for the "separate-git-dir" config.  Also,
add support for opening repos created with `git-new-workdir` script
(although I have only confirmed that they can be opened, not that
all functions work correctly).

There are also a few minor changes that came up:

- Fix `git_path_prettify` to allow in-place prettifying.

- Fix `git_path_root` to support backslashes on Win32.  This fix
  should help many repo open/discover scenarios - it is the one
  function called when opening before prettifying the path.

- Tweak `git_config_get_string` to set the "out" pointer to NULL
  if the config value is not found.  Allows some other cleanup.

- Fix a couple places that should have been calling
  `git_repository_config__weakptr` and were not.

- Fix `cl_git_sandbox_init` clar helper to support bare repos.
2012-04-11 12:11:35 -07:00
schu
5e0de32818 Update Copyright header
Signed-off-by: schu <schu-github@schulog.org>
2012-02-13 17:11:09 +01:00
Vicent Marti
6632c15509 Document all of the things 2011-11-26 08:48:01 +01:00
Vicent Marti
45e79e3701 Rename all _close methods
There's no difference between `_free` and `_close` semantics: keep
everything with the same name to avoid confusions.
2011-11-26 08:48:00 +01:00
Vicent Marti
9462c47143 repository: Change ownership semantics
The ownership semantics have been changed all over the library to be
consistent. There are no more "borrowed" or duplicated references.

Main changes:

	- `git_repository_open2` and `3` have been dropped.

	- Added setters and getters to hotswap all the repository owned
	objects:

		`git_repository_index`
		`git_repository_set_index`
		`git_repository_odb`
		`git_repository_set_odb`
		`git_repository_config`
		`git_repository_set_config`
		`git_repository_workdir`
		`git_repository_set_workdir`

	Now working directories/index files/ODBs and so on can be
	hot-swapped after creating a repository and between operations.

	- All these objects now have proper ownership semantics with
	refcounting: they all require freeing after they are no longer
	needed (the repository always keeps its internal reference).

	- Repository open and initialization has been updated to keep in
	mind the configuration files. Bare repositories are now always
	detected, and a default config file is created on init.

	- All the tests affected by these changes have been dropped from the
	old test suite and ported to the new one.
2011-11-26 08:37:08 +01:00
Haitao Li
28ba94ceed Fix typo in repository documentation 2011-11-18 17:47:22 +08:00
Carlos Martín Nieto
c36280a036 repository: export git_repository_config_autoload
Take the opportunity to finish the comment about this function.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-30 06:28:22 +02:00
Carlos Martín Nieto
40fe5fbea8 Make repo config loading automatic or completely explicit
git_repository_config wants to take the global and system paths again
so that one can be explicit if needed.

The git_repository_config_autoload function is provided for the cases
when it's good enough for the library to guess where those files are
located.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-27 14:40:56 +02:00
Vicent Martí
6640266e5a Merge pull request #398 from carlosmn/config-autohome
git_repository_config: open global config file automatically
2011-09-18 19:58:22 -07:00
Vicent Marti
bb742ede3d Cleanup legal data
1. The license header is technically not valid if it doesn't have a
copyright signature.

2. The COPYING file has been updated with the different licenses used in
the project.

3. The full GPLv2 header in each file annoys me.
2011-09-19 01:54:32 +03:00
nulltoken
3601c4bfce repository: Add git_repository_head() 2011-09-15 01:13:50 +02:00
David Boyce
d911172255 Standardized doxygen @return lines for int functions to say "GIT_SUCCESS or an error code". 2011-09-13 12:30:25 -04:00
Carlos Martín Nieto
f9d4b0c395 git_repository_config: open global config file automatically
If the global configuration file is missing, it is ignored.

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
2011-09-12 17:25:46 +02:00
Kirill A. Shutemov
932d1baf29 cleanup: remove trailing spaces
Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
2011-07-01 18:02:56 +02:00
nulltoken
408d733b1f repository: Make head_detached() and head_orphan() convenience methods accessible to bindings 2011-06-30 06:56:58 -07:00
Vicent Marti
c682886e8e repo: Rename HEAD-related methods 2011-06-28 21:10:44 +02:00
Carlos Martín Nieto
35502d2ec4 Add git_repository_is_detached, git_repository_is_orphan
Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-28 16:59:51 +02:00
Vicent Marti
07ff881750 config: Cleanup external API
Do not mess with environment variables anymore. The new external API has
more helper methods, and everything is explicit.
2011-06-18 00:39:39 +02:00
Carlos Martín Nieto
b22d147986 Add git_repository_config API
This function puts the global and repository configurations in one
git_config object and gives it to the user.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
2011-06-17 22:30:29 +02:00
Vicent Martí
ef9a6f4cbc Merge pull request #261 from Romain-Geissler/discovery-path-v2
Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
2011-06-15 13:47:41 -07:00
Romain Geissler
0657e46dee Fix: GIT_PATH_PATH_SEPARATOR is now a semi-colon under Windows.
GIT_PATH_LIST_SEPARATOR and GIT_PATH_MAX are made public so
that it's can be used by a client.
2011-06-15 22:11:18 +02:00
Vicent Marti
602ee38b6e repository: Export all internal paths 2011-06-04 20:45:09 +02:00
Romain Geissler
fd0574e5ad Repository: Added the git_repository_discover function that finds by itself the git directory that manage a given directory path. 2011-06-04 01:05:36 +02:00
Vicent Martí
50b7334e51 Merge pull request #206 from nulltoken/topic/is-bare
Add git_repository_is_bare() accessor
2011-06-01 09:58:21 -07:00
Vicent Marti
f7e59c4dcf index: Change the memory management for repo indexes
The `git_repository_index` call now returns a brand new index that must
be manually free'd.
2011-06-01 18:54:47 +02:00
nulltoken
fa9bcd81f5 Add git_repository_is_bare() accessor 2011-05-24 21:50:02 +02:00