Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
qntm
Jun 17, 2009

Dr. Stab posted:

What do you propose as an alternative?

It's called a three-way merge.

Adbot
ADBOT LOVES YOU

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe

ctz posted:

Except they're clearly using perforce here.

This. Also, most version control tools work this way, or at least have the ability to. Also, most version control tools (notably including git) have the decency to prevent you from checking in those conflict markers unless you manually elect to do so. If you'd like to use a tool that doesn't handle conflicts textually, GUI version control tools usually have a merge editor.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Obsurveyor posted:

git reset --hard HEAD

and then git diff your way to victory or whatever way you want to resolve it. You shouldn't be fixing merge conflicts in a branch you're going to push anyway. Fix it in the branch that you're merging so you have a clean merge to push.

I've been saying for years that Git needs a newbie mode. It's incredibly unfriendly and unintuitive for new users.

sunaurus
Feb 13, 2012

Oh great, another bookah.

Ithaqua posted:

I've been saying for years that Git needs a newbie mode. It's incredibly unfriendly and unintuitive for new users.

I've started sending people here: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init
I actually showed that to my mother and after she finished the tutorial she told me that she liked git and would like to use it more.

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀

qntm posted:

It's called a three-way merge.

I don't really understand what you're trying to say. You think that git doesn't do three way merges and also you think that three way merges completely eliminate the need to manually resolve conflicts?

ExcessBLarg!
Sep 1, 2001

Ithaqua posted:

I've been saying for years that Git needs a newbie mode. It's incredibly unfriendly and unintuitive for new users.
"git merge --abort" does the same thing and is probably a more appropriate way to abort a failed auto-merge. I guess the two problem is that git's output doesn't say anything about the --abort option on a merge conflict, and most people invoke "git pull" instead of "git merge" directly.

Obsurveyor
Jan 10, 2003

Ithaqua posted:

I've been saying for years that Git needs a newbie mode. It's incredibly unfriendly and unintuitive for new users.

DVCS is not a natural concept to begin with. It requires some education, regardless of some mode available to hold a user's hand. I think GUI tools obfuscate enough of what git does that they are actively harmful to new users and so many people start out on them. The command line has warnings all over that a merge conflict has happened and that you're merging a conflict which should be a big red flag to stop and look at it more closely(at least do a git diff HEAD before committing and look over the merge). Git also requires a lot of trust that it's not going to trash your files and trust that if you've committed it, it's never lost if you do screw up*. That's tough for new users to get a handle on.

*except the worst mistake: Deleting the .git folder. I had a user do that just last week and I still partially blame the GUI file interface they were using.

FamDav
Mar 29, 2008
Do something that guarantees you resolve all merge conflicts and doesn't leave the option to fart out git metatext by accident?

Soricidus
Oct 21, 2010
freedom-hating statist shill

FamDav posted:

Do something that guarantees you resolve all merge conflicts and doesn't leave the option to fart out git metatext by accident?

good idea, i'll make the wiki

IT BEGINS
Jan 15, 2009

I don't know how to make analogies
More loving insanity today. I'm currently dealing with a PHP class that doesn't have a construct but instead has an 'init' method that's called everywhere this thing is instantiated. It does everything that a constructor does otherwise. WHHHHYYYYYY

ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

Soricidus posted:

good idea, i'll make the wiki

It's literally a pre-commit hook that does this that ships with Git as an example.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

IT BEGINS posted:

More loving insanity today. I'm currently dealing with a PHP class that doesn't have a construct but instead has an 'init' method that's called everywhere this thing is instantiated. It does everything that a constructor does otherwise. WHHHHYYYYYY

In a normal language (and thus potentially also for PHP; I have no idea personally) this is done if you need to do additional steps to create the object that can't be done in the constructor (see e.g. the "leaking this in constructor" warning in Java). Ideally the init method would instead be a static "factory" method on the object, so instead of doing "foo = new Thing()" you'd do "foo = Thing.create()". I'm guessing in your example it's actually like "foo = new Thing(); foo.init()", which is rather silly but hardly awful.

