Live data from Hacker News

Git's initial commit

github.com

51–60 of 128 posts

Re: Git's initial commit

#51
post #17

Is there a reason there aren't any braces around single-line if statements? Is that a C thing? It seems kind of inviting to bugs to me.

It's pointless to argue over these kind of things. Every major project/company has their own codified code style guide, and if you want to contribute/earn your salary then you must follow that style guide to the T. Here's the relevant quote from the Linux kernel coding style[0]: Do not unnecessarily use braces where a single statement will do. if (condition) action(); [0] https://www.kernel.org/doc/Documentation/Codi…

I consider that a bug in their style spec. Single line if statements are known to cause bugs.

Re: Git's initial commit

#52
post #50

It's so short. The readme is the best explanation of git I've seen.

Does anyone know if the structure of git has changed much? I would like to read this thinking this is pretty close to the current implementation but I would have no idea. anyone?

Re: Git's initial commit

#54
post #50

It's so short. The readme is the best explanation of git I've seen.

Does anyone know if the structure of git has changed much? I would like to read this thinking this is pretty close to the current implementation but I would have no idea. anyone?

You can just see the structure with git cat-file

    -> % git cat-file -p 8c48d1a36c3d11db44c75a431d4f09cb0035222f
    tree 288c2d5379768f685f391bdbffd31b8965318c63
    parent 002ae35061beef02453b7fb1045a50fa2f7f30f8
    author Denis Bilenko  1246939605 +0700
    committer Denis Bilenko  1246939605 +0700

    MANIFEST.in: include libevent.h and libevent-internal.h
    -> % git cat-file -p 288c2d5379768f685f391bdbffd31b8965318c63
    100644 blob 6e543dc13df1b556fd95530061ac0c77a9178309.hgignore
    100644 blob 79c7beb2227ce149c7a71e58e2f7379071b7a189MANIFEST.in
    100644 blob 0d05178544942a035a82599900bec27fbac1c9c5README.eventlet
    040000 tree edb8f37fa622315dcf7bf4f7316d5e85c48cfdbdexamples
    040000 tree 64cf252d77a4162099442bb0153985fc20ed5ba3gevent
    040000 tree 261052e04b4aece469b2e767e394aafbc9d88a32greentest
    100644 blob 488e805c563dfeeb6af5e7a1a8953b706d9676e3setup.py
    -> % git cat-file -p 6e543dc13df1b556fd95530061ac0c77a9178309
    syntax: glob
    *~
    *.pyc
    *.orig
    dist
    gevent.egg-info
    build
    htmlreports
    results.*.db
    gevent/core.so
And yeah it's still very similar though it currently doesn't store the objects individually but rather packs them together.

Re: Git's initial commit

#56

Earlier quoted context omitted.

How can something that isn't a programming language be self-hosting?

Overloading the term. The OP presumably meant that the source for git was under git source control.

'Hosting' means 'contain', 'serve'. A building can host a department or a convention, and a married couple can host a dinner party, with neither being required to be a webserver or programming language.

Re: Git's initial commit

#57

Earlier quoted context omitted.

I use a plugin called littlebrace for visual studio, which reduces brace lines to like 3 pt font. My C# code has started looking like Python :)

This sounds really neat. Can you drop a link? I browsed around but couldn't find anything.

https://github.com/lukesdm/little-braces looks like the one.

Re: Git's initial commit

#58
post #55

I've read so many git tutorials, I wish I had seen that README file before.

This. I find that learning from original documentation tends to be much more efficient than learning from third party blogs/tutorials which try to "simplify" things, and usually do the opposite.

Re: Git's initial commit

#59
post #57

Earlier quoted context omitted.

This sounds really neat. Can you drop a link? I browsed around but couldn't find anything.

https://github.com/lukesdm/little-braces looks like the one.

Also see this fork/port to VS2013:

https://github.com/owen2/little-braces

Also, it is available from the online add-in manager if you search for "little braces." The VS2013 community edition is just in time :)

I couple it with the indent guideline plugin for best effect (braces are super small, light lines to track indent level, 2 space indent...).

Re: Git's initial commit

#60
post #37

Is there a reason there aren't any braces around single-line if statements? Is that a C thing? It seems kind of inviting to bugs to me.

Most C-inspired languages (most popular programming languages) allow this. The only ones I've used that don't are Go and Swift. And I find it a little annoying. If you're worried about bugs, there are other things in C/C++ to criticize first ;)

It's true for Rust as well. What these three languages have in common is that they don't require parentheses around the switching boolean expression, and when you have things like:

    if expression1 expression2
it can be fiendishly hard to determine the boundary between expression1 and expression2.
Post reply on HN