-
-
Notifications
You must be signed in to change notification settings - Fork 149
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
Help @dg as per the deal to convert tabs to spaces. #29
Conversation
@dg I was looking at your conversation https://twitter.com/geekovo/status/507984028348461057 . If you don't like spaces, I have no problem. I send you the PR for you asked. And I believe it was not a joke. |
@harikt: Even though I disagree with @dg and consider his behavior as purely childish, this is not any better... But yes, forcing spaces is bullshit and a main reason for me to ignore / not use PSR-2. |
Why spaces? Files are bigger, peoples can't set own indention width... 1940s: Various "computers" are "programmed" using direct wiring and switches. Engineers do this in order to avoid the tabs vs spaces debate. |
@dg you are welcome.
I am done with making to spaces. Not sure I understand you.
That is not done with /var/www/github.com/harikt/utils ± deal git remote add challenge-accepted https://github.com/icaine/utils
/var/www/github.com/harikt/utils ± deal git fetch challenge-accepted
remote: Counting objects: 36, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 36 (delta 20), reused 24 (delta 12)
Unpacking objects: 100% (36/36), done.
From https://github.com/icaine/utils
* [new branch] master -> challenge-accepted/master
* [new branch] strings-cut -> challenge-accepted/strings-cut
* [new branch] v2.2 -> challenge-accepted/v2.2
✘ /var/www/github.com/harikt/utils ± deal git checkout strings-cut
Branch strings-cut set up to track remote branch strings-cut from challenge-accepted.
Switched to a new branch 'strings-cut'
/var/www/github.com/harikt/utils ± strings-cut git merge deal
Auto-merging src/Utils/Strings.php
CONFLICT (content): Merge conflict in src/Utils/Strings.php
Automatic merge failed; fix conflicts and then commit the result.
✘ /var/www/github.com/harikt/utils ± strings-cut●✚ git mergetool
Merging:
src/Utils/Strings.php
Normal merge conflict for 'src/Utils/Strings.php':
{local}: modified file
{remote}: modified file
Hit return to start merge resolution tool (meld):
Here you go https://github.com/nette/utils/pull/30/files?w=1 Mostly the person who give you the PR is who do the merge. I agree for the first PR there will be conflicts. If you are trying to demonstrate me the challenges I am not here for the same. You made a deal about the move, I happily helped you. I don't want to spend more time if you don't love it or you are trying to keep fool of the os contributors. Thanks |
|
Nope, I am not :). I messed up 2 PRs into one, sorry :). |
@dg for another note you wrote.
Have a look at https://help.github.com/articles/dealing-with-line-endings#platform-linux . Interested to hear whether it solves your issue. Thanks! |
@harikt I try ad line-endings: they are converted by Git on the fly. So repo internally uses Unix line-endings (or whatever) and local files uses OS line endings, in my case Windows line-endings. Because it is nonsense to force Unix line endings on Windows. |
Btw, how to gracefully solve the rebase of branch |
not sure I understand your question :( . |
Normally how are you merging things ? |
I mean |
I don't know, I am not using rebase. So my knowledge is limited. |
Rebasing is great! http://blogs.atlassian.com/2013/10/git-team-workflows-merge-or-rebase/ How to gracefully solve conflict with revert, for example:
|
ok, thanks. I will read and learn 👍 . |
in case if you have a quick answer
You are checking out the commit right ? Isn't it similar to |
Hi @dg , So merge ? |
I don't understand how is this better. This will entirely break |
@harikt rebasing (or reverting) is still not solved, it brings a lot of conflicts which I don't know how grafefully resolve. #29 (comment). |
ok. Thank you @dg for considering. I don't want to force you if you find it doesn't have any value. Thanks! . |
You and @pmjones said that it is good idea to switch to spaces, so I believe you will show us how to do it. Replace tabs with spaces in repository is the most simpliest part. There is easier way than use php-cs-fixer which breaks code by replacing foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator('.')) as $file) {
if ($file->getExtension() === 'php') {
$s = file_get_contents($file);
$s = str_replace("\t", ' ', $s);
file_put_contents($file, $s);
}
} One thing is replacing tabs with spaces. Another thing is working with such repo. It interests me! Every day I am using rebase, blame, sometimes revert. And now, after conversion, I don't know how to do these basic tasks. How to gracefully (i.e not being everytime confronted with conflicts) work with branches. So @harikt and @pmjones show me please for example how to rebase this branch #20 on this (future) master https://github.com/harikt/utils/commit/5717d1eb5658b516ee19e5c85d8a23c16100e55a. |
And this was the conversation :
And Paul did mentioned it is good. I don't want to drag again to those conversations. I just thought it is good to help you with and did send you 2 PR. But it should not happen as a blame :-) . |
@harikt #30 is merge, not rebase. You can merge pull request once is finished (usually by „Merge pull request“ button, which will not work for older PR after tabs -> spaces conversion). But there are a lot of PR which are under development and it is common best practise to continually rebase them on master. If I will convert tabs to spaces, everyone will ask me how to rebase his PR. What shall I answer? |
I don't know what I should say to you. If I say, it may sound hard. Just remember this before you make any other deals ;-) . |
@dg It should be possible to set up git to do the replacement for you, but I can't tell you the configuration directives from top of my head (never used them myself). |
@harikt I appreciate your help, but I need help with workflow, not with replacing strings. I know replacing tabs with spaces makes you happy, but I am trying to show you how many real problems it causes to us. So show me, you or @pmjones, how to solve these problem. And if you don't know solutions, tell it. It may be experience for you, that tabs-conversion seems easy but is not easy. But I don't know why "to be hard". |
@xificurk tabs can be transformed on the fly with this configuration http://www.php-fg.org/ |
@dg let us drop the conversation for the good, not because I have no answer for you. |
@harikt I am really very interested in the answer. |
@dg This seems to cover most of the questions: https://gist.github.com/eevee/6721177 UPDATE: I did a small test following the described method - the bad news is that after the change PRs cannot be automatically merged by GitHub until they're updated (see xificurk#1), |
@xificurk seems pretty affected: http://cl.ly/image/2V0L453f2G3j |
@hrach WTF? Where did you get that? When I try blame Strings.php I see https://www.dropbox.com/s/bp1nyfsejz0mpow/blame.png?dl=0 |
@xificurk scroll down |
omg, noob mistake :D |
I just looked at code of three well-known @php-fig members and all of them use tabs. Interesting. (Agavi, TYPO3 and Phalcon.) |
Yes, the vote was roughly 2:1 in favor of spaces. The tab folk are as a result not PSR-2 compliant. |
I am not sure what it is going on. @dg Do you really want to convert Nette to spaces or this is only some test? |
@foxycode no, it was about demonstrating how hard is it to convert properly and how much problem it creates for maintainer and contributors |
ie a truth :) . And as it was so hard to change Laravel, Cake 3 etc moved Its all about willingness to accept than people trying to fool others. Hari K T You can ring me : +91 9388 75 8821 http://harikt.com , https://github.com/harikt , Skype : kthari85 On Wed, Mar 18, 2015 at 9:24 PM, Filip Procházka [email protected]
|
Look, if you want to convert to spaces and thus be PSR-2 compliant, that's cool. If you are happy with tabs and incidentally being non-PSR-2-compliant, that's also cool. Neither is "good" or "bad" -- one is compliant, and one is not, and that's it. The tradeoffs are yours to choose between. |
@pmjones 👍 |
With the risk of being slightly of topic (and assuming the PSR-2 compliance either doesn't happen or will take a while) why don't people just use git to convert from/to tabs/spaces? (We're on github, its safe to assume we're using git, right?) It doesn't take much more than adding 2 config settings to a project... Full disclosure: http://stackoverflow.com/questions/2316677/can-git-automatically-switch-between-spaces-and-tabs |
Hi David Grudl,
As per our conversation and your deal I am sending you my first PR to help you with the conversion.
I will start with the rest once you have merged this.
Thank you