Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
CMakeSettings.json
.vs
.idea

#GitUp
xcode
binaries
18 changes: 9 additions & 9 deletions deps/xdiff/xpatience.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
*/
struct hashmap {
int nr, alloc;
struct entry {
struct xpatience_hashmap_entry {
unsigned long hash;
/*
* 0 = unused entry, 1 = first line, 2 = second, etc.
Expand All @@ -59,7 +59,7 @@ struct hashmap {
* sequence;
* initially, "next" reflects only the order in file1.
*/
struct entry *next, *previous;
struct xpatience_hashmap_entry *next, *previous;

/*
* If 1, this entry can serve as an anchor. See
Expand Down Expand Up @@ -165,8 +165,8 @@ static int fill_hashmap(xpparam_t const *xpp, xdfenv_t *env,
* Find the longest sequence with a smaller last element (meaning a smaller
* line2, as we construct the sequence with entries ordered by line1).
*/
static int binary_search(struct entry **sequence, int longest,
struct entry *entry)
static int binary_search(struct xpatience_hashmap_entry **sequence, int longest,
struct xpatience_hashmap_entry *entry)
{
int left = -1, right = longest;

Expand All @@ -191,11 +191,11 @@ static int binary_search(struct entry **sequence, int longest,
* item per sequence length: the sequence with the smallest last
* element (in terms of line2).
*/
static int find_longest_common_sequence(struct hashmap *map, struct entry **res)
static int find_longest_common_sequence(struct hashmap *map, struct xpatience_hashmap_entry **res)
{
struct entry **sequence;
struct xpatience_hashmap_entry **sequence;
int longest = 0, i;
struct entry *entry;
struct xpatience_hashmap_entry *entry;

/*
* If not -1, this entry in sequence must never be overridden.
Expand Down Expand Up @@ -253,7 +253,7 @@ static int match(struct hashmap *map, int line1, int line2)
static int patience_diff(xpparam_t const *xpp, xdfenv_t *env,
int line1, int count1, int line2, int count2);

static int walk_common_sequence(struct hashmap *map, struct entry *first,
static int walk_common_sequence(struct hashmap *map, struct xpatience_hashmap_entry *first,
int line1, int count1, int line2, int count2)
{
int end1 = line1 + count1, end2 = line2 + count2;
Expand Down Expand Up @@ -324,7 +324,7 @@ static int patience_diff(xpparam_t const *xpp, xdfenv_t *env,
int line1, int count1, int line2, int count2)
{
struct hashmap map;
struct entry *first;
struct xpatience_hashmap_entry *first;
int result = 0;

/* trivial case: one side is empty */
Expand Down
5 changes: 5 additions & 0 deletions include/git2/diff.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ typedef struct {
* abbreviated to something reasonable, like 7 characters.
*/
uint16_t id_abbrev;

/// Use later GIT_EXTERN(const git_index_entry *) git_index_get_bypath(git_index *index, const char *path, int stage);
/// PATCH
git_time_t ctime;
git_time_t mtime;
} git_diff_file;

/**
Expand Down
24 changes: 24 additions & 0 deletions include/git2/gitup_branch.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "common.h"
#include "oid.h"
#include "types.h"
#include "branch.h"

/**
* @file git2/branch.h
* @brief Git branch parsing routines
* @defgroup git_branch Git branch management
* @ingroup Git
* @{
*/

GIT_BEGIN_DECL
// PATCH
// These functions are aliases and can be safely removed.
// Use `git_#{func}` instead.
// Replace and remove this file later.
GIT_EXTERN(int) gitup_branch_upstream_name(git_buf *out, git_repository *repo, const char *refname);
GIT_EXTERN(int) gitup_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname);
GIT_EXTERN(int) gitup_branch_upstream_merge(git_buf *buf, git_repository *repo, const char *refname);

/** @} */
GIT_END_DECL
24 changes: 24 additions & 0 deletions include/git2/gitup_clone.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "clone.h"
#include "common.h"
#include "types.h"
#include "indexer.h"
#include "checkout.h"
#include "remote.h"
#include "transport.h"

/**
* @file git2/clone.h
* @brief Git cloning routines
* @defgroup git_clone Git cloning routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL

GIT_EXTERN(int) gitup_clone_into(git_repository *repo,
git_remote *remote,
const git_fetch_options *fetch_opts,
const git_checkout_options *checkout_opts,
const char *branch);

GIT_END_DECL
19 changes: 19 additions & 0 deletions include/git2/gitup_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "config.h"

GIT_BEGIN_DECL

/**
* Locate the path to the local configuration file
*
* The returned path may be used on any `git_config` call to load the local
* configuration file.
*
* @param repo The repository whose local configuration file to find
* @param out Pointer to a user-allocated git_buf in which to store the path
* @return 0 if a local configuration file has been found. Its path will be stored in `out`.
*/
/// This function uses repository method item path.
/// Maybe it is better to use `repository` method `gitup_repository_find_local_config`
GIT_EXTERN(int) gitup_config_find_local(git_repository *repo, git_buf *out);

GIT_END_DECL
35 changes: 35 additions & 0 deletions include/git2/gitup_refs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "refs.h"

GIT_BEGIN_DECL

/**
* Create a virtual direct reference.
*
* This is wrapper for
* git_reference_create(git_reference **out, git_repository *repo, const char *name, const git_oid *id, int force, const char *log_message);
*
* @param out Pointer to the newly created reference
* @param repo Repository where that reference virtually lives
* @param name The name of the reference
* @param id The object id pointed to by the reference
* @return 0 on success or an error code
*/
GIT_EXTERN(int) gitup_reference_create_virtual(git_reference **out, git_repository *repo, const char *name, const git_oid *id);

/**
* Create a virtual symbolic reference.
*
* Discussion
*
* This is a wrapper for
* git_reference_symbolic_create(git_reference **out, git_repository *repo, const char *name, const char *target, int force, const char *log_message);
*
* @param out Pointer to the newly created reference
* @param repo Repository where that reference virtually lives
* @param name The name of the reference
* @param target The target of the reference
* @return 0 on success or an error code
*/
GIT_EXTERN(int) gitup_reference_symbolic_create_virtual(git_reference **out, git_repository *repo, const char *name, const char *target);

GIT_END_DECL
35 changes: 35 additions & 0 deletions include/git2/gitup_repository.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "repository.h"
#include "common.h"
#include "types.h"
#include "oid.h"
#include "buffer.h"

/**
* @file git2/gitup_repository.h
* @brief Git repository management routines
* @defgroup git_repository Git repository management routines
* @ingroup Git
* @{
*/
GIT_BEGIN_DECL

/**
* Update or rewrite the gitlink in the workdir
*/
GIT_EXTERN(int) gitup_repository_update_gitlink(
git_repository *repo, int use_relative_path);

/**
* Locate the path to the local configuration file
*
* The returned path may be used on any `git_config` call to load the local
* configuration file.
*
* @param repo The repository whose local configuration file to find
* @param out Pointer to a user-allocated git_buf in which to store the path
* @return 0 if a local configuration file has been found. Its path will be stored in `out`.
*/
GIT_EXTERN(int) gitup_repository_local_config_path(git_buf *out, git_repository *repo);

/** @} */
GIT_END_DECL
12 changes: 12 additions & 0 deletions include/git2/gitup_submodule.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "submodule.h"

GIT_BEGIN_DECL

/**
* Retains a submodule
*
* @param submodule Submodule object
*/
GIT_EXTERN(void) gitup_submodule_dup(git_submodule *submodule);

GIT_END_DECL
2 changes: 2 additions & 0 deletions include/git2/remote.h
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ typedef struct {
*
* @param updates an array containing the updates which will be sent
* as commands to the destination.
* @param the remote being pushed /// PATCH
* @param len number of elements in `updates`
* @param payload Payload provided by the caller
* @return 0 or an error code to stop the push
*/
typedef int GIT_CALLBACK(git_push_negotiation)(
git_remote *remote,
const git_push_update **updates,
size_t len,
void *payload);
Expand Down
2 changes: 1 addition & 1 deletion include/git2/stdint.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ typedef uint64_t uintmax_t;
#endif /* __STDC_LIMIT_MACROS ] */


/* 7.18.4 Limits of other integer types
/* 7.18.4 Limits of other integer types */

#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) /* [ See footnote 224 at page 260 */

Expand Down
50 changes: 50 additions & 0 deletions include/git2/sys/features.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#ifndef INCLUDE_features_h__
#define INCLUDE_features_h__

/* #undef GIT_DEBUG_POOL */
/* #undef GIT_DEBUG_STRICT_ALLOC */
/* #undef GIT_DEBUG_STRICT_OPEN */

#define GIT_TRACE 1
#define GIT_THREADS 1
/* #undef GIT_WIN32_LEAKCHECK */

#define GIT_ARCH_64 1
/* #undef GIT_ARCH_32 */

#define GIT_USE_ICONV 1
#define GIT_USE_NSEC 1
/* #undef GIT_USE_STAT_MTIM */
#define GIT_USE_STAT_MTIMESPEC 1
/* #undef GIT_USE_STAT_MTIME_NSEC */
#define GIT_USE_FUTIMENS 1

#define GIT_REGEX_REGCOMP_L
/* #undef GIT_REGEX_REGCOMP */
/* #undef GIT_REGEX_PCRE */
/* #undef GIT_REGEX_PCRE2 */
/* #undef GIT_REGEX_BUILTIN */

/* #undef GIT_SSH */
/* #undef GIT_SSH_MEMORY_CREDENTIALS */

#define GIT_NTLM 1
/* #undef GIT_GSSAPI */
/* #undef GIT_GSSFRAMEWORK */

/* #undef GIT_WINHTTP */
#define GIT_HTTPS 1
/* #undef GIT_OPENSSL */
/* #undef GIT_OPENSSL_DYNAMIC */
#define GIT_SECURE_TRANSPORT 1
/* #undef GIT_MBEDTLS */

#define GIT_SHA1_COLLISIONDETECT 1
/* #undef GIT_SHA1_WIN32 */
/* #undef GIT_SHA1_COMMON_CRYPTO */
/* #undef GIT_SHA1_OPENSSL */
/* #undef GIT_SHA1_MBEDTLS */

#endif
#define GIT_SSH_MEMORY_CREDENTIALS 1
#define GIT_SSH 1
8 changes: 8 additions & 0 deletions include/gitup_extensions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

#include "git2.h"
#include "git2/gitup_submodule.h"
#include "git2/gitup_refs.h"
#include "git2/gitup_config.h"
#include "git2/gitup_branch.h"
#include "git2/gitup_clone.h"
#include "git2/gitup_repository.h"
24 changes: 24 additions & 0 deletions src/gitup_branch.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#include "branch.h"

#include "commit.h"
#include "config.h"
#include "refs.h"
#include "remote.h"

#include "git2/branch.h"
#include "git2/gitup_branch.h"

int gitup_branch_upstream_name(git_buf *out, git_repository *repo, const char *refname)
{
return git_branch_upstream_name(out, repo, refname);
}

int gitup_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *refname)
{
return git_branch_upstream_remote(buf, repo, refname);
}

int gitup_branch_upstream_merge(git_buf *buf, git_repository *repo, const char *refname)
{
return git_branch_upstream_merge(buf, repo, refname);
}
7 changes: 7 additions & 0 deletions src/gitup_config.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "git2/gitup_config.h"
#include "git2/repository.h"

int gitup_config_find_local(git_repository *repo, git_buf *path)
{
return git_repository_item_path(path, repo, GIT_REPOSITORY_ITEM_CONFIG);
}
Loading