Commit Graph

278 Commits

Author SHA1 Message Date
Edward Thomson
72ca65d538 Merge pull request #2808 from libgit2/cmn/repo-ident
Remove the signature from ref-modifying functions
2015-03-03 10:07:36 -05:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
fe477951be Merge pull request #2885 from JIghtuse/master
describe example: function to add commits to opts
2015-03-03 14:35:10 +01:00
Edward Thomson
14fec0aea3 example: drop SAFE_CREATE from clone example 2015-02-27 13:50:40 -05:00
Boris Egorov
23d1dbe919 describe example: function to add commits to opts
Add safe function to (a,rea)llocate memory which terminate example on
memory allocation failure.

Move code to allocate commits to its own function.
2015-02-06 12:16:40 +06:00
Boris Egorov
2107dac346 for-each-ref example: init/shutdown libgit2 in main
I don't get how it was working without git_libgit2_init() call. I run it
and libgit2 throws assertion somewhere in its internals. Now it works.

Updated commit with shutdown at the end.
2015-02-05 10:51:22 +06:00
Boris Egorov
36e13399c0 describe example: fix memory allocation size
We need to allocate memory for sizeof(char *) * ncommits, not just for
ncommits.

Issue detected by GCC's AddressSanitizer.
2015-01-25 22:34:46 +06:00
Edward Thomson
9af3c4169c clone example: don't divide by zero
Local transports don't have data about the size, avoid dividing by
zero in the callback.
2015-01-10 18:24:27 +00:00
Will Stamper
b874629b2d Spelling fixes 2014-12-04 21:06:59 -06:00
Vicent Marti
2e1e0f108f blame: Do not assume blob contents are NULL-terminated 2014-11-21 17:24:55 +01:00
Carlos Martín Nieto
799e22ea0c Rename git_threads_ to git_libgit2_
This describes their purpose better, as we now initialize ssl and some
other global stuff in there. Calling the init function is not something
which has been optional for a while now.
2014-11-08 23:46:39 +01:00
Carlos Martín Nieto
209425ce26 remote: rename _load() to _lookup()
This brings it in line with the rest of the lookup functions.
2014-11-08 13:28:27 +01:00
Linquize
d6bbcefce3 describe: add example 2014-10-12 19:25:20 +08:00
Carlos Martín Nieto
3f89420523 remote: allow overriding the refspecs for download and fetch
With opportunistic ref updates, git has introduced the concept of having
base refspecs *and* refspecs that are active for a particular fetch.

Let's start by letting the user override the refspecs for download.
2014-09-30 15:42:32 +02:00
Vicent Marti
14556cbff7 Merge pull request #2567 from cirosantilli/factor-41
Factor 40 and 41 constants from source.
2014-09-17 17:13:25 +02:00
Ciro Santilli
3b2cb2c91e Factor 40 and 41 constants from source. 2014-09-16 13:07:04 +02:00
Linquize
2c22193ba0 Fix typo 2014-09-16 08:56:33 +08:00
Linquize
bd465f9c22 Fix warning 2014-09-01 23:36:12 +08:00
Eoin Coffey
33bf1b1ab0 examples/log.c: invert filtering impl and conditional 2014-05-28 09:40:08 -06:00
Eoin Coffey
26cce32133 Add support for --grep 2014-05-23 12:59:19 -06:00
Eoin Coffey
161e6dc1ca Add --committer option, and break out helper function 2014-05-23 12:27:16 -06:00
Eoin Coffey
97fc71ab3b Add support for --author flag in example log implementation 2014-05-22 17:22:45 -06:00
Edward Thomson
ead9c591ef Include windows.h on win32 for Sleep 2014-05-21 17:25:00 -07:00
Jeff King
56ec2256f2 examples: add a basic for-each-ref example
This is quite close to running "git for-each-ref" except:

  1. It does not take any formatting or selection options at
     all.

  2. The output is not sorted.

I wrote it to look at debugging some issues with ref
iteration, but there's no reason it can't live on as an
example command.
2014-05-08 15:49:38 -04:00
Linquize
d0420fc681 Make examples/status.c compile on Windows 2014-05-01 22:39:35 +08:00
Vicent Marti
8443ed6c1d Merge pull request #2284 from jacquesg/push-progress-callback
Fire progress and update tips callbacks also for pushes.
2014-04-25 02:10:19 -07:00
Russell Belfer
8d09efa24e Use git_diff_get_stats in example/diff + refactor
This takes the `--stat` and related example options in the example
diff.c program and converts them to use the `git_diff_get_stats`
API which nicely formats stats for you.

I went to add bar-graph scaling to the stats formatter and noticed
that the `git_diff_stats` structure was holding on to all of the
`git_patch` objects.  Unfortunately, each of these objects keeps
the full text of the diff in memory, so this is very expensive.  I
ended up modifying `git_diff_stats` to keep just the data that it
needs to keep and allowed it to release the patches.  Then, I added
width scaling to the output on top of that.

