{"thread":{"id":"38382","subject":"Regarding the determinacy of 'git describe'","startedAt":"2015-01-16T13:01:13Z","lastAt":"2015-01-19T16:10:18Z","messageCount":3,"participants":["Andreas Krey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"254815","messageId":"20150116130113.GA3220@inner.h.apk.li","threadId":"38382","inReplyTo":null,"subject":"Regarding the determinacy of 'git describe'","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2015-01-16T13:01:13Z","receivedAt":"2015-01-16T13:01:13Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"Hi all again,\n\ntoday another expectation crumbled.\n\nI expected the algo of 'git describe' to be deterministic,\nbut it happens to return different tags in structurally\nidentical repositories. These are generated on each run\nof a test (and obviously have different dates and thus\ncommit IDs), and 'git describe' doesn't return the same\ntags in all of them.\n\nIs that expected behaviour?\n\nThe repos each look like\n(commit id and parents truncated to three chars):\n\n538 26d 8f5         (HEAD, origin/r2.4/feature-2, r2.4/feature-2) Merge branch 'r2.4/master' into r2.4/feature-2\n    26d         20c feature: 1st part\n        8f5 ac6     (origin/r2.4/master, origin/HEAD, r2.4/master) main: 3rd commit\n            ac6 20c (tag: r2.4/bl-1) main: 2nd commit\n                20c (tag: r2.4/bl-0, origin/sidestep) module: initial\n\nSo HEAD is two hops away from both tags (bl-0 via 26d and bl-1 via 8f5),\nbut for one I'd hoped that it always pick bl-1, and especially I'd expect\nit to be consistent for a given structure).\n\nAndreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"254816","messageId":"20150116132917.GB7660@inner.h.apk.li","threadId":"38382","inReplyTo":"20150116130113.GA3220@inner.h.apk.li","subject":"Re: Regarding the determinacy of 'git describe'","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2015-01-16T13:29:17Z","receivedAt":"2015-01-16T13:29:17Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"To follow up on myself, this is the output of 'git describe --debug\n--tags' and 'git log --oneline --decor --parents' for each of the\ntwo repos.\n\nThe one irritating thing is that in two of them the inital commit is\nnot the bottommost in the log output.\n\nTo make my expectation more concrete: I would expect 'git describe'\nto output the tag where the number of commits that are in HEAD but not\nin the tag is the lowest, and that would (always) be the bl-1 here.\n\n\n=== /tmp/tmp-ws-20150116-11061-169bt1w\n\nsearching to describe HEAD\n lightweight        3 r2.4/bl-1\n lightweight        4 r2.4/bl-0\ntraversed 5 commits\nr2.4/bl-1-3-gd760b4b\n\nd760b4b 6e15dfc d905814 (HEAD, origin/r2.4/feature-2, r2.4/feature-2) Merge branch 'r2.4/master' into r2.4/feature-2\n6e15dfc ad4e371 feature: 1st part\nd905814 86f7fcf (origin/r2.4/master, origin/HEAD, r2.4/master) main: 3rd commit\n86f7fcf ad4e371 (tag: r2.4/bl-1) main: 2nd commit\nad4e371 (tag: r2.4/bl-0, origin/sidestep) module: initial\n\n=== /tmp/tmp-ws-20150116-11355-v7zfcc\n\nsearching to describe HEAD\n lightweight        4 r2.4/bl-0\n lightweight        4 r2.4/bl-1\ntraversed 5 commits\nr2.4/bl-0-4-g689e350\n\n689e350 93d9eb5 d768596 (HEAD, origin/r2.4/feature-2, r2.4/feature-2) Merge branch 'r2.4/master' into r2.4/feature-2\n93d9eb5 e17d86b feature: 1st part\nd768596 6e35c9c (origin/r2.4/master, origin/HEAD, r2.4/master) main: 3rd commit\ne17d86b (tag: r2.4/bl-0, origin/sidestep) module: initial\n6e35c9c e17d86b (tag: r2.4/bl-1) main: 2nd commit\n\nAndreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"},{"id":"254900","messageId":"20150119161018.GA12632@inner.h.apk.li","threadId":"38382","inReplyTo":"20150116132917.GB7660@inner.h.apk.li","subject":"Re: Regarding the determinacy of 'git describe'","fromName":"Andreas Krey","fromEmail":"a.krey@gmx.de","sentAt":"2015-01-19T16:10:18Z","receivedAt":"2015-01-19T16:10:18Z","isPatch":false,"sender":{"key":"a.krey@gmx.de","avatar":"https://avatars.githubusercontent.com/u/37810?v=4"},"body":"On Fri, 16 Jan 2015 14:29:17 +0000, Andreas Krey wrote:\n...\n> === /tmp/tmp-ws-20150116-11355-v7zfcc\n> \n> searching to describe HEAD\n>  lightweight        4 r2.4/bl-0\n>  lightweight        4 r2.4/bl-1\n> traversed 5 commits\n> r2.4/bl-0-4-g689e350\n\nApparently, this comes because two of the commit have the same timestamp,\naffecting the log ordering (and presumably the order in which they\nare used by 'git describe' as well). Also explains why it happens with\ndifferent probability on different machines.\n\nBut should 'git describe' behave this way?\n\nAndreas\n\n-- \n\"Totally trivial. Famous last words.\"\nFrom: Linus Torvalds <torvalds@*.org>\nDate: Fri, 22 Jan 2010 07:29:21 -0800\n"}]}