{"thread":{"id":"8978","subject":"--ignore-invalid flag to git log et al.?","startedAt":"2007-07-11T07:29:50Z","lastAt":"2007-07-11T21:26:15Z","messageCount":4,"participants":["Paul Mackerras","Alex Riesen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"47008","messageId":"18068.34542.502048.222112@cargo.ozlabs.ibm.com","threadId":"8978","inReplyTo":null,"subject":"--ignore-invalid flag to git log et al.?","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2007-07-11T07:29:50Z","receivedAt":"2007-07-11T07:29:50Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Junio,\n\nWhat would you think about a --ignore-invalid flag for things like git\nrev-list and git log, to tell it to ignore any refs on the command\nline that are not valid objects?\n\nCurrently there is a buglet in gitk where if a user puts some sort of\nref on the command line, and then makes the ref invalid (e.g. by\ndeleting the ref if it is a head or tag, or doing a git prune if it is\na sha1 ID with no head/tag pointing to it), and then does \"Update\" in\ngitk, it will get an error because of the now-invalid ref.  (Yes, this\nis a bit of a corner case, but I have had a user point out this\nbehaviour to me.)  With a --ignore-invalid flag, gitk could use this\nwhen doing \"Update\" to avoid the error.\n\nAn alternative would be to have some way to validate refs.  I don't\nknow how to do that efficiently.  I think I would not want to have to\ndo a fork/exec for every ref that I wanted to check.\n\nThoughts?\n\nPaul.\n"},{"id":"47009","messageId":"81b0412b0707110046n5ec27328pab0ff33c183f79e@mail.gmail.com","threadId":"8978","inReplyTo":"18068.34542.502048.222112@cargo.ozlabs.ibm.com","subject":"Re: --ignore-invalid flag to git log et al.?","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-07-11T07:46:59Z","receivedAt":"2007-07-11T07:46:59Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On 7/11/07, Paul Mackerras <paulus@samba.org> wrote:\n> An alternative would be to have some way to validate refs.  I don't\n> know how to do that efficiently.  I think I would not want to have to\n> do a fork/exec for every ref that I wanted to check.\n\ngit rev-parse --revs-only ref1 ref2 ref3 ...?\n"},{"id":"47018","messageId":"18068.40404.772354.34192@cargo.ozlabs.ibm.com","threadId":"8978","inReplyTo":"81b0412b0707110046n5ec27328pab0ff33c183f79e@mail.gmail.com","subject":"Re: --ignore-invalid flag to git log et al.?","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2007-07-11T09:07:32Z","receivedAt":"2007-07-11T09:07:32Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Alex Riesen writes:\n\n> git rev-parse --revs-only ref1 ref2 ref3 ...?\n\nThat stops when it sees an invalid ref and doesn't check the rest.\nAlso if you give it a string of 40 hex digits it will print it out\nwhether it's a valid object ID or not.\n\nPaul.\n"},{"id":"47078","messageId":"7vvecq3a4o.fsf@assigned-by-dhcp.cox.net","threadId":"8978","inReplyTo":"18068.34542.502048.222112@cargo.ozlabs.ibm.com","subject":"Re: --ignore-invalid flag to git log et al.?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-07-11T21:26:15Z","receivedAt":"2007-07-11T21:26:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n> What would you think about a --ignore-invalid flag for things like git\n> rev-list and git log, to tell it to ignore any refs on the command\n> line that are not valid objects?\n>\n> Currently there is a buglet in gitk where if a user puts some sort of\n> ref on the command line, and then makes the ref invalid (e.g. by\n> deleting the ref if it is a head or tag, or doing a git prune if it is\n> a sha1 ID with no head/tag pointing to it), and then does \"Update\" in\n> gitk, it will get an error because of the now-invalid ref.  (Yes, this\n> is a bit of a corner case, but I have had a user point out this\n> behaviour to me.)  With a --ignore-invalid flag, gitk could use this\n> when doing \"Update\" to avoid the error.\n\nI suspect a much less corner case schenario is an old saved view\nwhere you used to care about \"master..experimental -- gitweb/\",\nbut now you are done with gitweb experiments and got rid of the\nbranch.  Then choosing that view would say \"experimental? what\nare you talking about?\".\n\nI wonder what the \"--ignore-invalid\" option should do.  If it\nsilently ignores, the command line to rev-list from the saved\nview would become \"^master -- gitweb\" and the user is left with\nemptiness without any indication of errors.  Is that a better\nbehaviour?  I would think not.  Giving results from a command\nthat is different from what the user thought is done without\ntelling the user is not very nice, so I think you would instead\nneed \"--error-on-invalid\".\n\n> An alternative would be to have some way to validate refs.  I don't\n> know how to do that efficiently.  I think I would not want to have to\n> do a fork/exec for every ref that I wanted to check.\n\nIs it a possibility to let the rev-list do its job when there is\nno error, but catch the error if it does not understand the\ncommand line, because of a revision that is now made invalid,\nand then in the error path validate the revs one by one?  At\nthat point in the error path you do not particularly care about\nthe efficiency I would think.\n"}]}