Commit Graph

161 Commits

Author SHA1 Message Date
Russell Belfer
37f9e40939 Some tests with ident and crlf filters
Fixed the filter order to match core Git, too.

This test demonstrates an interesting behavior of core Git (which
is totally reasonable and which libgit2 matches, although mostly
by coincidence).  If you use the ident filter and commit a file
with a garbage ident in it, like '$Id: this is just garbage$' and
then immediately do a 'git checkout-index' with the new file, Git
will not consider the file out of date and will not overwrite the
file with an updated $Id$.  Libgit2 has the same behavior.  If you
remove the file and then do a checkout-index, it will be replaced
with a filtered version that has injected the OID correctly.
2013-09-17 09:31:46 -07:00
Carlos Martín Nieto
605da51a2c No such thing as an orphan branch
Unfortunately git-core uses the term "unborn branch" and "orphan
branch" interchangeably. However, "orphan" is only really there for
the checkout command, which has the `--orphan` option so it doesn't
actually create the branch.

Branches never have parents, so the distinction of a branch with no
parents is odd to begin with. Crucially, the error messages deal with
unborn branches, so let's use that.
2013-09-17 09:50:30 +02:00
Russell Belfer
0c52b204c5 Make work if built with threading enabled 2013-09-09 11:07:17 -07:00
Krzysztof Adamski
b2395a8267 Only use callbacks when -n or -v in add example. 2013-09-09 11:01:31 -07:00
Krzysztof Adamski
04fd266584 Move statement after declarations in add example. 2013-09-09 11:01:31 -07:00
Krzysztof Adamski
9a0e42c673 Remove unnececery arguments priting in add example. 2013-09-09 11:01:30 -07:00
Krzysztof Adamski
813937ce4e Better usage info in add example. 2013-09-09 11:01:30 -07:00
Krzysztof Adamski
24d2322096 Add -u option to add example. 2013-09-09 11:01:30 -07:00
Krzysztof Adamski
e8fa14d3a3 Supported options information in add example. 2013-09-09 11:01:30 -07:00
Krzysztof Adamski
62020aa8f9 Adding add example. 2013-09-09 11:01:30 -07:00
Russell Belfer
60ee53dfce Split examples CMakeLists.txt
Also, this converts the examples/CMakeLists.txt from explicitly
listing to just globbing for all the individual C files.
2013-09-03 15:20:16 -07:00
Krzysztof Adamski
255836ddac Adding credentials callback to ls-remote and fetch too. 2013-09-01 19:00:16 +02:00
Krzysztof Adamski
d6d523486c Removing unneeded code duplication in ls-remote.c 2013-09-01 19:00:16 +02:00
Russell Belfer
0ea41445f4 Improve isolation of new test from user environs 2013-08-16 15:04:15 -07:00
Russell Belfer
944c1589c2 Add example like "git init" 2013-08-16 15:04:15 -07:00
Brendan Macmillan
c3ae047361 Fix -n bug; default to all ancestors 2013-07-27 05:34:49 +10:00
Russell Belfer
bc6f0839eb Add a bunch more features to log example 2013-07-10 20:50:32 +02:00
Russell Belfer
a8b5f116bc Fix example/log.c pathspec handling of merges
This fixes the way the example log program decides if a merge
commit should be shown when a pathspec is given.  Also makes it
easier to use the pathspec API to just check "does a tree match
anything in the pathspec" without allocating a match list.
2013-07-10 20:50:32 +02:00
Russell Belfer
733c4f3aca more examples/log.c bug fixing 2013-07-10 20:50:32 +02:00
Russell Belfer
5a169711fa fix bug with order args and no revision 2013-07-10 20:50:32 +02:00
Russell Belfer
2b3bd8ecd8 Fix example/log.c minor diffs with git log 2013-07-10 20:50:32 +02:00
Russell Belfer
f44c4fa108 Add basic commit formatting to log output 2013-07-10 20:50:32 +02:00
Russell Belfer
8ba0ff6972 rev-parse example 2013-07-10 20:50:32 +02:00
Russell Belfer
d0628e2fee More progress on log example 2013-07-10 20:50:32 +02:00
Russell Belfer
0d44d3dc84 Extending log example code
This adds more command line processing to the example version of
log.  In particular, this adds the funky command line processing
that allows an arbitrary series of revisions followed by an
arbitrary number of paths and/or glob patterns.

The actual logging part still isn't implemented.
2013-07-10 20:50:32 +02:00
Russell Belfer
d39fff3648 Basic framework for log command 2013-07-10 20:50:31 +02:00
Russell Belfer
9280855787 Fix comment and copyright in example 2013-06-20 15:10:42 -07:00
Russell Belfer
f18f772a8e Add example implementation of long format status 2013-06-20 14:27:14 -07:00
Russell Belfer
22b6b82f2c Add status flags to force output sort order
Files in status will, be default, be sorted according to the case
insensitivity of the filesystem that we're running on.  However,
in some cases, this is not desirable.  Even on case insensitive
file systems, 'git status' at the command line will generally use
a case sensitive sort (like 'ls').  Some GUIs prefer to display a
list of file case insensitively even on case-sensitive platforms.

