Commit Graph

223 Commits

Author SHA1 Message Date
Sebastian Bauer
85f4031276 Do not use GIT_CPDIR_CHMOD flag when copying the template.
This is an intermin solution. While this essentially disables the
--shared flag feature, previously external templates did not work
at all. This change fixes the previously corrected, and since
then failing, repo_init__extended_with_template() test.

The problem is now documented in the source code comments.
2013-01-13 11:35:08 +01:00
Sebastian Bauer
b7b1acfdbd Clear local error variable after invoking giterr_clear(). 2013-01-12 20:02:00 +01:00
Edward Thomson
359fc2d241 update copyrights 2013-01-08 17:31:27 -06:00
Ben Straub
87bc689fbf git_remote_create calls git_remote_save 2012-12-20 15:50:33 -08:00
Ben Straub
29f27599ea Rename remote creation APIs
git_remote_add -> git_remote_create
git_remote_new -> git_remote_create_inmemory
2012-12-20 10:52:57 -08:00
Ben Straub
c7231c45fe Deploy GITERR_CHECK_VERSION 2012-11-30 16:31:42 -08:00
Ben Straub
b4d136527c Deploy GIT_REPOSITORY_INIT_OPTIONS_INIT 2012-11-30 13:12:15 -08:00
Ben Straub
c9fc4a6ff9 API updates for repository.h 2012-11-27 13:44:49 -08:00
Ben Straub
54b2a37ac7 Clean up config.h 2012-11-27 13:18:28 -08:00
Ben Straub
2508cc66eb Rename ref and reflog apis for consistency 2012-11-27 13:17:45 -08:00
nulltoken
5cec896a3b repo: Make git_repository_head_tree() return error codes 2012-11-22 18:51:06 +01:00
Russell Belfer
38f7d026dc Need to clear ignored error from config load 2012-11-20 14:50:36 -08:00
Russell Belfer
cc6b4162de It is okay to not have a .gitconfig file
Opening a repo is generating an error if you don't have a
.gitconfig file in your home directory, but that should be
legal.
2012-11-20 10:24:18 -08:00
Michael Schubert
0066955d97 Fix a couple of warnings 2012-11-18 04:27:49 +01:00
nulltoken
270160b91a config: Opening a nonexistent file returns ENOTFOUND 2012-11-17 18:30:34 -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
Keith Dahlby
35d255fda6 repo: fix state when HEAD is not detached 2012-11-04 12:13:42 -06: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
yorah
a1abe66aca Add config level support in the config API
Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found.
Added `git_config_open_level`: build a single-level focused config object from a multi-level one.

We are now storing `git_config_entry`s in the khash of the config_file
2012-10-23 12:48:38 +02:00
nulltoken
8b05bea870 errors: deploy GIT_EORPHANEDHEAD usage 2012-10-19 22:01:53 +02:00
Carlos Martín Nieto
a891841850 config: also free the XDG buffer 2012-10-16 17:58:19 +02:00
Vicent Martí
52748f7b9f Merge pull request #952 from csware/config-locations
Config location fixes
2012-10-16 08:36:55 -07:00
nulltoken
096d9e94aa remote: use constants for well-known names 2012-10-07 21:03:37 +02:00
nulltoken
74a2400514 refs: use constants for well-known names 2012-10-07 12:04:19 +02:00
Sven Strickroth
4258d4832b Rename xdr to xdg
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-10-02 17:21:07 +02:00
Sven Strickroth
407cf4e414 Fixed typo: xdr config needs to have a lower priority than the global one
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-24 23:22:07 +02:00
Sven Strickroth
8b4f9b1758 Correctly read xdr compatible %HOME%/.config/git/config config file
This file is not just read if the global config file (%HOME%/.gitconfig)
is not found, however, it is used everytime but with lower priority.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-24 18:59:00 +02:00
Sven Strickroth
b1127a30c7 git_repository_hashfile: Only close file handle if we have a valid one
Otherwise this throws an exception on MFC based systems.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-20 22:32:19 +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
7505022397 Fix MSVC compilation warnings 2012-09-14 11:47:43 +03:00
Sascha Cunz
13b554e376 Fix error text s/buffer too long/buffer too short/ 2012-09-13 23:30:31 +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
nulltoken
89cd5708d9 repository: make initialization cope with missing core.worktree 2012-08-29 19:56:55 +02:00
Russell Belfer
5f4a61aea8 Working implementation of git_submodule_status
This is a big redesign of the git_submodule_status API and the
implementation of the redesigned API.  It also fixes a number of
bugs that I found in other parts of the submodule API while
writing the tests for the status part.

This also fixes a couple of bugs in the iterators that had not
been noticed before - one with iterating when there is a gitlink
(i.e. separate-work-dir) and one where I was treating anything
even vaguely submodule-like as a submodule, more aggressively
than core git does.
2012-08-24 11:00:27 -07:00
Russell Belfer
2eb4edf5f2 Fix errors on Win32 with new repo init 2012-08-24 10:48:48 -07:00
Russell Belfer
e9ca852e4d Fix warnings and merge issues on Win64 2012-08-23 09:20:17 -07:00
Russell Belfer
85bd174626 Some cleanup suggested during review
This cleans up a number of items suggested during code review
with @vmg, including:

* renaming "outside repo" config API to `git_config_open_default`
* killing the `git_config_open_global` API
* removing the `git_` prefix from the static functions in fileops
* removing some unnecessary functionality from the "cp" command
2012-08-22 16:16:42 -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
nulltoken
1a0537e450 Fix compilation warning 2012-08-15 00:08:38 +02:00
Vicent Marti
0ac349a9f3 repository: Indentation 2012-08-02 01:22:51 +02: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
nulltoken
2c227b8b33 repository: fix configuration updating issue while reinitialization
When the repository was reinitialized, every configuration change in repo_init_config() was directly performed against the file on the filesystem. However, a previous version of the configuration had previously been loaded in memory and attached to the repository, in repo_init_reinit().

The repository was unaware of the change and the stale cached version of the configuration never refreshed.
2012-06-22 11:32:49 +02:00