Re: Re: [PATCH 1/3] checkout.c: add strict usage of -- before file_path
From: "Dannier Castro L"On 13/05/2018 00:03, Duy Nguyen wrote: On Sun, May 13, 2018 at 4:23 AM, Dannier Castro L wrote: For GIT new users, this complicated versatility of could be very confused, also considering that actually the flag '--' is completely useless (added or not, there is not any difference for this command), when the same program messages promote the use of this flag. I would like an option to revert back to current behavior. I'm not a new user. I know what I'm doing. Please don't make me type more. And '--" is not completely useless. If you have and with the same name, you have to give "--" to to tell git what the first argument means. Sure Duy, you're right, probably "completely useless" is not the correct definition, even according with the code I didn't find another useful case that is not file and branch with the same name. The program is able to know the type using only the name, turning "--" into an extra flag in most of cases. I think this solution could please you more: By default the configuration is the current, but the user has the chance to set this, for example: git config --global flag.strictdashdash true Thank you so much for the spent time reviewing the patch, this is my first one in this repository. It maybe that after review you could suggest an appropriate rewording or re-arrangement of the man page to better highlight the proper use of the '--' disambiguation. Perhaps frame the man page as if it is normal for the '--' to be included within command lines (which should be the case for scripts anyway!). Then indicate that it isn't mandatory if the file/branch/dwim distinction is obvious. i.e. make sure that the man page is educational as well as being a reference that may be misunderstood. Those well versed in the Git cli will normally omit the '--', only using it where necessary, however for a new users/readers of the man page, it may be better to be more explicit and avoid future misunderstandings. -- Philip
Re: Re: [PATCH 1/3] checkout.c: add strict usage of -- before file_path
> On 13/05/2018 00:03, Duy Nguyen wrote: > > > On Sun, May 13, 2018 at 4:23 AM, Dannier Castro L> > wrote: > >> For GIT new users, this complicated versatility of could > >> be very confused, also considering that actually the flag '--' is > >> completely useless (added or not, there is not any difference for > >> this command), when the same program messages promote the use of > >> this flag. > > I would like an option to revert back to current behavior. I'm not a > > new user. I know what I'm doing. Please don't make me type more. > > > > And '--" is not completely useless. If you have and > > with the same name, you have to give "--" to to tell git what the > > first argument means. > > Sure Duy, you're right, probably "completely useless" is not the correct > definition, No, "completely useless" is just plain wrong. > even according with the code I didn't find another useful > case that is not file and branch with the same name. The optional disambiguating doubledash is the standard way to erm, well, to disambiguate whatever there is to disambiguate. Not only refs and filenames, but also e.g. options and filenames: $ git checkout --option-looking-file error: unknown option `option-looking-file' usage: git checkout [] <...> $ git checkout -- --option-looking-file error: pathspec '--option-looking-file' did not match any file(s) known to git. Note that this is not at all specific to Git, many other programs support the optional disambiguating doubledash as well: $ touch --option-looking-file touch: unrecognized option '--option-looking-file' Try 'touch --help' for more information. $ touch -- --option-looking-file $ ls --option-looking-file ls: unrecognized option '--option-looking-file' Try 'ls --help' for more information. $ ls -- --option-looking-file --option-looking-file Please do not make it mandatory.
Re: Re: [PATCH 1/3] checkout.c: add strict usage of -- before file_path
On 13/05/2018 00:03, Duy Nguyen wrote: On Sun, May 13, 2018 at 4:23 AM, Dannier Castro Lwrote: For GIT new users, this complicated versatility of could be very confused, also considering that actually the flag '--' is completely useless (added or not, there is not any difference for this command), when the same program messages promote the use of this flag. I would like an option to revert back to current behavior. I'm not a new user. I know what I'm doing. Please don't make me type more. And '--" is not completely useless. If you have and with the same name, you have to give "--" to to tell git what the first argument means. Sure Duy, you're right, probably "completely useless" is not the correct definition, even according with the code I didn't find another useful case that is not file and branch with the same name. The program is able to know the type using only the name, turning "--" into an extra flag in most of cases. I think this solution could please you more: By default the configuration is the current, but the user has the chance to set this, for example: git config --global flag.strictdashdash true Thank you so much for the spent time reviewing the patch, this is my first one in this repository. -Dannier CL