This adds two new flags: GIT_STATUS_OPT_SORT_CASE_SENSITIVELY
and GIT_STATUS_OPT_SORT_CASE_INSENSITIVELY that will override the
default sort order of the status output and give the user control.
This includes tests for exercising these new options and makes
the examples/status.c program emulate core Git and always use a
case sensitive sort.
2013-06-20 12:16:06 -07:00
Russell Belfer
cf300bb9e5 Initial implementation of status example 2013-06-20 11:39:31 -07:00
Russell Belfer
5c8f37a397 Extend diff example
Add --raw output format and (some) options to invoke rename/copy
detection on the diff.
2013-05-17 17:33:03 -07:00
Russell Belfer
8d78400142 Make examples/diff.c compile vs threadsafe library 2013-05-16 10:43:10 -07:00
Russell Belfer
58206c9ae7 Add cat-file example and increase const use in API
This adds an example implementation that emulates git cat-file.
It is a convenient and relatively simple example of getting data
out of a repository.

Implementing this also revealed that there are a number of APIs
that are still not using const pointers to objects that really
ought to be.  The main cause of this is that `git_vector_bsearch`
may need to call `git_vector_sort` before doing the search, so a
const pointer to the vector is not allowed.  However, for tree
objects, with a little care, we can ensure that the vector of
tree entries is always sorted and allow lookups to take a const
pointer.  Also, the missing const in commit objects just looks
like an oversight.
2013-05-16 10:38:27 -07:00
nulltoken
1fed6b07f0 Fix trailing whitespaces 2013-05-15 22:41:30 +02:00
Carlos Martín Nieto
2b562c3a1e refs: remove the OID/SYMBOLIC filtering
Nobody should ever be using anything other than ALL at this level, so
remove the option altogether.

As part of this, git_reference_foreach_glob is now implemented in the
frontend using an iterator. Backends will later regain the ability of
doing the glob filtering in the backend.
2013-05-11 11:20:38 +02:00
Carlos Martín Nieto
6c1b6b7abc examples: init the threading system 2013-04-23 16:21:47 +02:00
Vicent Marti
32ef1d1c7c Fix examples 2013-04-16 00:17:40 +02:00
Vicent Marti
d064c74794 Merge remote-tracking branch 'ben/unified-revparse' into development 2013-04-15 23:18:24 +02:00
Ben Straub
201566539f Clean up minor details 2013-04-15 13:29:40 -07:00
Ben Straub
5961d5ea7f Clean up example code. 2013-04-15 12:10:18 -07:00
Ben Straub
299a224be1 Change git_revparse to output git_object pointers
This will probably prevent many lookup/free
operations in calling code.
2013-04-15 12:00:04 -07:00
Vicent Marti
0d3ccf0b28 examples: Don't print weird characters 2013-04-10 16:41:05 +02:00
Russell Belfer
9da187e83d Fix clang warnings and improve checks 2013-04-09 11:40:00 -07:00
Ben Straub
ec7e240ba4 Add rev-list example to makefiles 2013-04-09 05:07:12 +04:00
Ben Straub
1aa21fe3b8 Deprecate git_revparse_single and _rangelike 2013-04-09 05:07:04 +04:00
Vicent Marti
d9ecaf8c6f Merge remote-tracking branch 'gnprice/revwalk' into development 2013-04-07 07:22:38 +02:00
Greg Price
2e2332857d examples: a test, for rev-list
This test file could probably be improved by a framework like
the one in git.git:t/, or by using a language like Python instead
of shell.

The other examples would benefit from tests too.  Probably best
to settle on a framework to write them in, then add more tests.

Signed-off-by: Greg Price <price@mit.edu>
2013-04-06 20:51:16 -07:00
Greg Price
8f7f5e5543 examples: rev-list
This demonstrates parts of the interface for specifying revisions that
Git users are familiar with from 'git rev-list', 'git log', and other
Git commands.  A similar query interface is used in out-of-core
command-line programs that browse a Git repo (like 'tig'), and may be
useful for an 'advanced search' interface in GUI or web applications.

In this version, we parse all the query modifiers we can support with
the existing logic in revwalk: basic include/exclude commits, and the
ordering flags.  More logic will be required to support '--grep',
'--author', the pickaxe '-S', etc.

Signed-off-by: Greg Price <price@mit.edu>
2013-04-06 20:51:16 -07:00
Ben Straub
f8591e519a General example: run against testrepo.git
Fixes #1455
2013-04-04 11:44:50 -07:00
lionel vitte
e2886f1e7e Fix link issue in network examples 2013-03-20 21:13:43 +08:00