IT BEGINS
Jan 15, 2009

I don't know how to make analogies

TooMuchAbstraction posted:

In a normal language (and thus potentially also for PHP; I have no idea personally) this is done if you need to do additional steps to create the object that can't be done in the constructor (see e.g. the "leaking this in constructor" warning in Java). Ideally the init method would instead be a static "factory" method on the object, so instead of doing "foo = new Thing()" you'd do "foo = Thing.create()". I'm guessing in your example it's actually like "foo = new Thing(); foo.init()", which is rather silly but hardly awful.

In PHP I've yet to find a place where it's necessary. In this particular case there's nothing in the init that needs to be done outside of the constructor. I guess it's not utterly awful but I've been loving around with it for like an hour figuring out what kind of global bullshit it touches so I can actually use its functionality in a new place.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

ultramiraculous posted:

It would appear someone at Steam pushed a merge conflict to PROD.



The most disappointing thing is that the Steam web app is built with PHP.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Also, hi chrisk

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Dr. Stab posted:

What do you propose as an alternative?

code:
git: merge conflict detected!
git: would you like me to:
git:    1) begin an interactive merge session
git:    2) [quit wituout making any changes]
git:    9) mash the changes into your working directory so you can deal with them yourself
git:? 9
git: are you sure? y/[n]
And of course you could set a thing in your options to bypass that directly to your preferred default and set an editor to do the interactive merge, etc.

baquerd
Jul 2, 2007

by FactsAreUseless
Oh, the client doesn't want to use protobuf per the existing API because it's "too hard"? No problem, we'll write code for them so they can store their XML in a String field and just hack the rest of the protobuf with nonsense values so it serializes!

canis minor
May 4, 2011

IT BEGINS posted:

More loving insanity today. I'm currently dealing with a PHP class that doesn't have a construct but instead has an 'init' method that's called everywhere this thing is instantiated. It does everything that a constructor does otherwise. WHHHHYYYYYY

Um... it sounds like either singleton or factory pattern? http://www.phptherightway.com/pages/Design-Patterns.html

Can you please paste parts of the code you found weird?

return0
Apr 11, 2007

Munkeymon posted:

code:
git: merge conflict detected!
git: would you like me to:
git:    1) begin an interactive merge session
git:    2) [quit wituout making any changes]
git:    9) mash the changes into your working directory so you can deal with them yourself
git:? 9
git: are you sure? y/[n]
And of course you could set a thing in your options to bypass that directly to your preferred default and set an editor to do the interactive merge, etc.

This would be insanely bad.

Deep Dish Fuckfest
Sep 6, 2006

Advanced
Computer Touching


Toilet Rascal

baquerd posted:

Oh, the client doesn't want to use protobuf per the existing API because it's "too hard"? No problem, we'll write code for them so they can store their XML in a String field and just hack the rest of the protobuf with nonsense values so it serializes!

How the hell are protobufs too hard? The entire reference/spec is pretty loving light reading as far as these things go. Did they give some reason beyond it being "too hard"?

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

return0 posted:

This would be insanely bad.

...why? You can't just say something like that without giving an explanation.

