From bf426b0f7d0c868f9ad97778412cd29228542859 Mon Sep 17 00:00:00 2001 From: James Moger Date: Thu, 6 Mar 2014 15:53:20 -0500 Subject: Documentation and clarify git workflows --- src/main/java/com/gitblit/tickets/commands.md | 8 ++++---- src/main/java/com/gitblit/wicket/pages/TicketPage.java | 14 +++++--------- src/main/java/com/gitblit/wicket/pages/propose_git.md | 2 +- 3 files changed, 10 insertions(+), 14 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/com/gitblit/tickets/commands.md b/src/main/java/com/gitblit/tickets/commands.md index 25c24f4f..44098d28 100644 --- a/src/main/java/com/gitblit/tickets/commands.md +++ b/src/main/java/com/gitblit/tickets/commands.md @@ -1,11 +1,11 @@ #### To review with Git -on a detached HEAD... +To review an updated patchset - git fetch ${repositoryUrl} ${ticketRef} && git checkout FETCH_HEAD + git fetch && git checkout ${reviewBranch} && git pull --ff-only -on a new branch... +To review a rewritten patchset - git fetch ${repositoryUrl} ${ticketRef} && git checkout -B ${reviewBranch} FETCH_HEAD + git fetch && git checkout ${reviewBranch} && git reset --hard origin/${reviewBranch} diff --git a/src/main/java/com/gitblit/wicket/pages/TicketPage.java b/src/main/java/com/gitblit/wicket/pages/TicketPage.java index 5e0e6820..115fba76 100644 --- a/src/main/java/com/gitblit/wicket/pages/TicketPage.java +++ b/src/main/java/com/gitblit/wicket/pages/TicketPage.java @@ -1254,16 +1254,13 @@ public class TicketPage extends TicketBasePage { } protected void addGitReviewInstructions(UserModel user, RepositoryModel repository, MarkupContainer panel) { - String repoUrl = getRepositoryUrl(user, repository); - panel.add(new Label("gitStep1", MessageFormat.format(getString("gb.stepN"), 1))); panel.add(new Label("gitStep2", MessageFormat.format(getString("gb.stepN"), 2))); String ticketBranch = Repository.shortenRefName(PatchsetCommand.getTicketBranch(ticket.number)); - String reviewBranch = PatchsetCommand.getReviewBranch(ticket.number); - String step1 = MessageFormat.format("git fetch {0} {1}", repoUrl, ticketBranch); - String step2 = MessageFormat.format("git checkout -B {0} FETCH_HEAD", reviewBranch); + String step1 = "git fetch"; + String step2 = MessageFormat.format("git checkout {0} && git pull -ff-only\nOR\ngit checkout {0} && git reset --hard origin/{0}", ticketBranch); panel.add(new Label("gitPreStep1", step1)); panel.add(new Label("gitPreStep2", step2)); @@ -1417,7 +1414,6 @@ public class TicketPage extends TicketBasePage { protected Component getMergeInstructions(UserModel user, RepositoryModel repository, String markupId, String infoKey) { Fragment cmd = new Fragment(markupId, "commandlineMergeFragment", this); cmd.add(new Label("instructions", MessageFormat.format(getString(infoKey), ticket.mergeTo))); - String repoUrl = getRepositoryUrl(user, repository); // git instructions cmd.add(new Label("mergeStep1", MessageFormat.format(getString("gb.stepN"), 1))); @@ -1427,9 +1423,9 @@ public class TicketPage extends TicketBasePage { String ticketBranch = Repository.shortenRefName(PatchsetCommand.getTicketBranch(ticket.number)); String reviewBranch = PatchsetCommand.getReviewBranch(ticket.number); - String step1 = MessageFormat.format("git checkout -B {0} {1}", reviewBranch, ticket.mergeTo); - String step2 = MessageFormat.format("git pull {0} {1}", repoUrl, ticketBranch); - String step3 = MessageFormat.format("git checkout {0}\ngit merge {1}\ngit push origin {0}", ticket.mergeTo, reviewBranch); + String step1 = MessageFormat.format("git checkout -b {0} {1}", reviewBranch, ticket.mergeTo); + String step2 = MessageFormat.format("git pull origin {0}", ticketBranch); + String step3 = MessageFormat.format("git checkout {0}\ngit merge {1}\ngit push origin {0}\ngit branch -d {1}", ticket.mergeTo, reviewBranch); cmd.add(new Label("mergePreStep1", step1)); cmd.add(new Label("mergePreStep2", step2)); diff --git a/src/main/java/com/gitblit/wicket/pages/propose_git.md b/src/main/java/com/gitblit/wicket/pages/propose_git.md index 4589bf89..9d956bba 100644 --- a/src/main/java/com/gitblit/wicket/pages/propose_git.md +++ b/src/main/java/com/gitblit/wicket/pages/propose_git.md @@ -2,5 +2,5 @@ cd ${repo} git checkout -b ${reviewBranch} ${integrationBranch} ... - git push --up-stream origin ${reviewBranch} + git push --set-upstream origin ${reviewBranch} -- cgit v1.2.3