In making the diff example program match 'git diff' output, I ended
up removing an newline from the sumamry output which I then had to
compensate for in the email formatting to match the expectations.

Lastly, I went through and refactored the tests to use a couple of
helper functions and reduce the overall amount of code there.
2014-04-22 12:33:27 -07:00
Russell Belfer
12e422a056 Some doc and examples/diff.c changes
I was playing with "git diff-index" and wanted to be able to
emulate that behavior a little more closely with the diff example.

Also, I wanted to play with running `git_diff_tree_to_workdir`
directly even though core Git doesn't exactly have the equivalent,
so I added a command line option for that and tweaked some other
things in the example code.

This changes a minor output thing in that the "raw" print helper
function will no longer add ellipses (...) if the OID is not
actually abbreviated.
2014-04-22 09:17:29 -07:00
Jacques Germishuys
48e60ae75e Don't redefine the same callback types, their signatures may change 2014-04-21 11:28:49 +02:00
Russell Belfer
d543d59cf0 Add some funny options for debugging status
This allows you to use a --repeat option to run status over and
over and see how the output changes as you make local directory
changes without reopening the git_repository object each time.

Also, adds a flag to explicitly list the submodules before status.
2014-04-01 09:45:20 -07:00
Vicent Marti
a2d18a0219 Merge pull request #2228 from mekishizufu/example_short_id
Use git_object_short_id in examples
2014-04-01 13:47:52 +02:00
Vicent Marti
9325460a93 Merge pull request #2206 from libgit2/cmn/inmemory-swap-order
Rename in-memory remote to anonymous and swap url and fetch order
2014-04-01 13:47:44 +02:00
Carlos Martín Nieto
fd536d29c1 remote: rename inmemory to anonymous and swap url and fetch order
The order in this function is the opposite to what
create_with_fetchspec() has, so change this one, as url-then-refspec is
what git does.

As we need to break compilation and the swap doesn't do that, let's take
this opportunity to rename in-memory remotes to anonymous as that's
really what sets them apart.
2014-04-01 13:38:04 +02:00
Jiri Pospisil
6ad59ef1d4 examples: Use git_object_short_id 2014-04-01 12:16:40 +02:00
Russell Belfer
a15c7802c8 Make submodules externally refcounted
`git_submodule` objects were already refcounted internally in case
the submodule name was different from the path at which it was
stored.  This makes that refcounting externally used as well, so
`git_submodule_lookup` and `git_submodule_add_setup` return an
object that requires a `git_submodule_free` when done.
2014-03-25 09:14:48 -07:00
Vicent Marti
041cd4a23f Merge pull request #2028 from libgit2/options-names
Rename options structures
2014-03-07 19:02:58 +01:00
Russell Belfer
5a6de908f6 Merge pull request #2153 from mekishizufu/tag_example
Add a tag example
2014-03-07 09:13:43 -08:00
Ben Straub
6affd71f33 git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
Sun He
6246de93b6 Merge completed: resolve the conflict with the upstream 2014-03-06 11:16:36 +08:00
Jiri Pospisil
feebe6150f Move all variable declarations to the top of the block 2014-03-05 20:31:15 +01:00
Jiri Pospisil
a53b858417 Add tag example 2014-03-05 20:31:15 +01:00
Sun He
8384a50a21 fix the output format of diff 2014-03-05 20:33:20 +08:00
Sun He
45d2e8dc46 Add the --shortstat flag to examples/diff.c 2014-03-05 20:13:34 +08:00
Brian Gesiak
0d3c8a9d92 examples/diff: Add minimal, patience diff options.
- Add minimal, patience diff options to diff example. libgit2
  `diff_xdiff.git_xdiff_init` already supports these flags, so
  no additional change is necessary.
- Remove minimal and patience flag addition from project list.
2014-03-05 13:06:31 +09:00
Miha Ravšelj
b43f35fde2 - examples CMakeLists.txt reverted to previous state 2014-03-03 14:59:50 +01:00
Miha
6874cafd84 cmake examples change so that general.c is off by default 2014-03-03 12:08:17 +01:00
Miha
0330469f6d - general.c reverted to original( before pr state ) 2014-03-03 11:42:25 +01:00
Miha
b5212858f1 Merge remote-tracking branch 'remotes/upstream/development' into development 2014-03-03 11:40:22 +01:00
Russell Belfer
d88399922f Fix warnings and code style issues 2014-02-27 14:01:16 -08:00
Miha
300f44125a - BUGFIX #2133 (@fourplusone) in smart_protocol.c
- added MSVC cmake definitions to disable warnings
- general.c is rewritten so it is ansi-c compatible and compiles ok on microsoft windows
- some MSVC reported warning fixes
2014-02-25 11:56:11 +01:00