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
KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.
For solo projects I like to git merge --no-ff because it creates logical groupings of my commits.

Adbot
ADBOT LOVES YOU

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Eela6 posted:

We're hiring a devops team, so I actually have some hope.

Bad news: hiring a "devops team" means that whoever is responsible for that decision doesn't understand what devops is.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

TheBlackVegetable posted:

Often I'm working on a new feature when a bug needs to be fixed in production, so I check out master, fix the bug, push, build and release then rebase my feature branch back onto master to incorporate the bug fix into my dev environment.

I also like to rebase -i to clean up a batch commits into something presentable.

This all can happen over a period of days so I'm pushing work in progress to github that will be rebased later.

:stare:

TheBlackVegetable posted:

Exactly that, I've tried using merges and the linear history is much more appealing to me over the spaghetti bowl of merged branches I had before that.

What do you mean linear history?

I mean you're basically going out of your way to delete information because it looks nicer? I guess? Pretty sure if you want you can get git log to display your history like its linear even if it isn't.

There's times when rebasing is useful or necessary but that seems like extra steps for no reason.

Zaphod42 fucked around with this message at 07:17 on Aug 17, 2017

Xerophyte
Mar 17, 2008

This space intentionally left blank

Zaphod42 posted:

:stare: What do you mean linear history?



Some people do rebase rather than merge to incorporate branches for a strictly merge-free history. It's about the same idea; I find having an explicit merge commit summarizing the full PR to be useful for context but that's me.

Personally I'm not going to do multiple rebases to ensure a strict linear history when someone pre-empts me in a busy repo or anything, but I will do a rebase on master and squash any WIP and code review fix commits before I merge my PRs. I view it as a quality thing to keep our code base maintainable, similar in purpose to documentation or comments. It's definitely not just to look pretty, and pretty low effort as long as you don't go full OCD about making your history perfect and pristine. A linear or at least linear-ish history is less effort to read, simpler to bisect, makes it easier to figure out the context of a commit when debugging and a lot cleaner when you need the history of changes to a specific file.

You certainly don't have to use heavy rebase workflows if you don't think they're worth it for your usecase but it's not like they're uncommon or particularly strange. Lots of people doing merge updates and pushing their WIP can get extremely messy in a large team sharing a repo. Things like git rebase -i or the fixup! keyword in commit messages are in git specifically to help manage that mess. Use them if they help you, don't use them if they don't.

TheBlackVegetable
Oct 29, 2006

Zaphod42 posted:

:stare:


What do you mean linear history?

I mean you're basically going out of your way to delete information because it looks nicer? I guess? Pretty sure if you want you can get git log to display your history like its linear even if it isn't.

There's times when rebasing is useful or necessary but that seems like extra steps for no reason.

You should try it, you might like it. I don't know what you mean by delete information, unless you're taking about leaving in junk commits or confusing and irrelevant development activity? I prefer my git log to represent just what's going on in terms of active development and production releases.

It might be more work up front (slightly, I guess?), but it describes what I need to know about the repo at a glance.

E: Xerophyte's example is pretty much it.

TheBlackVegetable fucked around with this message at 10:09 on Aug 17, 2017

Spatial
Nov 15, 2007

Post the code that makes you laugh (or post about source control for five straight days)

Insufferable bikeshedding turds

Spatial
Nov 15, 2007

The C preprocessor strikes again. Instead of using the built-in sized integer types in <stdint.h>, one very special team has defined all the types themselves and used them throughout their project:

C++ code:
#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed
This would be forgivable if it was to shorten the names and they were actual typedefs (u8, u16 etc are common). But nope, redundant, long and ugly is all you get. Bonus point for being written by former JavaScript developers.

return0
Apr 11, 2007

Spatial posted:

The C preprocessor strikes again. Instead of using the built-in sized integer types in <stdint.h>, one very special team has defined all the types themselves and used them throughout their project:

