Commit Graph

4735 Commits

Author SHA1 Message Date
Michael Schubert
ae59321fb8 clone: fix -Wmaybe-uninitialized warning 2013-05-10 14:46:14 +02:00
Vicent Martí
aca2d26a5c Merge pull request #1566 from ethomson/ref_zero
calloc refs instead of malloc'ing them
2013-05-09 09:08:44 -07:00
Edward Thomson
617bb17556 calloc refs instead of malloc'ing them 2013-05-09 17:44:44 +02:00
Vicent Martí
9ca4ff41eb Merge pull request #1563 from arrbee/doc-fix-repo-message
Fix git_repository_message docs
2013-05-09 06:48:16 -07:00
Russell Belfer
3d1c9f612d Fix git_repository_message docs
This clarifies the docs for git_repository_message and also adds
to the tests to explicitly check NUL termination of data when the
output buffer is smaller than the message size.  There is a minor
behavior change so that a non-NULL output buffer will always be
NUL terminated (at length zero) if an error occurs.
2013-05-09 06:45:06 -07:00
Vicent Martí
503dd0f3c4 Merge pull request #1560 from carlosmn/ref-dwim
Expose git_reference_dwim
2013-05-09 05:43:25 -07:00
Vicent Martí
ddc5c05421 Merge pull request #1561 from arrbee/fix-windows-diff-eofnl
Fix windows diff eofnl error
2013-05-09 05:42:37 -07:00
Russell Belfer
eb05b114e1 Fix dumb type in time comparison 2013-05-07 22:45:01 -07:00
Vicent Martí
af795759a7 Merge pull request #1552 from carlosmn/config-helpers
Config helpers for global/xdg config files
2013-05-07 15:09:11 -07:00
Carlos Martín Nieto
98d633cccf Expose git_reference_dwim
Extract this function out of the rev-parse code to be able to DWIM a
reference instead of its target.
2013-05-07 23:34:48 +02:00
Carlos Martín Nieto
5d8318875f config: convenience function to open global/xdg
The rules for which one to open is a bit silly, so let's make it
easier for our users.
2013-05-07 21:42:56 +02:00
Carlos Martín Nieto
a4b75dcf56 repo: unconditionally create a global config backend
When a repository is initialised, we need to probe to see if there is
a global config to load. If this is not the case, the user isn't able
to write to the global config without creating the backend and adding
it themselves, which is inconvenient and overly complex.

Unconditionally create and add a backend for the global config file
regardless of whether it exists as a convenience for users.

To enable this, we allow creating backends to files that do not exist
yet, changing the semantics somewhat, and making some tests invalid.
2013-05-07 21:42:56 +02:00
Vicent Martí
d6465e1a7d Merge pull request #1557 from carlosmn/tagopt
remote: correctly interpret tagopt '--tags'
2013-05-07 10:14:28 -07:00
Russell Belfer
0f938c6b8f Fix win32 type warnings 2013-05-07 09:59:53 -07:00
Carlos Martín Nieto
505b5d0c81 remote: correctly interpret tagopt '--tags'
When tagopt is set to '--tags', we should only take the default tags
refspec into account and ignore any configured ones.

Bring the code into compliance.
2013-05-07 18:49:47 +02:00
Vicent Martí
33665410d6 Merge pull request #1556 from arrbee/diff-patch-fixes
Diff patch bug fixes
2013-05-07 08:00:44 -07:00
Russell Belfer
c2f602f8a5 Fix line numbering for patches with eofnl
When a patch contained an eofnl change (i.e. the last line either
gained or lost a newline), the oldno and newno line number values
for the lines in the last hunk of the patch were not useful.  This
makes them behave in a more expected manner.
2013-05-07 07:15:39 -07:00
Russell Belfer
d63eec6946 Improve diff function docs 2013-05-07 04:44:08 -07:00
Russell Belfer
fd96f98e14 More tests for files with no newline at end 2013-05-07 04:36:42 -07:00
Russell Belfer
e35e2684f6 Add GIT_DIFF_LINE_CONTEXT_EOFNL
This adds a new line origin constant for the special line that
is used when both files end without a newline.

In the course of writing the tests for this, I was having problems
with modifying a file but not having diff notice because it was
the same size and modified less than one second from the start of
the test, so I decided to start working on nanosecond timestamp
support.  This commit doesn't contain the nanosecond support, but
it contains the reorganization of maybe_modified and the hooks so
that if the nanosecond data were being read by stat() (or rather
being copied by git_index_entry__init_from_stat), then the nsec
would be taken into account.

