{"thread":{"id":"51225","subject":"[Proposal] git am --check","startedAt":"2019-06-02T17:37:03Z","lastAt":"2019-06-03T18:16:27Z","messageCount":4,"participants":["Drew DeVault","Christian Couder","Duy Nguyen","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"376553","messageId":"BUJFK0ZEKP5I.16DDFWUTXGJTE@homura","threadId":"51225","inReplyTo":null,"subject":"[Proposal] git am --check","fromName":"Drew DeVault","fromEmail":"sir@cmpwn.com","sentAt":"2019-06-02T17:37:00Z","receivedAt":"2019-06-02T17:37:03Z","isPatch":false,"sender":{"key":"sir@cmpwn.com","avatar":"https://avatars.githubusercontent.com/u/1310872?v=4"},"body":"This flag would behave similarly to git apply --check, or in other words\nwould exit with a nonzero status if the patch is not applicable without\nactually applying the patch otherwise.\n\nRationale: I'm working on an email client which has some git\nintegration, and when you scroll over a patch I want to quickly test its\napplicability and show an indication of the result.\n\nThoughts on the approach are welcome; my initial naive patch just tried\nto add --check to the apply flags but that didn't work as I had hoped.\nWill take another crack at a patch soon(ish).\n"},{"id":"376558","messageId":"CAP8UFD1W_tB34N-uAA85+QkHY6kmGWYYM47zceP3=5aTwxwvnQ@mail.gmail.com","threadId":"51225","inReplyTo":"BUJFK0ZEKP5I.16DDFWUTXGJTE@homura","subject":"Re: [Proposal] git am --check","fromName":"Christian Couder","fromEmail":"christian.couder@gmail.com","sentAt":"2019-06-03T09:28:23Z","receivedAt":"2019-06-03T09:28:38Z","isPatch":false,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"On Sun, Jun 2, 2019 at 7:38 PM Drew DeVault <sir@cmpwn.com> wrote:\n>\n> This flag would behave similarly to git apply --check, or in other words\n> would exit with a nonzero status if the patch is not applicable without\n> actually applying the patch otherwise.\n\n`git am` uses the same code as `git apply` to apply patches, so there\nshould be no difference between `git am --check` and `git apply\n--check`.\n\n> Rationale: I'm working on an email client which has some git\n> integration, and when you scroll over a patch I want to quickly test its\n> applicability and show an indication of the result.\n>\n> Thoughts on the approach are welcome; my initial naive patch just tried\n> to add --check to the apply flags but that didn't work as I had hoped.\n> Will take another crack at a patch soon(ish).\n\nCould you tell us about what didn't work as you hoped? And how `git am\n--check` would be different from `git apply --check`?\n"},{"id":"376559","messageId":"CACsJy8CUGfUwi15+ggOgRT4xotCkJVhGtCrjMa=4pdnDq25f4A@mail.gmail.com","threadId":"51225","inReplyTo":"CAP8UFD1W_tB34N-uAA85+QkHY6kmGWYYM47zceP3=5aTwxwvnQ@mail.gmail.com","subject":"Re: [Proposal] git am --check","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2019-06-03T09:35:01Z","receivedAt":"2019-06-03T09:35:30Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Mon, Jun 3, 2019 at 4:29 PM Christian Couder\n<christian.couder@gmail.com> wrote:\n>\n> On Sun, Jun 2, 2019 at 7:38 PM Drew DeVault <sir@cmpwn.com> wrote:\n> >\n> > This flag would behave similarly to git apply --check, or in other words\n> > would exit with a nonzero status if the patch is not applicable without\n> > actually applying the patch otherwise.\n>\n> `git am` uses the same code as `git apply` to apply patches, so there\n> should be no difference between `git am --check` and `git apply\n> --check`.\n\nOne difference (that still annoys me) is \"git apply\" must be run at\ntopdir. \"git am\" can be run anywhere and it will automatically find\ntopdir.\n\n\"git am\" can also consume multiple patches, so it's some extra work if\nwe just use \"git apply\" directly, although I don't think that's a very\ngood argument for \"am --check\".\n-- \nDuy\n"},{"id":"376595","messageId":"xmqqblzev8jw.fsf@gitster-ct.c.googlers.com","threadId":"51225","inReplyTo":"CACsJy8CUGfUwi15+ggOgRT4xotCkJVhGtCrjMa=4pdnDq25f4A@mail.gmail.com","subject":"Re: [Proposal] git am --check","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-06-03T18:16:19Z","receivedAt":"2019-06-03T18:16:27Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> On Mon, Jun 3, 2019 at 4:29 PM Christian Couder\n> <christian.couder@gmail.com> wrote:\n>>\n>> On Sun, Jun 2, 2019 at 7:38 PM Drew DeVault <sir@cmpwn.com> wrote:\n>> >\n>> > This flag would behave similarly to git apply --check, or in other words\n>> > would exit with a nonzero status if the patch is not applicable without\n>> > actually applying the patch otherwise.\n>>\n>> `git am` uses the same code as `git apply` to apply patches, so there\n>> should be no difference between `git am --check` and `git apply\n>> --check`.\n>\n> One difference (that still annoys me) is \"git apply\" must be run at\n> topdir. \"git am\" can be run anywhere and it will automatically find\n> topdir.\n>\n> \"git am\" can also consume multiple patches, so it's some extra work if\n> we just use \"git apply\" directly, although I don't think that's a very\n> good argument for \"am --check\".\n\nAnother is that \"am\" has preprocessing phase performed by mailsplit\nthat deals with MIME garbage, which \"apply\" will totally choke on\nwithout even attempting to cope with.\n\nI haven't carefully read the \"proposal\" or any rfc patches yet, but\nwould/should the command make a commit if the patch cleanly applies?\n\nI wonder if a \"--dry-run\" option is more useful (i.e. checks and\nreports with the exit status *if* the command without \"--dry-run\"\nwould cleanly succeed, but never makes a commit or touches the index\nor the working tree), given the motivating use case is a Git aware\nMUA that helps the user by saying \"if you are busy you could perhaps\nskip this message as the patch would not apply to your tree anyway\".\n"}]}