The commandline git I use (which so far as I'm aware is the current git standard) prompts you to use "get mergetool" when there are conflicts. And that command in turn will spawn whatever program you have configured to handle conflicts.

It won't stop you from trying to make commits that have merge conflicts in them, but if you aren't reviewing the diffs for every commit you make then there is no help for you anyway. I can't count the number of bugs I've fixed just by rereading my code instead of thinking "ahhh, it'll be fine." It's never fine.

JawnV6
Jul 4, 2004

So hot ...

FamDav posted:

Do something that guarantees you resolve all merge conflicts

TooMuchAbstraction posted:

if you aren't reviewing the diffs for every commit you make then there is no help for you anyway
These both sound like user education or process hooks more than software tooling. But I'm still seeing software tooling recommendations as if that'll take you the whole way?

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

JawnV6 posted:

These both sound like user education or process hooks more than software tooling. But I'm still seeing software tooling recommendations as if that'll take you the whole way?

I think you'll find, sir, that if you can't solve a problem with software then it's not an important problem in the first place.

qntm
Jun 17, 2009

Dr. Stab posted:

I don't really understand what you're trying to say. You think that git doesn't do three way merges and also you think that three way merges completely eliminate the need to manually resolve conflicts?

No, I didn't say either of those things. What I said was,

qntm posted:

The problem isn't that there's a conflict, the problem is that Git thinks that the sensible way to handle a conflict is to turn my file into a big pile of chevrons.

Was this unclear?

A better approach would be to start an interactive two- or three-way merge in an editor so I can resolve it manually myself, or put the conflicting files somewhere I can merge them at my leisure, or to roll the changes back, or in fact do basically anything other than filling my otherwise working source file with garbage. In other words, what everybody else is saying.

E: perhaps what I didn't make clear was that although I'm new to Git, it's the third or fourth source control system I've used professionally. For some reason everybody assumed that I had literally never seen a merge conflict before?

qntm fucked around with this message at 01:38 on Apr 5, 2016

ExcessBLarg!
Sep 1, 2001
The chevron thing is hardly unique to Git. patch(1) does this, as does RCS, CVS, Subversion, and Mercurial if you don't have another interactive merge tool specified. It's not even really a poor default as merge tools are generally part of a development or desktop environment, and not really related to Git itself.

Unrelated, but originally Git was to be a low-level program upon which higher level frontends, like Cogito, could interact with. These went away after GIt 1.5 came out with a "simpler" interface, although the consensus is that Git still has at least a few unintuitive command behaviors.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

qntm posted:

A better approach would be to start an interactive two- or three-way merge in an editor so I can resolve it manually myself, or put the conflicting files somewhere I can merge them at my leisure, or to roll the changes back, or in fact do basically anything other than filling my otherwise working source file with garbage. In other words, what everybody else is saying.

Marking the conflicts in the file is the standard way of passing that information to your interactive merge tool. This convention significantly predates git and is used by a whole bunch of tools, and in fact the only VCS I've used that didn't do it was SourceSafe (which couldn't really hit merge conflicts in the first place because it doesn't have functional branching and has global locks on files).

qntm posted:

E: perhaps what I didn't make clear was that although I'm new to Git, it's the third or fourth source control system I've used professionally. For some reason everybody assumed that I had literally never seen a merge conflict before?
Well you were surprised by git doing the same thing as all of the tools that came before it do, so the obvious conclusion is that you haven't used any of those tools either.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
also i don't know wtf you're planning on doing with a working tree that's in the middle of a merge conflict that doesn't involve immediately working on resolving that conflict. your files certainly aren't "otherwise working" in any meaningful sense, and if you decide that you don't want to deal with the merge immediately then you just run the abort merge command

Carbon dioxide
Oct 9, 2012

sunaurus posted:

I've started sending people here: https://www.atlassian.com/git/tutorials/setting-up-a-repository/git-init
I actually showed that to my mother and after she finished the tutorial she told me that she liked git and would like to use it more.

I'm in a team at work that's trying to prove that switching to Git from SVN will save us time during the review process once it's set-up right and we trained people on how to use it... and a lot of what I found so far is "git is perfect, if you don't understand the commands intuitively ur stupid :smug: " and "If you have trouble understanding git's workflow because you're used to SVN, that's your own problem, don't come asking us for help now!" That kind of attitude isn't very helpful, you know.

Thanks for that link, it's one of the first actually helpful documents I've seen. Most tutorials do explain all the commands, but don't explain how you're supposed to use them, nor the difference in meaning they have compared to SVN or other VCSs.

vOv
Feb 8, 2014

Plorkyeran posted:

also i don't know wtf you're planning on doing with a working tree that's in the middle of a merge conflict that doesn't involve immediately working on resolving that conflict. your files certainly aren't "otherwise working" in any meaningful sense, and if you decide that you don't want to deal with the merge immediately then you just run the abort merge command

Yeah this is what I don't get. If you've got a merge conflict, the fact that now your files don't compile doesn't matter because you should be fixing them anyway (and even for files that don't have a compilation step, you still have to re-stage them so you don't accidentally wind up with mergeshit in your tree). Though I do think that the merge-checker precommit hook should be on by default.

qntm
Jun 17, 2009

Plorkyeran posted:

Marking the conflicts in the file is the standard way of passing that information to your interactive merge tool. This convention significantly predates git and is used by a whole bunch of tools, and in fact the only VCS I've used that didn't do it was SourceSafe (which couldn't really hit merge conflicts in the first place because it doesn't have functional branching and has global locks on files).

Well you were surprised by git doing the same thing as all of the tools that came before it do, so the obvious conclusion is that you haven't used any of those tools either.

Well, there you go, I guess. When I used SVN years ago it was a single-person project so no conflicts, after that I used CMVC which has file locking and Team Concert which is Eclipse-based.

Plorkyeran posted:

also i don't know wtf you're planning on doing with a working tree that's in the middle of a merge conflict that doesn't involve immediately working on resolving that conflict. your files certainly aren't "otherwise working" in any meaningful sense

A merge conflict is not equivalent to a broken file full of chevrons. In Team Concert, the merge conflict takes the form of a bunch of changes held in a separate area until I merge them in manually, and until I do that, my existing source tree is untouched and, from my perspective, still working.

qntm fucked around with this message at 09:34 on Apr 5, 2016

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Well, "working" except for the fact that it hasn't actually integrated the changes you expected it to integrate when you tried to automerge things.

If you have a merge conflict, and you want things to just be in a working state, you can either a) fix the conflict, or b) say "nevermind I'll merge this one later". Does that really seem an unreasonable burden?