C++ code:
#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed
This would be forgivable if it was to shorten the names and they were actual typedefs (u8, u16 etc are common). But nope, redundant, long and ugly is all you get. Bonus point for being written by former JavaScript developers.

Extremely bad and nasty.

Pollyanna
Mar 5, 2005

Milk's on them.


I like git because I'll be damned if I have to learn a million different version control systems when we can have just one.

feedmegin
Jul 30, 2008

Spatial posted:

The C preprocessor strikes again. Instead of using the built-in sized integer types in <stdint.h>, one very special team has defined all the types themselves and used them throughout their project:

C++ code:
#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed
This would be forgivable if it was to shorten the names and they were actual typedefs (u8, u16 etc are common). But nope, redundant, long and ugly is all you get. Bonus point for being written by former JavaScript developers.

Also it'll break on UNICOS! :sun:

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug
Working on doing some load testing for a client.

They want to test some CRUD operations against a REST API. Okay, no problem.

POST: [Json Describing Thing to Create]

Response I was expecting: [Json Describing Thing that was Created, like say a status indicating success or failure and an ID so I can interact with it for the "UD" parts of "CRUD"]
Response I got: [Json for a paginated view, with the object that was created being on a different page and no way of identifying it other than by name, which by the way is not guaranteed unique]

Pollyanna
Mar 5, 2005

Milk's on them.


New Yorp New Yorp posted:

Working on doing some load testing for a client.

They want to test some CRUD operations against a REST API. Okay, no problem.

POST: [Json Describing Thing to Create]

Response I was expecting: [Json Describing Thing that was Created, like say a status indicating success or failure and an ID so I can interact with it for the "UD" parts of "CRUD"]
Response I got: [Json for a paginated view, with the object that was created being on a different page and no way of identifying it other than by name, which by the way is not guaranteed unique]

For a take-home I asked what should be returned from a POST and was told "do whatever you want" so I think people just don't really think about what they're doing.

Steve French
Sep 8, 2003

Pollyanna posted:

For a take-home I asked what should be returned from a POST and was told "do whatever you want" so I think people just don't really think about what they're doing.

Or they do, and they were evaluating whether you also do

Ghost of Reagan Past
Oct 7, 2003

rock and roll fun

New Yorp New Yorp posted:

Working on doing some load testing for a client.

They want to test some CRUD operations against a REST API. Okay, no problem.

POST: [Json Describing Thing to Create]

Response I was expecting: [Json Describing Thing that was Created, like say a status indicating success or failure and an ID so I can interact with it for the "UD" parts of "CRUD"]
Response I got: [Json for a paginated view, with the object that was created being on a different page and no way of identifying it other than by name, which by the way is not guaranteed unique]
I'm working with an API that returns a 401 unauthorized error if anything is messed up.

It returns 200 sometimes, where the body tells me that I'm unauthorized in XML.

Dongsturm
Feb 17, 2012

C++ code:
#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed

return0 posted:

Extremely bad and nasty.

Someone explain this to me please because I always have to do this since if I don't gcc replaces my 64 bit file length counters with 32 bit ones* and then my program only reads the first 500 megs of my 8.5 gigabyte file.

* on 32bit targets

Volguus
Mar 3, 2009

Spatial posted:

The C preprocessor strikes again. Instead of using the built-in sized integer types in <stdint.h>, one very special team has defined all the types themselves and used them throughout their project:

C++ code:
#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed
This would be forgivable if it was to shorten the names and they were actual typedefs (u8, u16 etc are common). But nope, redundant, long and ugly is all you get. Bonus point for being written by former JavaScript developers.

I can see this done if you need your code to be portable on some weird-rear end embedded platform with a C compiler written when dinosaurs were walking the earth.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Dongsturm posted:

C++ code:

#define INT_8_U unsigned char
#define INT_8_I signed char
#define INT_16_U unsigned short
#define INT_16_I signed short
#define INT_32_U unsigned
#define INT_32_I signed


