Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjust git-meta status output to be closer to regular git output: #858

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions node/lib/util/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,11 @@ with '#' will be ignored, and an empty message aborts the commit.
`;

function branchStatusLine(status) {
// Simulate some of what base git's wt-status.c does
if (null !== status.currentBranchName) {
return `On branch ${status.currentBranchName}.\n`;
return `On branch ${status.currentBranchName}\n`;
}
return `On detached head ${GitUtil.shortSha(status.headCommit)}.\n`;
return `HEAD detached at ${GitUtil.shortSha(status.headCommit)}\n`;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions node/lib/util/print_status_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,15 @@ A ${command} is in progress.
* @return {String>
*/
exports.printCurrentBranch = function (status) {
// Simulate some of what base git's wt-status.c does
if (null !== status.currentBranchName) {
return `On branch ${colors.green(status.currentBranchName)}.\n`;
return `On branch ${colors.green(status.currentBranchName)}\n`;
}
if (status.headCommit === null) {
return `No commits yet\n`;
}
return `\
On detached head ${colors.red(GitUtil.shortSha(status.headCommit))}.\n`;
HEAD detached at ${colors.red(GitUtil.shortSha(status.headCommit))}\n`;
};

/**
Expand Down
24 changes: 12 additions & 12 deletions node/test/util/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ Untracked files:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On branch master.
# On branch master
# Changes to be committed:
# \tnew file: foo
#
Expand All @@ -346,7 +346,7 @@ Untracked files:

# Please enter the commit message for your changes. Lines starting
# with '#' will be ignored, and an empty message aborts the commit.
# On detached head afafaf.
# HEAD detached at afafaf
# Changes to be committed:
# \tnew file: foo
#
Expand Down Expand Up @@ -1725,7 +1725,7 @@ my message
#
# Date: 12/31/1969, 23:00:03 -100
#
# On branch a-branch.
# On branch a-branch
# Changes to be committed:
# \tnew file: bam/baz
#
Expand All @@ -1748,7 +1748,7 @@ my message
#
# Date: 12/31/1969, 23:00:03 -100
#
# On branch a-branch.
# On branch a-branch
# Changes to be committed:
# \tnew file: baz
#
Expand Down Expand Up @@ -2644,7 +2644,7 @@ x=S:C2-1 q/r/s=Sa:1;Bmaster=2;Oq/r/s H=a`,

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch master.
# On branch master
#
# Please enter the commit message(s) for your changes. The message for a
# repo will be composed of all lines not beginning with '#' that come before
Expand All @@ -2666,7 +2666,7 @@ hiya
only submodules
# Date: 12/31/1969, 23:00:03 -100
#
# On branch master.
# On branch master
#
# Please enter the commit message(s) for your changes. The message for a
# repo will be composed of all lines not beginning with '#' that come before
Expand All @@ -2688,7 +2688,7 @@ only submodules

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch foo.
# On branch foo
# Changes to be committed:
# \tnew file: baz
#
Expand Down Expand Up @@ -2717,7 +2717,7 @@ only submodules

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch foo.
# On branch foo
# Changes to be committed:
# \tmodified: bar (submodule, new commits)
#
Expand Down Expand Up @@ -2755,7 +2755,7 @@ only submodules

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch foo.
# On branch foo
#
# Please enter the commit message(s) for your changes. The message for a
# repo will be composed of all lines not beginning with '#' that come before
Expand Down Expand Up @@ -2791,7 +2791,7 @@ only submodules

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch foo.
# On branch foo
# -----------------------------------------------------------------------------

# <bar> enter message for 'bar' above this line; delete this line to skip \
Expand Down Expand Up @@ -2836,7 +2836,7 @@ committing 'bar'

# <*> enter meta-repo message above this line; delete this line to commit \
only submodules
# On branch foo.
# On branch foo
# -----------------------------------------------------------------------------
yoyoyo
# <bar> enter message for 'bar' above this line; delete this line to skip \
Expand Down Expand Up @@ -2888,7 +2888,7 @@ yoyoyo
only submodules
# Date: 12/31/1969, 23:00:03 -100
#
# On branch foo.
# On branch foo
# -----------------------------------------------------------------------------

# <bar> enter message for 'bar' above this line; delete this line to skip \
Expand Down
8 changes: 4 additions & 4 deletions node/test/util/print_status_util.js
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ A merge is in progress.
currentBranchName: "master",
}),
exact: `\
On branch ${colors.green("master")}.
On branch ${colors.green("master")}
nothing to commit, working tree clean
`,
shortExact: "\n",
Expand All @@ -741,7 +741,7 @@ nothing to commit, working tree clean
}),
}),
exact: `\
On branch ${colors.green("master")}.
On branch ${colors.green("master")}
A rebase is in progress.
(after resolving conflicts mark the corrected paths
with 'git meta add', then run "git meta rebase --continue")
Expand Down Expand Up @@ -827,7 +827,7 @@ ${colors.green("M")}${colors.red("M")} qrst/x/y/z
workdir: { foo: FILESTATUS.ADDED },
}),
exact: `\
On branch ${colors.green("master")}.
On branch ${colors.green("master")}
Untracked files:
(use "git meta add <file>..." to include in what will be committed)

Expand All @@ -848,7 +848,7 @@ Untracked files:
},
}),
exact: `\
On branch ${colors.green("master")}.
On branch ${colors.green("master")}
Changes to be committed:
(use "git meta reset HEAD <file>..." to unstage)

Expand Down