Commit Graph

8910 Commits

Author SHA1 Message Date
Carlos Martín Nieto
7132150ddf tree: avoid advancing over the filename multiple times
We've already looked at the filename with `memchr()` and then used
`strlen()` to allocate the entry. We already know how much we have to
advance to get to the object id, so add the filename length instead of
looking at each byte again.
2015-11-28 19:21:51 +01:00
Edward Thomson
e0ab1ca028 Merge pull request #3523 from pks-t/memleak-fixes
Memleak fixes
2015-11-24 14:30:41 -05:00
Carlos Martín Nieto
41854c7f83 Merge pull request #3520 from ethomson/checkout_nsecs
checkout: only consider nsecs when built that way
2015-11-24 15:56:55 +01:00
Patrick Steinhardt
77b79dde84 tests: win32::longpath: free expected_msg 2015-11-24 15:21:52 +01:00
Patrick Steinhardt
9031be180b tests: config::stress: free git_config structs 2015-11-24 15:21:52 +01:00
Patrick Steinhardt
c8fab201eb tests: config::global: fix memleak in open_programdata 2015-11-24 14:47:50 +01:00
Edward Thomson
25e84f959a checkout: only consider nsecs when built that way
When examining the working directory and determining whether it's
up-to-date, only consider the nanoseconds in the index entry when
built with `GIT_USE_NSEC`.  This prevents us from believing that
the working directory is always dirty when the index was originally
written with a git client that uinderstands nsecs (like git 2.x).
2015-11-23 15:49:54 -05:00
Edward Thomson
66e4e6da59 Merge pull request #3515 from jacquesg/unsigned-signed
Fix <0 unsigned comparison (stat.st_size should be an off_t)
2015-11-21 11:26:18 -05:00
Jacques Germishuys
e78e8fae5c Make stat.st_size a __int64 not a uint64_t 2015-11-21 14:41:15 +02:00
Edward Thomson
c4f60543b7 Merge pull request #3517 from jacquesg/warnings-fixes
Fix some warnings
2015-11-20 17:57:04 -05:00
Edward Thomson
7a612b53cf Merge pull request #3514 from jacquesg/stat-fixes
Stat fixes
2015-11-20 17:52:00 -05:00
Edward Thomson
1f6c891e95 Merge pull request #3516 from libgit2/cmn/repository-state-sequencer
repository: distinguish sequencer cherry-pick and revert
2015-11-20 15:38:33 -05:00
Jacques Germishuys
eb11fac629 Detect stat's structure 2015-11-20 21:05:38 +02:00
Jacques Germishuys
87428c556f Fix some warnings 2015-11-20 20:48:51 +02:00
Carlos Martín Nieto
2ea40fdaac repository: distinguish sequencer cherry-pick and revert
These are not quite like their plain counterparts and require special handling.
2015-11-20 13:19:23 -05:00
Carlos Martín Nieto
69d1494873 Merge pull request #3511 from ethomson/racy_fixes_2
Racy fixes for writing new indexes
2015-11-17 13:21:18 -05:00
Carlos Martín Nieto
41744745e3 Merge pull request #3512 from ethomson/windows_sysdir
Protect windows SYSDIR when running tests
2015-11-17 13:20:48 -05:00
Edward Thomson
88638f9b18 tests: use out-of-the-way config dir in sandbox
Don't put the configuration in a subdir of the sandbox named
`config`, lest some tests decide to create their own directory
called `config`.  Prefix with some underscores for uniqueness.
2015-11-17 11:22:01 -05:00
Edward Thomson
fe96374823 tests: set PROGRAMDATA directory for running tests 2015-11-17 08:47:26 -05:00
Edward Thomson
6f7c411834 config::global: use PROGRAMDATA configuration
Query the `GIT_CONFIG_LEVEL_PROGRAMDATA` location when setting it up
for tests, in case the test runner has sandboxed it.
2015-11-17 08:46:21 -05:00
Edward Thomson
3eac1037d6 settings: allow users to set PROGRAMDATA
Allow users to set the `git_libgit2_opts` search path for the
`GIT_CONFIG_LEVEL_PROGRAMDATA`.  Convert `GIT_CONFIG_LEVEL_PROGRAMDATA`
to `GIT_SYSDIR_PROGRAMDATA` for setting the configuration.
2015-11-16 23:31:19 -05:00
Edward Thomson
5f32c50683 racy: make git_index_read_index handle raciness
Ensure that `git_index_read_index` clears the uptodate bit on
files that it modifies.

Further, do not propagate the cache from an on-disk index into
another on-disk index.  Although this should not be done, as
`git_index_read_index` is used to bring an in-memory index into
another index (that may or may not be on-disk), ensure that we do
not accidentally bring in these bits when misused.
2015-11-16 22:59:02 -05:00
Edward Thomson
c30051f0d0 racy: ensure git_index_read_tree clears uptodate
Ensure that `git_index_read_tree` clears the uptodate bit on files
that it modifies.
2015-11-16 22:59:01 -05:00
Edward Thomson
27bc41cf17 index: clear uptodate bit on save
The uptodate bit should have a lifecycle of a single read->write
on the index.  Once the index is written, the files within it should
be scanned for racy timestamps against the new index timestamp.
2015-11-16 22:59:01 -05:00
Edward Thomson
956f4da897 index: test for smudged entries on write only
Test that entries are only smudged when we write the index: the
entry smudging is to prevent us from updating an index in a way
that it would be impossible to tell that an item was racy.
Consider when we load an index:  any entries that have the same
(or newer) timestamp than the index itself are considered racy,
and are subject to further scrutiny.

If we *save* that index with the same entries that we loaded,
then the index would now have a newer timestamp than the entries,
and they would no longer be given that additional scrutiny, failing
our racy detection!  So test that we smudge those entries only on
writing the new index, but that we can detect them (in diff) without
having to write.
2015-11-16 22:58:59 -05:00
Edward Thomson
de999f260f checkout::crlf test: don't crash when no idx entry
When there's no matching index entry (for whatever reason), don't
try to dereference the null return value to get at the id.

Otherwise when we break something in the index API, the checkout
test crashes for confusing reasons and causes us to step through
it in a debugger thinking that we had broken much more than we
actually did.
2015-11-16 22:58:59 -05:00
Edward Thomson
d1101263f7 index: don't detect raciness in uptodate entries
Keep track of entries that we believe are up-to-date, because we
added the index entries since the index was loaded.  This prevents
us from unnecessarily examining files that we wrote during the
cleanup of racy entries (when we smudge racily clean files that have
a timestamp newer than or equal to the index's timestamp when we
read it).  Without keeping track of this, we would examine every
file that we just checked out for raciness, since all their timestamps
would be newer than the index's timestamp.
2015-11-16 22:58:58 -05:00
Edward Thomson
cb0ff012d3 racy-git: do a single index->workdir diff
When examining paths that are racily clean, do a single index->workdir
diff over the entirety of the racily clean files, instead of a diff
per file.
2015-11-16 22:58:57 -05:00
Carlos Martín Nieto
32b9e647c5 Merge pull request #3506 from libgit2/vmg/pool-align
pool: Never return unaligned buffers
2015-11-13 05:41:18 +01:00
Vicent Marti
7ff7ca623e pool: Never return unaligned buffers 2015-11-13 04:57:19 +01:00
Carlos Martín Nieto
75a0ccf52f Merge pull request #3170 from CmdrMoozy/nsec_fix
git_index_entry__init_from_stat: set nsec fields in entry stats
2015-11-12 19:53:09 +01:00
Carlos Martín Nieto
2c26c8679f Merge pull request #3499 from ethomson/ref_dir_errmsgs
Improve error messages when dirs prevent ref/reflog creation
2015-11-12 19:22:31 +01:00
Carlos Martín Nieto
ecdc04287a Merge pull request #3448 from libgit2/cmn/custom-agent
Support setting custom user-agent
2015-11-12 19:20:36 +01:00
Carlos Martín Nieto
027bbaa721 CHANGELOG: add note about custom user-agent 2015-11-12 17:20:30 +01:00
Carlos Martín Nieto
1411cb9eb5 winhttp: use a custom user-agent if the user has set it
We also keep the "git/1.0" prefix in order to maintain compatibility
with hosters.
2015-11-12 17:18:42 +01:00
Carlos Martín Nieto
94bac76c3f http: use a custom user-agent if the user has set it
We still prefix it with "git/1.0" since that's required in many
situations, but we replace the area which mentions libgit2.
2015-11-12 17:18:42 +01:00
Carlos Martín Nieto
de870533e0 settings: add a setter for a custom user-agent 2015-11-12 17:18:42 +01:00
Edward Thomson
3f5877d18f Merge pull request #2534 from libgit2/ntk/case_index_conflicts
Failing test for case sensitive conflicts in the index
2015-11-12 10:13:11 -05:00
Edward Thomson
0a700ee368 reflog: error when a directory is at reflog path
When a non-empty directory exists and prevents the creation of a
reflog, provide a more informative error message.
2015-11-12 09:39:29 -05:00
Edward Thomson
b46c7ee5e2 refs: complain when a directory exists at ref
When a (non-empty) directory exists at the reference target
location, complain with a more actionable error message.
2015-11-12 09:35:51 -05:00
Carlos Martín Nieto
ad8509ef9f index: overwrite the path when inserting conflicts
When we insert a conflict in a case-insensitive index, accept the
new entry's path as the correct case instead of leaving the path we
already had.

This puts `git_index_conflict_add()` on the same level as
`git_index_add()` in this respect.
2015-11-12 12:11:45 +01:00
Carlos Martín Nieto
16604d7469 index: correctly report which conflict stage has a wrong filemode
When we're at offset 'i', we're dealing with the 'i+1' stage, since
conflicts start at 1.
2015-11-12 12:11:45 +01:00
nulltoken
1314af8d63 Failing test for case sensitive conflicts in the index 2015-11-12 12:11:45 +01:00
Carlos Martín Nieto
1c34b717e0 Merge pull request #3498 from ethomson/windows_symlinks
Diff: Honor `core.symlinks=false` and fake symlinks
2015-11-08 05:10:18 +01:00
Carlos Martín Nieto
619488948b Merge pull request #3500 from ethomson/submodules_with_path
Handle submodules with paths in `git_submodule_update`
2015-11-08 04:54:55 +01:00
Edward Thomson
f4b0267122 submodule: reload HEAD/index after reading config
Reload the HEAD and index data for a submodule after reading the
configuration.  The configuration may specify a `path`, so we must
update HEAD and index data with that path in mind.
2015-11-04 16:53:41 -05:00
Edward Thomson
790012ce78 submodule: test updating a submodule w/ a path
Test that `git_submodule_update` can handle a submodule that is
freshly cloned and has a path differing from its name.
2015-11-04 16:53:41 -05:00
Edward Thomson
5aa28a8f2d Merge pull request #3465 from libgit2/cmn/tls-register
stream: allow registering a user-provided TLS constructor
2015-11-04 14:16:24 -05:00
Edward Thomson
610e553f5b Merge branch 'pr/3487' 2015-11-03 17:52:21 -05:00
Stjepan Rajko
f5f96a23ee Fix git_commit_summary to convert newlines to spaces even after
whitespace.  Collapse spaces around newlines for the summary.
2015-11-03 17:50:55 -05:00