Someone explain this to me please because I always have to do this since if I don't gcc replaces my 64 bit file length counters with 32 bit ones* and then my program only reads the first 500 megs of my 8.5 gigabyte file.

* on 32bit targets

C++11 introduced fixed width types in <cstdint> and those are preferable. They're cool and good.

Pollyanna
Mar 5, 2005

Milk's on them.


Steve French posted:

Or they do, and they were evaluating whether you also do

There is that too, yes.

Suspicious Dish
Sep 24, 2011

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

Volguus posted:

I can see this done if you need your code to be portable on some weird-rear end embedded platform with a C compiler written when dinosaurs were walking the earth.

rude, but its official name is "Microsoft Visual C++"

VikingofRock
Aug 24, 2008




leper khan posted:

C++11 introduced fixed width types in <cstdint> and those are preferable. They're cool and good.

Hasn't <cstdint> been around since like C++98?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
nah, it was first in C99 but it took until 2011 for C++ to get it

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
No, stdint.h was added in C99, which came out a little too late for C++98 to pull it in.

Spatial
Nov 15, 2007

Volguus posted:

I can see this done if you need your code to be portable on some weird-rear end embedded platform with a C compiler written when dinosaurs were walking the earth.
It's a normal-rear end embedded platform (Cortex M3) with only one compiler supported, which does correctly implement C99.

There's really no reason for it.

Dongsturm
Feb 17, 2012

leper khan posted:

C++11 introduced fixed width types in <cstdint> and those are preferable. They're cool and good.

I was trying to stick to C89 for portability, but I guess even toy C compilers will support those types, and I can macro them in otherwise.

VikingofRock
Aug 24, 2008




Plorkyeran posted:

No, stdint.h was added in C99, which came out a little too late for C++98 to pull it in.

And they didn't add it in C++03? drat well okay nevermind then.

quiggy
Aug 7, 2010

[in Russian] Oof.


VikingofRock posted:

And they didn't add it in C++03? drat well okay nevermind then.

As someone who programs in C++03 for my day job: if you can think of some even remotely nice feature in modern C++, it was added in C++11.

Plorkyeran
Mar 22, 2007

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

VikingofRock posted:

And they didn't add it in C++03? drat well okay nevermind then.

C++03 was just a bugfix release. The single new feature it had (value initialization) was mostly just a formalization of behavior that was specified in a roundabout way in C++98.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

TheBlackVegetable posted:

You should try it, you might like it. I don't know what you mean by delete information, unless you're taking about leaving in junk commits or confusing and irrelevant development activity? I prefer my git log to represent just what's going on in terms of active development and production releases.

It might be more work up front (slightly, I guess?), but it describes what I need to know about the repo at a glance.

E: Xerophyte's example is pretty much it.

I like seeing branches personally.

But the thing is if you're working on a team of more than 1, constantly rebasing is basically forcing your Git to behave like a central VCS like CVS. Every time you rebase anybody who is currently working on that branch is hosed and will have to check out again and merge by hand.

Xerophyte posted:

You certainly don't have to use heavy rebase workflows if you don't think they're worth it for your usecase but it's not like they're uncommon or particularly strange. Lots of people doing merge updates and pushing their WIP can get extremely messy in a large team sharing a repo. Things like git rebase -i or the fixup! keyword in commit messages are in git specifically to help manage that mess. Use them if they help you, don't use them if they don't.

Yeah I mean I can imagine a few rare scenarios where they'd be useful, but not as part of your regular flow.

quiggy posted:

As someone who programs in C++03 for my day job: if you can think of some even remotely nice feature in modern C++, it was added in C++11.

lol

Spatial
Nov 15, 2007

Remember iterating over containers before C++11?

Then:
C++ code:
for (std::vector<Type>::iterator iter = container.begin(); iter != container.end(); ++iter)
    iter->thing();
Now:
C++ code:
for (auto& object: container)
    object.thing();

Spatial
Nov 15, 2007