qntm
Jun 17, 2009

Jabor posted:

If you have a merge conflict, and you want things to just be in a working state, you can either a) fix the conflict, or b) say "nevermind I'll merge this one later". Does that really seem an unreasonable burden?

No, nor was that what I was annoyed about.

FamDav
Mar 29, 2008

Soricidus posted:

good idea, i'll make the wiki

Thanks I don't know how :blush:

FamDav
Mar 29, 2008
If your default leads to perennial cases of "look at that loving idiot they should have known better" then maybe it's not a good default? I get the reasons for why they went with it (convention, not really caring about UX, probably some UNIX argument) but I think they could have picked better defaults that make it impossible to commit merge metadata.

Soricidus
Oct 21, 2010
freedom-hating statist shill

FamDav posted:

I don't know how :blush:

reported

canis minor
May 4, 2011

I work with people that resolve conflicts by always using their version :downs:

TheresaJayne
Jul 1, 2011
Well how about this for a FAIL

FTP transfer of 5MB of small files (1k each )

Open FTP Connection
Transfer file
Close Connection
Loop until Completed


FileZilla takes 3 minutes,

Java code = 4 hours

OddObserver
Apr 3, 2009

canis minor posted:

I work with people that resolve conflicts by always using their version :downs:

That is indeed a horror. My sympathies.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
I'm not entirely sure what the complaint is, but I would probably consider it to be a horror if a program written for the express purpose of downloading files did not perform better than the most naïve possible implementation in a general-purpose programming language.

Especially if the naïve version is completely shutting down the session and incurring a billion round-trip delays reestablishing it for every single file.

Adbot
ADBOT LOVES YOU

Space Kablooey
May 6, 2009


Valve lacking in quality control?

Well, I'll never.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply