{"thread":{"id":"1690","subject":"compile problem with gcc 2.95","startedAt":"2005-08-29T18:28:36Z","lastAt":"2005-08-30T04:39:02Z","messageCount":3,"participants":["Dave Hansen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"7910","messageId":"1125340116.26108.12.camel@localhost","threadId":"1690","inReplyTo":null,"subject":"compile problem with gcc 2.95","fromName":"Dave Hansen","fromEmail":"haveblue@us.ibm.com","sentAt":"2005-08-29T18:28:36Z","receivedAt":"2005-08-29T18:28:36Z","isPatch":false,"sender":{"key":"haveblue@us.ibm.com","avatar":null},"body":"I know it's an ancient compiler, but last time I checked it is still\nfaster at runtime than the 3.x versions.  If it's not going to be\nsupported, it would probably be nice to at least detect that in the\nbuild system.  I've confirmed that it works just fine with gcc 3.3.\n\ndave@spirit:~/bin/git$ make\ngcc -o rev-cache.o -c -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>'\nrev-cache.c\nIn file included from rev-cache.c:2:\ncache.h:107: field `name' has incomplete type\ncache.h:290: field `base' has incomplete type\ncache.h:303: field `pack_name' has incomplete type\ncache.h:318: field `name' has incomplete type\nmake: *** [rev-cache.o] Error 1\ndave@spirit:~/bin/git$ gcc -v\nReading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs\ngcc version 2.95.4 20011002 (Debian prerelease)\n\n> struct cache_entry {\n...\n>         char name[]; <--- cache.h:107\n> };\n\n\n-- Dave\n"},{"id":"7917","messageId":"7vwtm4a79j.fsf@assigned-by-dhcp.cox.net","threadId":"1690","inReplyTo":"1125340116.26108.12.camel@localhost","subject":"Re: compile problem with gcc 2.95","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-29T19:10:48Z","receivedAt":"2005-08-29T19:10:48Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dave Hansen <haveblue@us.ibm.com> writes:\n\n> I know it's an ancient compiler, but last time I checked it is still\n> faster at runtime than the 3.x versions.  If it's not going to be\n> supported, it would probably be nice to at least detect that in the\n> build system.  I've confirmed that it works just fine with gcc 3.3.\n>\n>> struct cache_entry {\n> ...\n>>         char name[]; <--- cache.h:107\n>> };\n\nAh, my fault.  Let's undo that bit.\n"},{"id":"7943","messageId":"7voe7g3uop.fsf@assigned-by-dhcp.cox.net","threadId":"1690","inReplyTo":"7vwtm4a79j.fsf@assigned-by-dhcp.cox.net","subject":"[HOWTO] Reverting an existing commit","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-08-30T04:39:02Z","receivedAt":"2005-08-30T04:39:02Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Reverting an existing commit\n============================\n\nOne of the changes I pulled into the 'master' branch turns out to\nbreak building GIT with GCC 2.95.  While they were well intentioned\nportability fixes, keeping things working with gcc-2.95 was also\nimportant.  Here is what I did to revert the change in the 'master'\nbranch and to adjust the 'pu' branch, using core GIT tools and\nbarebone Porcelain.\n\nFirst, prepare a throw-away branch in case I screw things up.\n\n------------------------------------------------\n$ git checkout -b revert-c99 master\n------------------------------------------------\n\nNow I am on the 'revert-c99' branch.  Let's figure out which commit to\nrevert.  I happen to know that the top of the 'master' branch is a\nmerge, and its second parent (i.e. foreign commit I merged from) has\nthe change I would want to undo.  Further I happen to know that that\nmerge introduced 5 commits or so:\n\n------------------------------------------------\n$ git show-branch --more=4 master master^2 | head\n! [master] Merge refs/heads/portable from http://www.cs.berkeley....\n ! [master^2] Replace C99 array initializers with code.\n--\n+  [master] Merge refs/heads/portable from http://www.cs.berkeley....\n++ [master^2] Replace C99 array initializers with code.\n++ [master^2~1] Replace unsetenv() and setenv() with older putenv().\n++ [master^2~2] Include sys/time.h in daemon.c.\n++ [master^2~3] Fix ?: statements.\n++ [master^2~4] Replace zero-length array decls with [].\n+  [master~1] tutorial note about git branch\n------------------------------------------------\n\nThe '--more=4' above means \"after we reach the merge base of refs,\nshow until we display four more common commits\".  That last commit\nwould have been where the \"portable\" branch was forked from the main\ngit.git repository, so this would show everything on both branches\nsince then.  I just limited the output to the first handful using\n'head'.\n\nNow I know 'master^2~4' (pronounce it as \"find the second parent of\nthe 'master', and then go four generations back following the first\nparent\") is the one I would want to revert.  Since I also want to say\nwhy I am reverting it, the '-n' flag is given to 'git revert'.  This\nprevents it from actually making a commit, and instead 'git revert'\nleaves the commit log message it wanted to use in '.msg' file:\n\n------------------------------------------------\n$ git revert -n master^2~4\n$ cat .msg\nRevert \"Replace zero-length array decls with [].\"\n\nThis reverts 6c5f9baa3bc0d63e141e0afc23110205379905a4 commit.\n$ git diff HEAD ;# to make sure what we are reverting makes sense.\n$ make CC=gcc-2.95 clean test ;# make sure it fixed the breakage.\n$ make clean test ;# make sure it did not cause other breakage.\n------------------------------------------------\n\nThe reverted change makes sense (from reading the 'diff' output), does\nfix the problem (from 'make CC=gcc-2.95' test), and does not cause new\nbreakage (from the last 'make test').  I'm ready to commit:\n\n------------------------------------------------\n$ git commit -a -s ;# read .msg into the log,\n                    # and explain why I am reverting.\n------------------------------------------------\n\nI could have screwed up in any of the above steps, but in the worst\ncase I could just have done 'git checkout master' to start over.\nFortunately I did not have to; what I have in the current branch\n'revert-c99' is what I want.  So merge that back into 'master':\n\n------------------------------------------------\n$ git checkout master\n$ git resolve master revert-c99 fast ;# this should be a fast forward\nUpdating from 10d781b9caa4f71495c7b34963bef137216f86a8 to e3a693c...\n cache.h        |    8 ++++----\n commit.c       |    2 +-\n ls-files.c     |    2 +-\n receive-pack.c |    2 +-\n server-info.c  |    2 +-\n 5 files changed, 8 insertions(+), 8 deletions(-)\n------------------------------------------------\n\nThe 'fast' in the above 'git resolve' is not a magic.  I knew this\n'resolve' would result in a fast forward merge, and if not, there is\nsomething very wrong (so I would do 'git reset' on the 'master' branch\nand examine the situation).  When a fast forward merge is done, the\nmessage parameter to 'git resolve' is discarded, because no new commit\nis created.  You could have said 'junk' or 'nothing' there as well.\n\nThere is no need to redo the test at this point.  We fast forwarded\nand we know 'master' matches 'revert-c99' exactly.  In fact:\n\n------------------------------------------------\n$ git diff master..revert-c99\n------------------------------------------------\n\nsays nothing.\n\nThen we rebase the 'pu' branch as usual.\n\n------------------------------------------------\n$ git checkout pu\n$ git tag pu-anchor pu\n$ git rebase master\n* Applying: Redo \"revert\" using three-way merge machinery.\nFirst trying simple merge strategy to cherry-pick.\nFinished one cherry-pick.\n* Applying: Remove git-apply-patch-script.\nFirst trying simple merge strategy to cherry-pick.\nSimple cherry-pick fails; trying Automatic cherry-pick.\nRemoving Documentation/git-apply-patch-script.txt\nRemoving git-apply-patch-script\nFinished one cherry-pick.\n* Applying: Document \"git cherry-pick\" and \"git revert\"\nFirst trying simple merge strategy to cherry-pick.\nFinished one cherry-pick.\n* Applying: mailinfo and applymbox updates\nFirst trying simple merge strategy to cherry-pick.\nFinished one cherry-pick.\n* Applying: Show commits in topo order and name all commits.\nFirst trying simple merge strategy to cherry-pick.\nFinished one cherry-pick.\n* Applying: More documentation updates.\nFirst trying simple merge strategy to cherry-pick.\nFinished one cherry-pick.\n------------------------------------------------\n\nThe temporary tag 'pu-anchor' is me just being careful, in case 'git\nrebase' screws up.  After this, I can do these for sanity check:\n\n------------------------------------------------\n$ git diff pu-anchor..pu ;# make sure we got the master fix.\n$ make CC=gcc-2.95 clean test ;# make sure it fixed the breakage.\n$ make clean test ;# make sure it did not cause other breakage.\n------------------------------------------------\n\nEverything is in the good order.  I do not need the temporary branch\nnor tag anymore, so remove them:\n\n------------------------------------------------\n$ rm -f .git/refs/tags/pu-anchor .git/refs/heads/revert-c99\n------------------------------------------------\n\nIt was an emergency fix, so we might as well merge it into the\n'release candidate' branch, although I expect the next release would\nbe some days off:\n\n------------------------------------------------\n$ git checkout rc\n$ git pull . master\nPacking 0 objects\nUnpacking 0 objects\n\n* committish: e3a693c...\trefs/heads/master from .\nTrying to merge e3a693c... into 8c1f5f0... using 10d781b...\nCommitted merge 7fb9b7262a1d1e0a47bbfdcbbcf50ce0635d3f8f\n cache.h        |    8 ++++----\n commit.c       |    2 +-\n ls-files.c     |    2 +-\n receive-pack.c |    2 +-\n server-info.c  |    2 +-\n 5 files changed, 8 insertions(+), 8 deletions(-)\n------------------------------------------------\n\nAnd the final repository status looks like this:\n\n------------------------------------------------\n$ git show-branch --more=1 master pu rc\n! [master] Revert \"Replace zero-length array decls with [].\"\n ! [pu] git-repack-script: Add option to repack all objects.\n  * [rc] Merge refs/heads/master from . \n---\n +  [pu] git-repack-script: Add option to repack all objects.\n +  [pu~1] More documentation updates.\n +  [pu~2] Show commits in topo order and name all commits.\n +  [pu~3] mailinfo and applymbox updates\n +  [pu~4] Document \"git cherry-pick\" and \"git revert\"\n +  [pu~5] Remove git-apply-patch-script.\n +  [pu~6] Redo \"revert\" using three-way merge machinery.\n  + [rc] Merge refs/heads/master from . \n+++ [master] Revert \"Replace zero-length array decls with [].\"\n  + [rc~1] Merge refs/heads/master from . \n+++ [master~1] Merge refs/heads/portable from http://www.cs.berkeley....\n------------------------------------------------\n"}]}