9 #include "../UI/CloneWindow.h" 76 BString progressString;
81 progressString <<
"Resolving deltas " 85 progressString <<
"Network " << network_percent
86 <<
" (" << kbytes <<
" kb, " 89 progressString <<
"Indexed " << index_percent <<
" (" 109 printf(
"remote: %.*s\n", len, str);
143 progress->
path = path;
160 printf(
"Cloning %s into %s\n",
url,
path);
162 cloneText <<
"Cloning " <<
url <<
" into " <<
path;
168 git_repository *cloned_repo = NULL;
169 git_clone_options clone_opts = GIT_CLONE_OPTIONS_INIT;
170 git_checkout_options checkout_opts = GIT_CHECKOUT_OPTIONS_INIT;
176 checkout_opts.checkout_strategy = GIT_CHECKOUT_SAFE;
178 checkout_opts.progress_payload = &progress;
179 clone_opts.checkout_opts = checkout_opts;
181 clone_opts.fetch_opts.callbacks.transfer_progress = &
fetch_progress;
182 clone_opts.fetch_opts.callbacks.payload = &progress;
185 int ret = git_clone(&cloned_repo,
url,
path, &clone_opts);
188 const git_error* err = giterr_last();
189 printf(
"Error %d : %s\n", err->klass, err->message);
191 BString buffer(
"Error : %s");
192 buffer.ReplaceFirst(
"%s", err->message);
193 BAlert *alert =
new BAlert(
"", buffer.String(),
"Cancel",
194 0, 0, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
198 git_repository_free(cloned_repo);
199 git_libgit2_shutdown();
Clone(BString, BString)
Clone class Constructor.
static void checkout_progress(const char *path, size_t cur, size_t tot, void *payload)
Prints checkout progress.
Header file of Clone command.
virtual void Quit()
The function to Quit the window.
git_transfer_progress fetch_progress
The progress data payload.
void SetProgress(float)
Sets the progress value of the progress bar in progress window.
static void print_progress(const progress_data *progress)
Prints progress of command to the progress window.
void SetProgressText(BString)
Prints progress text to textview of window.
CloneWindow * cloneWindow
TrackGitWindow * fCloneWindow
The window to show progress.
TrackGitWindow * GetWindow()
This returns pointer to the clone window.
static int sideband_progress(const char *str, int len, void *payload)
Prints the progress from remote.
static int fetch_progress(const git_transfer_progress *stats, void *payload)
Creates data structures for printing progress.
BString fDirPath
The current directory where Clone option is selected.
Parameters to pass to clone thread.
virtual void Execute()
Clone command execution.
pthread_t DoClone(CloneWindow *, const char *, const char *)
Spawns a thread to clone.
The TrackGit Window class.
CloneWindow * cloneWindow
void * DoCloneThread(void *arg)
Clones the given url into given path along with showing progress in given progress window...
BString fRepo
The repo/directory where the command is called.