summaryrefslogtreecommitdiff
path: root/src/reflog.c
Commit message (Collapse)AuthorAgeFilesLines
* reflog: Do not free references before timenew-referencesVicent Marti2011-11-061-10/+20
|
* Free all used references in the source treeschu2011-11-061-1/+5
| | | | | | | Since references are not owned by the repository anymore we have to free them manually now. Signed-off-by: schu <schu-github@schulog.org>
* Merge pull request #456 from brodie/perm-fixesVicent Martí2011-10-281-2/+2
|\ | | | | Create objects, indexes, and directories with the right file permissions
| * *: correct and codify various file permissionsBrodie Rao2011-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following files now have 0444 permissions: - loose objects - pack indexes - pack files - packs downloaded by fetch - packs downloaded by the HTTP transport And the following files now have 0666 permissions: - config files - repository indexes - reflogs - refs This brings libgit2 more in line with Git. Note that git_filebuf_commit() and git_filebuf_commit_at() have both gained a new mode parameter. The latter change fixes an important issue where filebufs created with GIT_FILEBUF_TEMPORARY received 0600 permissions (due to mkstemp(3) usage). Now we chmod() the file before renaming it into place. Tests have been added to confirm that new commit, tag, and tree objects are created with the right permissions. I don't have access to Windows, so for now I've guarded the tests with "#ifndef GIT_WIN32".
| * fileops/repository: create (most) directories with 0777 permissionsBrodie Rao2011-10-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To further match how Git behaves, this change makes most of the directories libgit2 creates in a git repo have a file mode of 0777. Specifically: - Intermediate directories created with git_futils_mkpath2file() have 0777 permissions. This affects odb_loose, reflog, and refs. - The top level folder for bare repos is created with 0777 permissions. - The top level folder for non-bare repos is created with 0755 permissions. - /objects/info/, /objects/pack/, /refs/heads/, and /refs/tags/ are created with 0777 permissions. Additionally, the following changes have been made: - fileops functions that create intermediate directories have grown a new dirmode parameter. The only exception to this is filebuf's lock_file(), which unconditionally creates intermediate directories with 0777 permissions when GIT_FILEBUF_FORCE is set. - The test runner now sets the umask to 0 before running any tests. This ensurses all file mode checks are consistent across systems. - t09-tree.c now does a directory permissions check. I've avoided adding this check to other tests that might reuse existing directories from the prefabricated test repos. Because they're checked into the repo, they have 0755 permissions. - Other assorted directories created by tests have 0777 permissions.
* | global: Properly use `git__` memory wrappersVicent Marti2011-10-281-13/+13
|/ | | | | Ensure that all memory related functions (malloc, calloc, strdup, free, etc) are using their respective `git__` wrappers.
* Tabify everythingVicent Marti2011-09-191-1/+1
| | | | | | There were quite a few places were spaces were being used instead of tabs. Try to catch them all. This should hopefully not break anything. Except for `git blame`. Oh well.
* Cleanup legal dataVicent Marti2011-09-191-21/+3
| | | | | | | | | | 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.
* posix: Properly handle `snprintf` in all platformsVicent Marti2011-08-181-1/+1
|
* reflog.c: fix memory leaksschu2011-08-171-8/+21
| | | | Signed-off-by: schu <schu-github@schulog.org>
* reflog: fix memory leaksschu2011-08-161-1/+5
| | | | | | | Make sure to free the existing reflog when we run out or memory while adding new entries. Signed-off-by: schu <schu-github@schulog.org>
* reflog: assimilate reflog API to return git_oid'sschu2011-08-151-9/+8
| | | | | | | Rather than returning the OIDs out of the reflog as string return them as git_oid. Signed-off-by: schu <schu-github@schulog.org>
* reflog: avoid users writing a wrong ancestor OIDschu2011-08-011-15/+16
| | | | | | | Disallow NULL as ancestor OID when writing a reflog entry for an existing reference. Signed-off-by: schu <schu-github@schulog.org>
* reflog: fix cast warningKirill A. Shutemov2011-07-251-2/+2
| | | | | | | /home/kas/git/public/libgit2/src/reflog.c: In function ‘reflog_parse’: /home/kas/git/public/libgit2/src/reflog.c:148:17: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual] Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
* reflog: Fix reflog writer/readernulltoken2011-07-101-4/+6
| | | | | | - Use a space to separate oids and signature - Enforce test coverage - Make test run in a temporary folder in order not to alter the test repository
* Fix MSVC compilation warningnulltoken2011-07-091-1/+1
|
* Remove unused methodsVicent Marti2011-07-091-23/+18
| | | | | | | | | The direct-writes commit left some (slow) internals methods that were no longer needed. These have been removed. Also, the Reflog code was using the old `git_signature__write`, so it has been rewritten to use a normal buffer and the new `writebuf` signature writer. It's now slightly simpler and faster.
* reflog: add API to read or write a reference logschu2011-07-091-0/+282
So far libgit2 didn't support reference logs (reflog). Add a new git_reflog_* API for basic reading and writing of reflogs: * git_reflog_read * git_reflog_write * git_reflog_free Signed-off-by: schu <schu-github@schulog.org>