Twenga / twgit

Twgit is a free and open source assisting tools for managing features, hotfixes and releases on Git repositories. It provides simple, high-level commands to adopt the branching model describes in our documentation. Supported OS: Debian/Ubuntu Linux, Mac OS X 10.8 (Mountain Lion) or lower.
http://twgit.twenga.com/
Other
111 stars 34 forks source link

problem with colored git #102

Closed yo-ni closed 11 years ago

yo-ni commented 11 years ago

Hi when using the twgit release start command with my colored git, I get an error in getting the current release name. Because of the color tag (ex: [31m), the get_current_release_in_progress function does not cut the 'origin/' prefix, which causes a bug. To fix that I had to modify the get_releases_in_progress function that way: git branch --color=never -r --no-merged $TWGIT_ORIGIN/$TWGIT_STABLE | grep "$TWGIT_ORIGIN/$TWGIT_PREFIX_RELEASE" | sed 's/^[* ]*//'

adding a --color=never option. Maybe there is some other places where we need to add this option.

Thx

geoffroy-aubry commented 11 years ago

Hello, Thanks for reporting the bug :-) Adding a --color=never option here and in some other places is a good idea.

I try in vain to reproduce the bug to add a unit test. Could you please help me to reproduce it ? (what is your git config)

1) init:

mkdir /tmp/remote_repo
cd /tmp/remote_repo
git init
git commit --allow-empty -m 'init'

mkdir /tmp/local_repo
cd /tmp/local_repo
git init
git remote add origin /tmp/remote_repo
twgit init 1.2.3

2) test:

cd /tmp/local_repo
twgit release start
twgit feature start 1
twgit release start

3) my config:

git config --list
user.name=Geoffroy Aubry
user.email=gaubry@hi-media.com
color.ui=true
color.status=always
color.diff=always
diff.tool=mymeld
diff.mnemonicprefix=true
difftool.mymeld.cmd=meld $LOCAL $REMOTE > /dev/null 2>&1
difftool.prompt=false
merge.tool=mymeld
mergetool.trustexitcode=false
mergetool.prompt=false
mergetool.mymeld.cmd=meld $LOCAL $MERGED $REMOTE > /dev/null 2>&1
core.pager=cat
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.url=../gita
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.stable.remote=origin
branch.stable.merge=refs/heads/stable
branch.release-1.3.0.remote=origin
branch.release-1.3.0.merge=refs/heads/release-1.3.0
yo-ni commented 11 years ago

my config:

git config --list user.name=ysoleiman user.email=* color.ui=always color.branch=auto core.repositoryformatversion=0 core.filemode=true core.bare=false core.logallrefupdates=true remote.origin.fetch=+refs/heads/:refs/remotes/origin/ remote.origin.url= branch.master.remote=origin branch.master.merge=refs/heads/master branch.release-2.38.0.remote=origin branch.release-2.38.0.merge=refs/heads/release-2.38.0

But I removed the no color fix to try if with color.ui=true (instead of always) would work. I did not manage to reproduce the bug ..

geoffroy-aubry commented 11 years ago

Ok, I reproduce the bug if I set these options:

git config color.branch always
git config color.diff always
git config color.interactive always
git config color.status always
git config color.ui always
yo-ni commented 11 years ago

great !

geoffroy-aubry commented 11 years ago

DONE

yo-ni commented 11 years ago

thx !