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

Menu: Disable "Branch" menu in empty repositories #475

Merged
merged 1 commit into from Jul 16, 2015

Conversation

Projects
None yet
2 participants
@mmargoliono
Contributor

mmargoliono commented Jul 15, 2015

When current working repository is empty (eg: just initialised or cloned
an empty repository), it doesn't make sense to rename or delete local
branch.

For checking whether repository is empty or not, local branches is used.
Alternative considered was:

  1. Git log/rev-list and check exit code (Fail when there is remote
    branches, bot not local branches)
  2. Git count-objects (probably has similar issue with above)

Issue: #459
Reported-By: Vdragon
Signed-off-by: Minarto Margoliono lie.r.min.g@gmail.com

Menu: Disable "Branch" menu in empty repositories
When current working repository is empty (eg: just initialised or cloned
an empty repository), it doesn't make sense to rename or delete local
branch.

For checking whether repository is empty or not, local branches is used.
Alternative considered was:
1. Git log/rev-list and check exit code (Fail when there is remote
branches, bot not local branches)
2. Git count-objects (probably has similar issue with above)

Issue: #459
Reported-By: Vdragon
Signed-off-by: Minarto Margoliono <lie.r.min.g@gmail.com>
@@ -216,6 +216,9 @@ def is_empty(self):
return not(bool(self.staged or self.modified or
self.unmerged or self.untracked))
def is_empty_repository(self):
return not self.local_branches

This comment has been minimized.

@davvid

davvid Jul 16, 2015

Member

Beautiful!

@davvid

davvid Jul 16, 2015

Member

Beautiful!

davvid added a commit that referenced this pull request Jul 16, 2015

Merge pull request #475 from mmargoliono/b-459
menu: disable "Branch" menu in empty repositories

Signed-off-by: David Aguilar <davvid@gmail.com>

@davvid davvid merged commit 846605f into git-cola:master Jul 16, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@mmargoliono mmargoliono deleted the mmargoliono:b-459 branch Jul 18, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment