diff --git a/git_common.py b/git_common.py index f9b2a63f9..ca700eb6e 100644 --- a/git_common.py +++ b/git_common.py @@ -810,7 +810,7 @@ def status(): def squash_current_branch(header=None, merge_base=None): - header = header or 'git squash commit.' + header = header or 'git squash commit for %s.' % current_branch() merge_base = merge_base or get_or_create_merge_base(current_branch()) log_msg = header + '\n' if log_msg: diff --git a/git_squash_branch.py b/git_squash_branch.py index 33366d28b..f0534ca3c 100755 --- a/git_squash_branch.py +++ b/git_squash_branch.py @@ -11,7 +11,7 @@ import git_common def main(args): parser = argparse.ArgumentParser() parser.add_argument( - '-m', '--message', metavar='', default='git squash commit.', + '-m', '--message', metavar='', default=None, help='Use the given as the first line of the commit message.') opts = parser.parse_args(args) if git_common.is_dirty_git_tree('squash-branch'): diff --git a/man/src/git-squash-branch.txt b/man/src/git-squash-branch.txt index 0017d92ab..e9694be88 100644 --- a/man/src/git-squash-branch.txt +++ b/man/src/git-squash-branch.txt @@ -35,7 +35,7 @@ OPTIONS -m :: --message=:: Optional message to use for the first line of the squashed commit. If omitted, - it defaults to "git squash commit.". + it defaults to "git squash commit for .". EXAMPLE ------- diff --git a/tests/git_common_test.py b/tests/git_common_test.py index a8192ace7..d107f3c7d 100755 --- a/tests/git_common_test.py +++ b/tests/git_common_test.py @@ -681,6 +681,12 @@ class GitMutableStructuredTest(git_test_utils.GitRepoReadWriteTestBase, 'K' ) + def testSquashBranchDefaultMessage(self): + self.repo.git('checkout', 'branch_K') + self.assertEquals(True, self.repo.run(self.gc.squash_current_branch)) + self.assertEquals(self.repo.run(self.gc.run, 'log', '-n1', '--format=%s'), + 'git squash commit for branch_K.') + def testSquashBranchEmpty(self): self.repo.git('checkout', 'branch_K') self.repo.git('checkout', 'branch_G', '.')