Implementation file of Utils.
More...
#include "Utils.h"
#include "UI/ConflictsWindow.h"
#include "UI/CredentialsWindow.h"
#include <StorageKit.h>
#include <git2.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
|
BString | extract_current_directory (const BMessage *msg) |
| Get current directory. More...
|
|
void | extract_selected_paths (const BMessage *msg, vector< char *> &selected) |
| Get selected files. More...
|
|
BString | get_root_of_repo (BString dirPath) |
| Get the root of repo of current directory. More...
|
|
int | perform_fastforward (git_repository *repo, const git_oid *target_oid, int is_unborn) |
| This performs fastforward on given repo, branch id. More...
|
|
int | create_commit (git_repository *repo, git_index *index, const char *message) |
| Creates a commit on given repo, index and message. More...
|
|
void | output_conflicts (git_index *index) |
| Shows conflicts in current repo index in a window. More...
|
|
int | cred_acquire_cb (git_cred **out, const char *url, const char *username_from_url, unsigned int allowed_types, void *payload) |
| This functions gets username and password from the user in case credentials are required. More...
|
|
Implementation file of Utils.
This file contains common functions and enums used by app.
- Author
- Hrishikesh Hiraskar hrish.nosp@m.ihir.nosp@m.askar.nosp@m.@gma.nosp@m.il.co.nosp@m.m
Definition in file Utils.cpp.
◆ create_commit()
int create_commit |
( |
git_repository * |
repo, |
|
|
git_index * |
index, |
|
|
const char * |
message |
|
) |
| |
Creates a commit on given repo, index and message.
- Parameters
-
repo | The git repository. |
index | The git index. |
message | The commit message. |
- Returns
- 0 or error code.
Definition at line 186 of file Utils.cpp.
◆ cred_acquire_cb()
int cred_acquire_cb |
( |
git_cred ** |
out, |
|
|
const char * |
url, |
|
|
const char * |
username_from_url, |
|
|
unsigned int |
allowed_types, |
|
|
void * |
payload |
|
) |
| |
This functions gets username and password from the user in case credentials are required.
Definition at line 299 of file Utils.cpp.
◆ extract_current_directory()
BString extract_current_directory |
( |
const BMessage * |
msg | ) |
|
Get current directory.
- Parameters
-
msg | The BMessage containing ref to current directory. |
- Returns
- The current directory.
Definition at line 28 of file Utils.cpp.
◆ extract_selected_paths()
void extract_selected_paths |
( |
const BMessage * |
msg, |
|
|
vector< char *> & |
selected |
|
) |
| |
Get selected files.
- Parameters
-
msg | The BMessage containing refs to selected files. |
selected | The vector of selected file paths. |
Definition at line 50 of file Utils.cpp.
◆ get_root_of_repo()
BString get_root_of_repo |
( |
BString |
dirPath | ) |
|
Get the root of repo of current directory.
- Parameters
-
dirPath | The current directory. |
- Returns
- The repo root if found else current directory.
Definition at line 81 of file Utils.cpp.
◆ output_conflicts()
void output_conflicts |
( |
git_index * |
index | ) |
|
Shows conflicts in current repo index in a window.
- Parameters
-
index | The git index with conflicts. |
Definition at line 248 of file Utils.cpp.
◆ perform_fastforward()
int perform_fastforward |
( |
git_repository * |
repo, |
|
|
const git_oid * |
target_oid, |
|
|
int |
is_unborn |
|
) |
| |
This performs fastforward on given repo, branch id.
- Parameters
-
repo | The git repository. |
target_oid | The target branch id. |
is_unborn | True if HEAD isn't born yet. |
- Returns
- 0 or error code.
Definition at line 103 of file Utils.cpp.