Commit Graph

7418 Commits

Author SHA1 Message Date
Edward Thomson
e3bd48a793 Merge pull request #2696 from libgit2/cmn/empty-objects
odb: hardcode the empty blob and tree
2014-11-08 16:52:43 -05:00
Edward Thomson
09d1408c52 Merge pull request #2694 from Therzok/statusFile
git_status_file now takes an exact path.
2014-11-08 16:49:30 -05:00
Carlos Martín Nieto
e1ac010148 odb: hardcode the empty blob and tree
git hardocodes these as objects which exist regardless of whether they
are in the odb and uses them in the shell interface as a way of
expressing the lack of a blob or tree for one side of e.g. a diff.

In the library we use each language's natural way of declaring a lack of
value which makes a workaround like this unnecessary. Since git uses it,
it does however mean each shell application would need to perform this
check themselves.

This makes it common work across a range of applications and an issue
with compatibility with git, which fits right into what the library aims
to provide.

Thus we introduce the hard-coded empty blob and tree in the odb
frontend. These hard-coded objects are checked for before going to the
backends, but after the cache check, which means the second time they're
used, they will be treated as normal cached objects instead of creating
new ones.
2014-11-08 20:53:38 +01:00
Ungureanu Marius
6818208569 git_status_file now takes an exact path
This function has one output but can match multiple files, which can be
unexpected for the user, which would usually path the exact path of the
file he wants the status of.
2014-11-07 21:34:54 +02:00
Edward Thomson
4e1b3b3b71 Merge pull request #2691 from libgit2/cmn/submodule-and-dir
submodules: stale module entries
2014-11-07 09:28:41 -05:00
Carlos Martín Nieto
62a617dc68 iterator: submodules are determined by an index or tree
We cannot know from looking at .gitmodules whether a directory is a
submodule or not. We need the index or tree we are comparing against to
tell us. Otherwise we have to assume the entry in .gitmodules is stale
or otherwise invalid.

Thus we pass the index of the repository into the workdir iterator, even
if we do not want to compare against it. This follows what git does,
which even for `git diff <tree>`, it will consider staged submodules as
such.
2014-11-07 08:33:27 +01:00
Carlos Martín Nieto
f1a7906fdf submodules: add failing test for stale module entries
We consider an entry in .gitmodules to mean that we have a submodule at
a particular path, even if HEAD^{tree} and the index do not contain any
reference to it.

We should ignore that submodule entry and simply consider that path to
be a regular directory.
2014-11-07 08:33:27 +01:00
Carlos Martín Nieto
dd83e60212 Merge pull request #2692 from ethomson/bug2515
checkout_index: handle other stages
2014-11-07 08:32:50 +01:00
Edward Thomson
2d24816b46 checkout_index: Remove stage 0 when checking out conflicts 2014-11-06 18:50:10 -05:00
Edward Thomson
9f664347ff checkout_index: remove conflicts when checking out new files 2014-11-06 18:49:57 -05:00
Edward Thomson
64dc248577 Merge pull request #2598 from libgit2/cmn/stacked-ignore
ignore: don't leak rules into higher directores
2014-11-06 10:38:25 -05:00
Edward Thomson
7bb639911b Merge pull request #2676 from libgit2/cmn/threading
Threading and crypto libraries
2014-11-06 10:25:23 -05:00
Edward Thomson
f890a84fe0 Merge pull request #2682 from libgit2/cmn/fetch-tags-refspec
remote: check for the validity of the refspec when updating FETCH_HEAD
2014-11-06 10:19:22 -05:00
Carlos Martín Nieto
6069042fcb ignore: don't leak rules into higher directories
A rule "src" in src/.gitignore must only match subdirectories of
src/. The current code does not include this context in the match rule
and would thus consider this rule to match the top-level src/ directory
instead of the intended src/src/.