C++: the language that copies Java to REDUCE verbosity. :buddy:

quiggy
Aug 7, 2010

[in Russian] Oof.


No idea what you're talking about.

C++ code:
std::vector<double> l;

for (std::deque<std::pair<double, double> >::const_iterator last_it = last.begin(); last_it != last.end(); ++last_it) {
    l.push_back(it->second);
}
This is actual production code of mine, and I know I've written worse stuff than this too :negative:

quiggy fucked around with this message at 21:08 on Aug 17, 2017

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Ghost of Reagan Past posted:

I'm working with an API that returns a 401 unauthorized error if anything is messed up.

It returns 200 sometimes, where the body tells me that I'm unauthorized in XML.

Sometimes this comes from a good intention. IE, the web stack processed your request okay, but some other backend service it talked to was unauthorized. That's 200 + an appropriately formatted response object + the message says unauthorized. "But, shouldn't the web stack abstract that for me and give me the effective result of my request?????" Yeah maybe, but often times that looks like manually reading & rewriting responses for you from other services, which is a hassle compared to agnostically forwarding the response to you directly. I'm not saying 200 + "unauthorized" is a great paradigm, but it's not entirely unjustifiable.

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
Surely any internal error should result in a 500-series error code?

Rubellavator
Aug 16, 2007

Some folks in my building return a "512" for when things don't work correctly. We have some security requirement that basically tells us we can't expose any kind of information about what went wrong and for some reason that includes http error codes.

Taffer
Oct 15, 2010


quiggy posted:

No idea what you're talking about.

C++ code:
std::vector<double> l;

for (std::deque<std::pair<double, double> >::const_iterator last_it = last.begin(); last_it != last.end(); ++last_it) {
    l.push_back(it->second);
}
This is actual production code of mine, and I know I've written worse stuff than this too :negative:

Man, I know C++ is a really powerful language for lots of reasons and probably the most flexible language with modern features, but.... holy god they came up with the most difficult to parse syntax ever. I think the only language that managed to get that worse was ObjC.

Zaphod42
Sep 13, 2012

If there's anything more important than my ego around, I want it caught and shot now.

TooMuchAbstraction posted:

Surely any internal error should result in a 500-series error code?

That's how I've done it. 401 means your basic HTTPS authentication failed or whatever handshake, anything else means you get a 500-series and the body of the response tells you the particular error.

I can see what Factor Mystic meant though.

TheBlackVegetable
Oct 29, 2006

Zaphod42 posted:

I like seeing branches personally.

But the thing is if you're working on a team of more than 1, constantly rebasing is basically forcing your Git to behave like a central VCS like CVS. Every time you rebase anybody who is currently working on that branch is hosed and will have to check out again and merge by hand.

Bear in mind, you never rebase a branch if other people are committing to it - but I've never worked a job where two people are working on the same feature branch without working side-by-side. If your process has multiple developers committing to the same branch (outside of merging into master of course), then our workflows are fundamentally different and we're both doing the right thing, in context.

feedmegin
Jul 30, 2008

Taffer posted:

Man, I know C++ is a really powerful language for lots of reasons and probably the most flexible language with modern features, but.... holy god they came up with the most difficult to parse syntax ever. I think the only language that managed to get that worse was ObjC.

The auto keyword we have now is p nice you know

feedmegin
Jul 30, 2008

Volguus posted:

I can see this done if you need your code to be portable on some weird-rear end embedded platform with a C compiler written when dinosaurs were walking the earth.

In my last job we were compiling with gcc 3.4 for Solaris Sparc. No stdint.h for us!

Adbot
ADBOT LOVES YOU

quiggy
Aug 7, 2010

[in Russian] Oof.


feedmegin posted:

The auto keyword we have now is p nice you know

Yeah, auto is the #1 reason I wish my job would migrate at least to C++11. That's not to say that more modern versions of C++ don't have their own syntactical horrors thanks to stuff like templates and rvalue-references.

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