TrackGit
Macros | Enumerations | Functions
Utils.h File Reference

Header file of Utils. More...

#include "UI/ConflictsWindow.h"
#include <AppKit.h>
#include <SupportKit.h>
#include <vector.h>
#include <git2.h>

Go to the source code of this file.

Macros

#define ADDON_NAME   "TrackGit"
 The addon name. More...
 
#define APP_SIGN   "application/x-vnd.Haiku-TrackGit"
 The Application signature. More...
 

Enumerations

enum  {
  kQuitWindow, kClone, kInitHere, kStatus,
  kAdd, kAddAll, kCommit, kPull,
  kPush, kShowConflicts, kCreateBranch, kSwitchBranch,
  kLog
}
 

Functions

void extract_selected_paths (const BMessage *msg, vector< char *> &selected)
 Get selected files. More...
 
BString extract_current_directory (const BMessage *msg)
 Get current directory. More...
 
BString get_root_of_repo (BString dirPath)
 Get the root of repo of current directory. More...
 
int perform_fastforward (git_repository *, const git_oid *, int)
 This performs fastforward on given repo, branch id. More...
 
int create_commit (git_repository *, git_index *, const char *)
 Creates a commit on given repo, index and message. More...
 
void output_conflicts (git_index *)
 Shows conflicts in current repo index in a window. More...
 
int cred_acquire_cb (git_cred **, const char *, const char *, unsigned int, void *)
 This functions gets username and password from the user in case credentials are required. More...
 

Detailed Description

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

Macro Definition Documentation

◆ ADDON_NAME

#define ADDON_NAME   "TrackGit"

The addon name.

Will be used in menu item.

Definition at line 40 of file Utils.h.

◆ APP_SIGN

#define APP_SIGN   "application/x-vnd.Haiku-TrackGit"

The Application signature.

Definition at line 45 of file Utils.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
kQuitWindow 
kClone 
kInitHere 
kStatus 
kAdd 
kAddAll 
kCommit 
kPull 
kPush 
kShowConflicts 
kCreateBranch 
kSwitchBranch 
kLog 

Definition at line 20 of file Utils.h.

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 **  ,
const char *  ,
const char *  ,
unsigned  int,
void *   
)

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.