Keep track fo the context in which the rule was defined so we can
perform a prefix match.
2014-11-06 10:10:26 +01:00
Carlos Martín Nieto
0798b01400 ignore: add failing test for a file mentioning the parent
When we mention "src" in src/.gitignore, we wrongly consider src/ itself
to be ignored.
2014-11-06 10:10:26 +01:00
Edward Thomson
b4e5432ff0 Merge pull request #2688 from libgit2/cmn/ignore-file-trailing-cr
ignore: consider files with a CR in their names
2014-11-05 10:47:19 -05:00
Carlos Martín Nieto
5c54e2162a ignore: consider files with a CR in their names
We currently consider CR to start the end of the line, but that means
that we miss cases with CR CR LF which can be used with git to match
files whose names have CR at the end of their names.

The fix from the patch comes from Russell's comment in the issue.

This fixes #2536.
2014-11-05 16:22:01 +01:00
Carlos Martín Nieto
3f8d005a82 Merge pull request #2686 from ethomson/rename_notfound
Propogate GIT_ENOTFOUND from git_remote_rename
2014-11-03 22:27:11 +01:00
Edward Thomson
cce27d8242 git_remote_rename: propogate GIT_ENOTFOUND 2014-11-03 14:10:31 -05:00
Edward Thomson
de0c4555da Merge pull request #2679 from jfultz/missing-include
Make config reading continue after hitting a missing include file.
2014-11-03 11:32:47 -05:00
Carlos Martín Nieto
6d20006f7e remote: check the relevance of the refspec when updating FETCH_HEAD
Before trying to rtransform using the given refspec to figure out what
the name of the upstream branch is on the remote, we must make sure that
the target of the refspec applies to the current branch's upstream.
2014-11-03 15:12:32 +01:00
Edward Thomson
0a62918188 Merge pull request #2661 from swisspol/2656
Changed context_lines and interhunk_lines to uint32_t to match struct s_xdemitconf
2014-11-03 15:10:14 +01:00
Edward Thomson
4bb8708730 Merge pull request #2683 from libgit2/cmn/remote-unify
remote: unify the creation code
2014-11-03 15:01:41 +01:00
Edward Thomson
873eb899e4 Merge pull request #2680 from libgit2/cmn/invalid-cert-return
netops: return GIT_ECERTIFICATE when it fails the basic tests
2014-11-03 14:57:39 +01:00
Edward Thomson
0fab748e91 Merge pull request #2685 from libgit2/cmn/mmap-readable
Fix segmentation fault observed on OpenBSD/sparc64
2014-11-03 14:52:34 +01:00
Edward Thomson
2cc6011e69 Merge pull request #2684 from jacquesg/openssl-windows
Make the Visual Studio compiler happy
2014-11-03 14:49:56 +01:00
Stefan Sperling
aad0bd6bc7 Fix segmentation fault observed on OpenBSD/sparc64
A non-readable mapping of a file causes an access violation in
the pack tests. Always use PROT_READ to work around this.
2014-11-03 13:49:04 +01:00
Jacques Germishuys
bc48bcdcb3 Make the Visual Studio compiler happy 2014-11-03 14:23:13 +02:00
John Fultz
ebc13b2b7c Clean up issues include.path issues found during code review.
* Error-handling is cleaned up to only let a file-not-found error
  through, not other sorts of errors.  And when a file-not-found
  error happens, we clean up the error.
* Test now checks that file-not-found introduces no error.  And
  other minor cleanups.
2014-11-02 19:16:49 -06:00
Carlos Martín Nieto
a68e217f5c remote: unify the creation code
The create function with default refspec is the same as the one with a
custom refspec, but it has the default refspec, so we can create the one
on top of the other.
2014-11-02 21:58:39 +01:00
Carlos Martín Nieto
ea8dedc953 remote: fix tagopt test
An anonymous remote wouldn't create remote-tracking branches, so testing
we don't create them for TAGS_ALL is nonsensical. Furthermore, the name
of the supposed remote-tracking branch was also not one which would have
been created had it had a name.

Give the remote a name and test that we only create the tags when we
pass TAGS_ALL and that we do create the remote-branch branch when given
TAGS_AUTO.
2014-11-02 20:39:29 +01:00
Carlos Martín Nieto
0f838d27f1 remote: add a failing test for checking the current branch's upstream
When we update FETCH_HEAD we check whether the remote is the current
branch's upstream remote. The code does not check whether the current
refspec is relevant for this reference but always tries to perform the
reverse transformation, which causes it to error out if the refspec
doesn't match the reference.