This new stuff could probably use some more tests, although there
is some amount of it here.
2013-05-07 04:32:17 -07:00
Carlos Martín Nieto
1c92f1090e Merge pull request #1551 from nvloff/set_upstream_local_branch
fix git_branch_set_upstream for local branches
2013-05-07 01:32:10 -07:00
Russell Belfer
51e297dd18 Merge pull request #1554 from sba1/sort-amiga-fix
Fixed qsort_r() problem when targeting AmigaOS.
2013-05-07 00:31:40 -07:00
Sebastian Bauer
7f8cf6fefd Fixed qsort_r() problem when targeting AmigaOS.
We fall back to the libgit2-provided insert sort as done for other
platforms.
2013-05-07 09:15:12 +02:00
Russell Belfer
590991a7e0 Merge pull request #1553 from jdavid/git_commit_owner
Add git_commit_owner to the public interface
2013-05-06 23:25:06 -07:00
J. David Ibáñez
6e8659969a Add git_commit_owner to the public interface
Just like git_tree_owner, etc.
2013-05-07 07:33:35 +02:00
Nikolai Vladimirov
3d42e9a31e 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
```
2013-05-06 20:33:11 +03:00
Vicent Martí
3405f78754 Merge pull request #1547 from ethomson/win32_stat
p_stat() should follow symlinks on windows
2013-05-06 06:51:21 -07:00
Vicent Martí
03c28d92d0 Merge pull request #1526 from arrbee/cleanup-error-return-without-msg
Make sure error messages are set for most error returns
2013-05-06 06:45:53 -07:00
Vicent Martí
d5e5bbd719 Merge pull request #1524 from jamill/clone_tagopts
By default do not set tagopt when cloning
2013-05-06 06:45:40 -07:00
Vicent Martí
450a78bf07 Merge pull request #1545 from ethomson/checkout_dirs_in_use
allow checkout to proceed when a dir to be removed is in use (win32)
2013-05-06 06:33:02 -07:00
Russell Belfer
0ed3fa8a37 Merge pull request #1550 from nvloff/fix_typo_in_branch_h
branch.h: fix typo in docs
2013-05-06 05:53:13 -07:00
Nikolai Vladimirov
72662202ac branch.h: fix typo in docs 2013-05-06 15:31:26 +03:00
Russell Belfer
3e96e3391c Merge pull request #1549 from nulltoken/fix/from_oids
Strict/lax commit API
2013-05-05 08:01:18 -07:00
nulltoken
467cbec73d commit: make create_from_oids() accept plain oid 2013-05-05 16:48:34 +02:00
nulltoken
ce72e399d2 commit: guard create() against not owned trees 2013-05-05 16:47:07 +02:00
Edward Thomson
00a4c47938 p_stat() should follow symlinks on windows 2013-05-04 12:40:41 -05:00
Jameson Miller
6f748f3885 Do not write tagopt configuration option on clone by default 2013-05-04 12:14:40 -04:00
Russell Belfer
6e286e8dc5 Remove obsolete test for peel type
Peeling to an invalid type is now checked via an assert so this
test is no longer relevant.
2013-05-04 01:04:23 -07:00
Edward Thomson
e09d18eed6 allow checkout to proceed when a dir to be removed is in use (win32) 2013-05-03 18:54:47 -05:00
Vicent Marti
dfec726bba odb: Do not error out if an alternate ODB is missing 2013-05-03 23:30:54 +02:00
Vicent Marti
b641c00eeb clar: Always generate the test suite 2013-05-03 17:35:50 +02:00
Vicent Martí
811c761fe1 Merge pull request #1540 from ethomson/leaks
fix some leaks
2013-05-03 08:19:12 -07:00
Edward Thomson
d80416384f fix some leaks 2013-05-02 20:43:45 -05:00
Vicent Martí
42b2bcf038 Merge pull request #1538 from ethomson/merge_warning_cleanup
braces
2013-05-02 13:42:16 -07:00
Edward Thomson
5e151329fb braces 2013-05-02 15:20:21 -05:00
Vicent Martí
dc83d32ade Merge pull request #1537 from ethomson/merge_warning_cleanup
puns are not funny; type punning especially so
2013-05-02 13:01:44 -07:00
Edward Thomson
4e7c15608f puns are not funny; type punning especially so 2013-05-02 14:58:40 -05:00
Russell Belfer
0cce210a54 Use assert for peel target type check 2013-05-02 10:36:58 -07:00
Vicent Martí
af7689ea24 Merge pull request #1535 from carlosmn/pack-threading
Switch to index_version as "git_pack_file is ready" flag
2013-05-02 09:50:34 -07:00
Carlos Martín Nieto
0ddfcb40d5 Switch to index_version as "git_pack_file is ready" flag
We use p->index_map.data to check whether the struct has been set up
and all the information about the index is stored there. This variable
gets set up halfway through the setup process, however, and a thread
can come along and use fields that haven't been written to yet.

Crucially, pack_entry_find_offset() needs to read the index version
(which is written after index_map) to know the offset and stride
length to pass to sha1_entry_pos(). If these values are wrong,
assertions in it will fail, as it will be reading bogus data.

Make index_version the last field to be written and switch from using
p->index_map.data to p->index_version as "git_pack_file is ready" flag
as we can use it to know if every field has been written.
2013-05-02 18:27:02 +02:00