Merge pull request #825 from gitbutlerapp/docs-in-integration-branch

add docs link to integration branch
This commit is contained in:
Scott Chacon 2023-07-24 08:51:33 +02:00 committed by GitHub
commit 38cf33d7c6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 15 deletions

View File

@ -405,6 +405,7 @@ pub fn unapply_branch(
// checkout final_tree into the working directory // checkout final_tree into the working directory
let mut checkout_options = git2::build::CheckoutBuilder::new(); let mut checkout_options = git2::build::CheckoutBuilder::new();
checkout_options.force(); checkout_options.force();
checkout_options.remove_untracked(true);
repo.checkout_tree(&final_tree, Some(&mut checkout_options))?; repo.checkout_tree(&final_tree, Some(&mut checkout_options))?;
update_gitbutler_integration(gb_repository, project_repository)?; update_gitbutler_integration(gb_repository, project_repository)?;
@ -1861,20 +1862,18 @@ pub fn update_gitbutler_integration(
} }
} }
let (author, committer) = gb_repository.git_signatures()?;
// message that says how to get back to where they were // message that says how to get back to where they were
let mut message = "GitButler Integration Commit".to_string(); let mut message = "GitButler Integration Commit".to_string();
message.push_str("\n\n"); message.push_str("\n\n");
message.push_str( message.push_str(
"This is an integration commit for the virtual branches that GitButler is tracking.\n", "This is an integration commit for the virtual branches that GitButler is tracking.\n\n",
); );
message.push_str( message.push_str(
"Due to GitButler managing multiple virtual branches, you cannot switch back and\n", "Due to GitButler managing multiple virtual branches, you cannot switch back and\n",
); );
message.push_str( message.push_str("forth between git branches and virtual branches easily. \n\n");
"forth easily. If you switch to another branch, GitButler will need to be reinitialized.\n",
); message.push_str("If you switch to another branch, GitButler will need to be reinitialized.\n");
message.push_str("If you commit on this branch, GitButler will throw it away.\n\n"); message.push_str("If you commit on this branch, GitButler will throw it away.\n\n");
message.push_str("Here are the branches that are currently applied:\n"); message.push_str("Here are the branches that are currently applied:\n");
for branch in &applied_virtual_branches { for branch in &applied_virtual_branches {
@ -1893,21 +1892,31 @@ pub fn update_gitbutler_integration(
message.push('\n'); message.push('\n');
} }
} }
message.push_str("\nTo get back to where you were, run:\n\n"); message.push_str("\nYour previous branch was: ");
message.push_str("git checkout ");
message.push_str(&prev_head); message.push_str(&prev_head);
message.push_str("\n\n"); message.push_str("\n\n");
message.push_str("The sha for that commit was: "); message.push_str("The sha for that commit was: ");
message.push_str(&prev_sha); message.push_str(&prev_sha);
message.push_str("\n\n");
message.push_str("For more information about what we're doing here, check out our docs:\n");
message.push_str("https://docs.gitbutler.com/features/virtual-branches/integration-branch\n");
let committer = git2::Signature::now("GitButler", "gitbutler@gitbutler.com")?;
repo.commit( repo.commit(
Some("HEAD"), Some("HEAD"),
&author, &committer,
&committer, &committer,
&message, &message,
&final_tree, &final_tree,
&[&target_commit], &[&target_commit],
)?; )?;
// write final_tree as the current index
let mut index = repo.index()?;
index.read_tree(&final_tree)?;
index.write()?;
Ok(()) Ok(())
} }

View File

@ -17,7 +17,7 @@
/> />
</svg> --> </svg> -->
<!-- class="animate-spin fill-blue-600 text-light-600" --> <!-- class="animate-spin fill-blue-600 text-light-600" -->
<svg <svg
class={className} class={className}
width="20" width="20"

View File

@ -405,13 +405,13 @@
transition:slide={{ duration: 150 }} transition:slide={{ duration: 150 }}
> >
<div <div
class="dark:form-dark-600 absolute top-4 ml-[1.0625rem] w-px bg-gradient-to-b from-light-400 via-light-500 via-90% dark:from-dark-600 dark:via-dark-600" class="dark:form-dark-600 via-90% absolute top-4 ml-[1.0625rem] w-px bg-gradient-to-b from-light-400 via-light-500 dark:from-dark-600 dark:via-dark-600"
style={remoteCommits.length == 0 ? 'height: calc(100% - 1rem);' : 'height: 100%;'} style={remoteCommits.length == 0 ? 'height: calc(100% - 1rem);' : 'height: 100%;'}
/> />
<div class="relative flex flex-col gap-2"> <div class="relative flex flex-col gap-2">
<div <div
class="dark:form-dark-600 absolute top-4 ml-[1.0625rem] h-px w-6 bg-gradient-to-r from-light-400 via-light-400 via-10% dark:from-dark-600 dark:via-dark-600" class="dark:form-dark-600 via-10% absolute top-4 ml-[1.0625rem] h-px w-6 bg-gradient-to-r from-light-400 via-light-400 dark:from-dark-600 dark:via-dark-600"
/> />
<div class="ml-10 mr-2 flex items-center py-2"> <div class="ml-10 mr-2 flex items-center py-2">
<div <div
@ -452,14 +452,14 @@
{#if remoteCommits.length > 0} {#if remoteCommits.length > 0}
<div class="relative flex-grow"> <div class="relative flex-grow">
<div <div
class="dark:form-dark-600 absolute top-4 ml-[1.0625rem] class="dark:form-dark-600 via-90% absolute top-4
w-px bg-gradient-to-b from-light-600 via-light-600 via-90% dark:from-dark-400 dark:via-dark-400" ml-[1.0625rem] w-px bg-gradient-to-b from-light-600 via-light-600 dark:from-dark-400 dark:via-dark-400"
style="height: calc(100% - 1rem);" style="height: calc(100% - 1rem);"
/> />
<div class="relative flex flex-col gap-2"> <div class="relative flex flex-col gap-2">
<div <div
class="dark:form-dark-600 absolute top-4 ml-[1.0625rem] h-px w-6 bg-gradient-to-r from-light-600 via-light-600 via-10% dark:from-dark-400 dark:via-dark-400" class="dark:form-dark-600 via-10% absolute top-4 ml-[1.0625rem] h-px w-6 bg-gradient-to-r from-light-600 via-light-600 dark:from-dark-400 dark:via-dark-400"
/> />
<div class="ml-12 flex items-center py-2 font-mono text-sm"> <div class="ml-12 flex items-center py-2 font-mono text-sm">