TrackGit
Functions
Utils.cpp File Reference

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.

Functions

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...
 

Detailed Description

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.

Function Documentation

◆ create_commit()

int create_commit ( git_repository *  repo,
git_index *  index,
const char *  message 
)

Creates a commit on given repo, index and message.

Parameters
repoThe git repository.
indexThe git index.
messageThe 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
msgThe 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
msgThe BMessage containing refs to selected files.
selectedThe 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
dirPathThe 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
indexThe 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
repoThe git repository.
target_oidThe target branch id.
is_unbornTrue if HEAD isn't born yet.
Returns
0 or error code.

Definition at line 103 of file Utils.cpp.