{"thread":{"id":"32001","subject":"bisect: \"Needed a single revision\" message is confusing","startedAt":"2012-11-02T13:23:15Z","lastAt":"2012-11-02T14:10:27Z","messageCount":2,"participants":["Daniel Bonniot","Michael J Gruber"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"202419","messageId":"CAO5QaZkZYxvSYoAQGgrrH1ULM8rnwX5=0Ln-_zfh8OwdegNNoA@mail.gmail.com","threadId":"32001","inReplyTo":null,"subject":"bisect: \"Needed a single revision\" message is confusing","fromName":"Daniel Bonniot","fromEmail":"bonniot@gmail.com","sentAt":"2012-11-02T13:23:15Z","receivedAt":"2012-11-02T13:23:15Z","isPatch":false,"sender":{"key":"bonniot@gmail.com","avatar":null},"body":"Hi,\n\nSuppose I'm doing a git bisect, say:\n\n$ git bisect good 8c7a786b6c8eae8eac91083cdc9a6e337bc133b0\n\nThat works fine. The sha1 could also be a substring, as long as it's\nunambiguous, e.g.:\n\n$ git bisect good 8c7a786b6c\n\nNow if it's ambiguous, I get an error message:\n\n$ git bisect good 8\nfatal: Needed a single revision\nBad rev input: 8\n\nAll fine and good. But what if I somehow input a non-existing sha1 (in\nmy case see [1]), e,g:\n\n$ git bisect good 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1\nfatal: Needed a single revision\nBad rev input: 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1\n\nI understand that technically both \"no revision\" and \"multiple\nrevisions\" qualify as \"not a single revision\", but they correspond to\nquite different situations. I think it would be more helpful to get\ndifferent error messages, something like:\n\nBad rev input: 8 refers to multiple revisions\nBad rev input: 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1 does not refer\nto a valid revision\n\n(and avoid outputing the \"fatal: Needed a single revision\" message).\n\nIs this a good idea? Anybody can think of better error messages?\n\nI'm not familiar with the code base at all, but I could give a try at\nimplementing it, unless it's trivial enough that someone does it\nearlier. After a quick look, it looks like either git-bisect itself or\nrev-parse would need to be touched, any pointers and hints welcome.\n\nCheers,\n\nDaniel\n\n[1] if you want to know, I got a sha1 from one repository and used it\nin another, which probably should work, except that when using git-svn\nthey don't. And the \"single revision\" error message lead me on a\ntangent.\n"},{"id":"202425","messageId":"5093D453.3050907@drmicha.warpmail.net","threadId":"32001","inReplyTo":"CAO5QaZkZYxvSYoAQGgrrH1ULM8rnwX5=0Ln-_zfh8OwdegNNoA@mail.gmail.com","subject":"Re: bisect: \"Needed a single revision\" message is confusing","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2012-11-02T14:10:27Z","receivedAt":"2012-11-02T14:10:27Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Daniel Bonniot venit, vidit, dixit 02.11.2012 14:23:\n> Hi,\n> \n> Suppose I'm doing a git bisect, say:\n> \n> $ git bisect good 8c7a786b6c8eae8eac91083cdc9a6e337bc133b0\n> \n> That works fine. The sha1 could also be a substring, as long as it's\n> unambiguous, e.g.:\n> \n> $ git bisect good 8c7a786b6c\n> \n> Now if it's ambiguous, I get an error message:\n> \n> $ git bisect good 8\n> fatal: Needed a single revision\n> Bad rev input: 8\n> \n> All fine and good. But what if I somehow input a non-existing sha1 (in\n> my case see [1]), e,g:\n> \n> $ git bisect good 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1\n> fatal: Needed a single revision\n> Bad rev input: 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1\n> \n> I understand that technically both \"no revision\" and \"multiple\n> revisions\" qualify as \"not a single revision\", but they correspond to\n> quite different situations. I think it would be more helpful to get\n> different error messages, something like:\n> \n> Bad rev input: 8 refers to multiple revisions\n> Bad rev input: 8c7a786b6c8eae8eac91083cdc9a6e337bc133b1 does not refer\n> to a valid revision\n> \n> (and avoid outputing the \"fatal: Needed a single revision\" message).\n> \n> Is this a good idea? Anybody can think of better error messages?\n> \n> I'm not familiar with the code base at all, but I could give a try at\n> implementing it, unless it's trivial enough that someone does it\n> earlier. After a quick look, it looks like either git-bisect itself or\n> rev-parse would need to be touched, any pointers and hints welcome.\n> \n> Cheers,\n> \n> Daniel\n> \n> [1] if you want to know, I got a sha1 from one repository and used it\n> in another, which probably should work, except that when using git-svn\n> they don't. And the \"single revision\" error message lead me on a\n> tangent.\n> \n\nThe error comes from rev-parse, which is called by bisect. The problem\nis that\n\ngit rev-parse deadbeef\ngit rev-parse --verify deadbeef\n\ngive two very different error messages (if there's no dead beef there),\nand that \"git ref-parse --verify\" gives the same error message for\nnon-existing as for ambiguous revs.\n\nThere are 3 places in builtins/rev-parse.c which call\ndie_no_single_rev(), and at least some of them should probably choose\nthe error message more carefully.\n\nCheers,\nMichael\n"}]}