Thanks to Pierre-Olivier Latour for the reproduction recipe.
2014-11-02 20:03:23 +01:00
Carlos Martín Nieto
521c0cab7a merge: talk about the merging state after git_merge()
Since it's not necessarily obvious, mention the merging state and how to
clear it.
2014-11-02 17:18:19 +01:00
Carlos Martín Nieto
22fbb2656e netops: return GIT_ECERTIFICATE when it fails the basic tests
When we first ask OpenSSL to verify the certfiicate itself (rather
than the HTTPS specifics), we should also return
GIT_ECERTIFICATE. Otherwise, the caller would consider this as a failed
operation rather than a failed validation and not call the user's own
validation.
2014-11-02 16:12:10 +01:00
John Fultz
727ae380a5 Make config reading continue after hitting a missing include file.
For example, if you have

[include]
path = foo

and foo didn't exist, git_config_open_ondisk() would just give up
on the rest of the file.  Now it ignores the unresolved include
without error and continues reading the rest of the file.
2014-11-01 11:21:45 -05:00
Carlos Martín Nieto
15bea02c04 docs: explicitly document the threading caveats
Talk about sharing objects and error messages; but the most important
part is about what to do with the cryptographic libraries, which sadly
have to become to responsibility of the application.
2014-11-01 10:58:55 +01:00
Carlos Martín Nieto
fe6b51ae40 ssl: separate locking init from general init
Extract the lock-setting functions into their own, as we cannot assume
that it's ok for us to set this unconditionally.
2014-11-01 10:58:55 +01:00
Carlos Martín Nieto
e083657771 ssl: clear the OpenSSL locking function
We're freeing the memory which holds the locks so we must make sure that
the locking function doesn't try to use it.
2014-11-01 10:47:22 +01:00
Edward Thomson
264d74fd40 Merge pull request #2669 from ethomson/revert_test_fix
revert tests: always use core.autocrlf=false in tests
2014-10-27 15:04:21 -07:00
Edward Thomson
53ca45ee25 revert tests: always use core.autocrlf=false in tests 2014-10-27 17:27:25 -04:00
Edward Thomson
7647f4495d Merge pull request #2659 from swisspol/static_analysis
Fixed the most obvious Clang static analyzer warnings
2014-10-27 12:19:42 -07:00
Pierre-Olivier Latour
64bcf567c3 Fixed potential crash with uninitialized variables 2014-10-27 09:19:07 -07:00
Pierre-Olivier Latour
ea66215d87 Removed some useless variable assignments 2014-10-27 09:19:07 -07:00
Pierre-Olivier Latour
d88766c4e1 Changed context_lines and interhunk_lines to uint32_t to match struct s_xdemitconf 2014-10-27 09:17:01 -07:00
Edward Thomson
116a19d467 Merge pull request #2666 from libgit2/cmn/threadsafe-on
Flip THREADSAFE's default to ON
2014-10-27 06:33:11 -07:00
Carlos Martín Nieto
177a29d832 Merge commit 'refs/pull/2366/head' of github.com:libgit2/libgit2 2014-10-27 10:39:45 +01:00
Carlos Martín Nieto
79b0ae4e24 Flip THREADSAFE's default to ON
Threads are here to stay; and for a while now, users have had to call
the initialization function which sets up threads and crypto regardless
of whether the library was built threadsafe or not.
2014-10-27 10:30:57 +01:00
Edward Thomson
aabe1e5a44 Merge branch 'csware/cleanup' 2014-10-26 23:36:15 -04:00
Sven Strickroth
334a0696f9 Minor cleanup: Use defined no_check_cert_flags instead of C&P them again
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-10-26 23:23:08 -04:00
Edward Thomson
b07db1eb76 Merge pull request #2482 from libgit2/ed/rebase
Rebase (merge)
2014-10-26 20:18:04 -07:00