Re: [PATCH] stash: Add stash.showFlag config variable
Hi, On Sat, Aug 29, 2015 at 3:10 AM, Junio C Hamano gits...@pobox.com wrote: Namhyung Kim namhy...@gmail.com writes: Perhaps a pair of new booleans - stash.showStat (defaults to true but you can turn it off) - stash.showPatch (defaults to false but you can turn it on) or something along that line might be sufficient and more palatable. Hmm.. I agree with you, but I don't know what we should do if both of the options were off. Just run 'git diff' with no option is ok to you? If the user does not want stat or patch, then not running anything would be more appropriate, don't you think? Ah, ok. :) I'll change that way and send v3 soon! Thanks, Namhyung -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3] stash: Add two config variables for stash show
Some users might want to see diff (patch) output always rather than diffstat when [s]he runs 'git stash show'. Although this can be done with adding -p option, it'd be better to provide a config option to control this behavior IMHO. This patch adds two variables which control to show diffstat and patch output respectively. The stash.showStat is for diffstat and default is true. The stat.showPatch is for the patch output and default is false. Signed-off-by: Namhyung Kim namhy...@gmail.com --- Documentation/config.txt| 10 ++ Documentation/git-stash.txt | 2 ++ git-stash.sh| 20 +++- 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index f5d15ff..b4c8ee1 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2567,6 +2567,16 @@ status.submoduleSummary:: submodule summary' command, which shows a similar output but does not honor these settings. +stash.showPatch:: + If this is set to true, the `git stash show` command without an + option will show the stash in patch form. Defaults to false. + See description of 'show' command in linkgit:git-stash[1]. + +stash.showStat:: + If this is set to true, the `git stash show` command without an + option will show diffstat of the stash. Defaults to true. + See description of 'show' command in linkgit:git-stash[1]. + submodule.name.path:: submodule.name.url:: The path within this project and URL for a submodule. These diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 375213f..92df596 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -95,6 +95,8 @@ show [stash]:: shows the latest one. By default, the command shows the diffstat, but it will accept any format known to 'git diff' (e.g., `git stash show -p stash@{1}` to view the second most recent stash in patch form). + You can use stash.showStat and/or stash.showPatch config variables + to change the default behavior. pop [--index] [-q|--quiet] [stash]:: diff --git a/git-stash.sh b/git-stash.sh index 1d5ba7a..c7c65e2 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -305,7 +305,25 @@ show_stash () { ALLOW_UNKNOWN_FLAGS=t assert_stash_like $@ - git diff ${FLAGS:---stat} $b_commit $w_commit + if test -z $FLAGS + then + if test $(git config --bool stash.showStat || echo true) = true + then + FLAGS=--stat + fi + + if test $(git config --bool stash.showPatch || echo false) = true + then + FLAGS=${FLAGS}${FLAGS:+ }-p + fi + + if test -z $FLAGS + then + return 0 + fi + fi + + git diff ${FLAGS} $b_commit $w_commit } show_help () { -- 2.5.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] stash: Add stash.showFlag config variable
Some users might want to see diff (patch) output always rather than diffstat when [s]he runs 'git stash show'. Although this can be done with adding -p option, it'd be better to provide a config option to control this behavior IMHO. Signed-off-by: Namhyung Kim namhy...@gmail.com --- Documentation/config.txt| 5 + Documentation/git-stash.txt | 1 + git-stash.sh| 8 +++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index f5d15ff..bbadae6 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2567,6 +2567,11 @@ status.submoduleSummary:: submodule summary' command, which shows a similar output but does not honor these settings. +stash.showFlag:: + The default option to pass to `git stash show` when no option is + given. The default is '--stat'. See description of 'show' command + in linkgit:git-stash[1]. + submodule.name.path:: submodule.name.url:: The path within this project and URL for a submodule. These diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 375213f..e00f67e 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -95,6 +95,7 @@ show [stash]:: shows the latest one. By default, the command shows the diffstat, but it will accept any format known to 'git diff' (e.g., `git stash show -p stash@{1}` to view the second most recent stash in patch form). + You can use stash.showflag config variable to change this behavior. pop [--index] [-q|--quiet] [stash]:: diff --git a/git-stash.sh b/git-stash.sh index 1d5ba7a..8432435 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -33,6 +33,12 @@ else reset_color= fi +if git config --get stash.showflag /dev/null 2 /dev/null; then + show_flag=$(git config --get stash.showflag) +else + show_flag=--stat +fi + no_changes () { git diff-index --quiet --cached HEAD --ignore-submodules -- git diff-files --quiet --ignore-submodules @@ -305,7 +311,7 @@ show_stash () { ALLOW_UNKNOWN_FLAGS=t assert_stash_like $@ - git diff ${FLAGS:---stat} $b_commit $w_commit + git diff ${FLAGS:-${show_flag}} $b_commit $w_commit } show_help () { -- 2.5.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] stash: Add stash.showFlag config variable
Hi, On Fri, Aug 28, 2015 at 12:20 AM, SZEDER Gábor sze...@ira.uka.de wrote: Hi, I haven't made up my mind about this feature yet, but have a few comments about its implementation. Thanks for taking your time! diff --git a/git-stash.sh b/git-stash.sh index 1d5ba7a..8432435 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -33,6 +33,12 @@ else reset_color= fi +if git config --get stash.showflag /dev/null 2 /dev/null; then + show_flag=$(git config --get stash.showflag) +else + show_flag=--stat +fi + Forking and executing processes are costly on some important platforms we care about, so we should strive to avoid them whenever possible. - This hunk runs the the exact same 'git config' command twice. Run it only once, perhaps something like this: show_flag=$(git config --get stash.showflag || echo --stat) (I hope there are no obscure crazy 'echo' implemtations out there that might barf on the unknown option '--stat'...) What about `echo --stat` then? - It runs 'git config' in the main code path, i.e. even for subcommands other than 'show'. Run it only for 'git stash show'. - This config setting is not relevant if there were options given on the command line. Run it only if there are no options given, i.e. when $FLAGS is empty. Fair enough. I'll resend v2. Thanks, Namhyung no_changes () { git diff-index --quiet --cached HEAD --ignore-submodules -- git diff-files --quiet --ignore-submodules @@ -305,7 +311,7 @@ show_stash () { ALLOW_UNKNOWN_FLAGS=t assert_stash_like $@ - git diff ${FLAGS:---stat} $b_commit $w_commit + git diff ${FLAGS:-${show_flag}} $b_commit $w_commit } show_help () { -- 2.5.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] stash: Add stash.showFlag config variable
Some users might want to see diff (patch) output always rather than diffstat when [s]he runs 'git stash show'. Although this can be done with adding -p option, it'd be better to provide a config option to control this behavior IMHO. Signed-off-by: Namhyung Kim namhy...@gmail.com --- Documentation/config.txt| 5 + Documentation/git-stash.txt | 1 + git-stash.sh| 7 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index f5d15ff..bbadae6 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2567,6 +2567,11 @@ status.submoduleSummary:: submodule summary' command, which shows a similar output but does not honor these settings. +stash.showFlag:: + The default option to pass to `git stash show` when no option is + given. The default is '--stat'. See description of 'show' command + in linkgit:git-stash[1]. + submodule.name.path:: submodule.name.url:: The path within this project and URL for a submodule. These diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 375213f..e00f67e 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -95,6 +95,7 @@ show [stash]:: shows the latest one. By default, the command shows the diffstat, but it will accept any format known to 'git diff' (e.g., `git stash show -p stash@{1}` to view the second most recent stash in patch form). + You can use stash.showflag config variable to change this behavior. pop [--index] [-q|--quiet] [stash]:: diff --git a/git-stash.sh b/git-stash.sh index 1d5ba7a..f48a97d 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -305,7 +305,12 @@ show_stash () { ALLOW_UNKNOWN_FLAGS=t assert_stash_like $@ - git diff ${FLAGS:---stat} $b_commit $w_commit + if test -z $FLAGS + then + show_flag=$(git config --get stash.showFlag || echo --stat) + fi + + git diff ${FLAGS:-${show_flag}} $b_commit $w_commit } show_help () { -- 2.5.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2.1] stash: Add stash.showFlag config variable
Some users might want to see diff (patch) output always rather than diffstat when [s]he runs 'git stash show'. Although this can be done with adding -p option, it'd be better to provide a config option to control this behavior IMHO. Signed-off-by: Namhyung Kim namhy...@gmail.com --- Documentation/config.txt| 5 + Documentation/git-stash.txt | 1 + git-stash.sh| 7 ++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Documentation/config.txt b/Documentation/config.txt index f5d15ff..bbadae6 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -2567,6 +2567,11 @@ status.submoduleSummary:: submodule summary' command, which shows a similar output but does not honor these settings. +stash.showFlag:: + The default option to pass to `git stash show` when no option is + given. The default is '--stat'. See description of 'show' command + in linkgit:git-stash[1]. + submodule.name.path:: submodule.name.url:: The path within this project and URL for a submodule. These diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt index 375213f..e00f67e 100644 --- a/Documentation/git-stash.txt +++ b/Documentation/git-stash.txt @@ -95,6 +95,7 @@ show [stash]:: shows the latest one. By default, the command shows the diffstat, but it will accept any format known to 'git diff' (e.g., `git stash show -p stash@{1}` to view the second most recent stash in patch form). + You can use stash.showflag config variable to change this behavior. pop [--index] [-q|--quiet] [stash]:: diff --git a/git-stash.sh b/git-stash.sh index 1d5ba7a..992fb02 100755 --- a/git-stash.sh +++ b/git-stash.sh @@ -305,7 +305,12 @@ show_stash () { ALLOW_UNKNOWN_FLAGS=t assert_stash_like $@ - git diff ${FLAGS:---stat} $b_commit $w_commit + if test -z $FLAGS + then + FLAGS=$(git config --get stash.showFlag || echo --stat) + fi + + git diff ${FLAGS} $b_commit $w_commit } show_help () { -- 2.5.0 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] stash: Add stash.showFlag config variable
Hi, On Thu, Aug 27, 2015 at 08:16:35PM -0400, Eric Sunshine wrote: On Thu, Aug 27, 2015 at 11:36 AM, Namhyung Kim namhy...@gmail.com wrote: On Fri, Aug 28, 2015 at 12:20 AM, SZEDER Gábor sze...@ira.uka.de wrote: - This hunk runs the the exact same 'git config' command twice. Run it only once, perhaps something like this: show_flag=$(git config --get stash.showflag || echo --stat) (I hope there are no obscure crazy 'echo' implemtations out there that might barf on the unknown option '--stat'...) What about `echo --stat` then? Adding quotes around --stat won't buy you anything since the shell will have removed the quotes by the time the argument is passed to echo, so an obscure crazy 'echo' will still see --stat as an option. POSIX states that printf should take no options, so: printf --stat should be safe, but some implementations do process options (and will complain about the unknown --stat option), therefore, best would be: printf '%s' --stat That's good to know. I'll change it that way. Thanks for your review! Namhyung -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] stash: Add stash.showFlag config variable
Hi, On Thu, Aug 27, 2015 at 06:08:39PM -0700, Junio C Hamano wrote: Namhyung Kim namhy...@gmail.com writes: +stash.showFlag:: + The default option to pass to `git stash show` when no option is + given. The default is '--stat'. See description of 'show' command + in linkgit:git-stash[1]. Doesn't the same discussion in $gmane/275752 apply here? By designing the configuration variable in a sloppy way, this change will force us to spawn git diff via the shell forever, even after somebody ports git stash to C. Which is not great. I see. Perhaps a pair of new booleans - stash.showStat (defaults to true but you can turn it off) - stash.showPatch (defaults to false but you can turn it on) or something along that line might be sufficient and more palatable. Hmm.. I agree with you, but I don't know what we should do if both of the options were off. Just run 'git diff' with no option is ok to you? I dunno. :) [Footnote] *1* Besides, showFlag is a strange configuration variable name. I thought that by setting it to true, you are making git stash command to somehow show some kind of a flag when it does its operation ;-). I admit that it's a bad name. My naming sense is always horrible.. ;-p Thanks for the review! Namhyung -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] send-email: Fix documentation of --signed-off-by-cc option
From: Namhyung Kim namhyung@lge.com The man page says it'll control the Cc: lines being added also, but this is not true. Reported-by: Minchan Kim minc...@kernel.org Signed-off-by: Namhyung Kim namhyung@lge.com --- Documentation/git-send-email.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt index 40a9a9a..5694d98 100644 --- a/Documentation/git-send-email.txt +++ b/Documentation/git-send-email.txt @@ -238,7 +238,7 @@ Automating the value of 'sendemail.identity'. --[no-]signed-off-by-cc:: - If this is set, add emails found in Signed-off-by: or Cc: lines to the + If this is set, add emails found in Signed-off-by: lines to the cc list. Default is the value of 'sendemail.signedoffbycc' configuration value; if that is unspecified, default to --signed-off-by-cc. -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] name-rev: Allow to omit refs/tags/ part in --refs option when --tags used
Hi Junio, 2013-06-18 AM 12:27, Junio C Hamano wrote: Namhyung Kim namhyung@lge.com writes: In its current form, when an user wants to filter specific ref using --refs option, she needs to give something like --refs=refs/tags/v1.*. This is not intuitive as users might think it's enough to give just actual tag name part like --refs=v1.*. I do not think Users might think is not particularly a good justification, but I agree that it would be useful to allow --refs=v1.\* to match refs/heads/v1.4-maint and refs/tags/v1.4.0; it is easy for the users to disambiguate with longer prefix if they wanted to. Right. I just failed to find right words. :) It applies to refs other than just tags too. Change it for users to be able to use --refs=sth or --refs=remotes/sth. Also remove the leading 'tags/' part in the output when --tags option was given since the option restricts to work with tags only. This part is questionable, as it changes the output people's scripts have been reading from the command since eternity ago. True. If the pattern asks to match with v1.* (not tags/v1.* or refs/tags/v1.*) and you find refs/tags/v1.*, it might be acceptable to strip refs/tags/ part. Existing users are _expected_ to feed a pattern with full refname starting with refs/, so they will not be negatively affected by such a usability enhancement on the output side. This is what I wanted to do exactly. :) diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 6238247..446743b 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -97,7 +97,8 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void if (data-tags_only prefixcmp(path, refs/tags/)) return 0; - if (data-ref_filter fnmatch(data-ref_filter, path, 0)) + if (data-ref_filter !prefixcmp(data-ref_filter, refs/) +fnmatch(data-ref_filter, path, 0)) return 0; What does this mean? When --refs is specified, if it begins with refs/ then do not show unmatching path, but let any path be subject to the following if --refs does not begin with refs/ sounds like a broken logic, unless you add another fnmatch() later in the codepath to compensate. And you indeed do so, but then at that point, do we still need this if(...) return 0 at all? I think it can and should be improved here, and then the one in the main logic you added can be removed. Wouldn't it make more sense to see if the given pattern matches a tail substring of the ref, instead of using the hardcoded strip refs/heads/, refs/tags or refs/, and then match once logic? That way, --refs=origin/* can find refs/remotes/origin/master by running fnmatch of origin/* against its substrings, i.e. refs/remotes/origin/master remotes/origin/master origin/master and find that the pattern matches it. Perhaps it is just the matter of adding something like: static int subpath_matches(const char *path, const char *filter) { const char *subpath = path; while (subpath) { if (!fnmatch(data-ref_filter, subpath, 0)) return subpath - path; subpath = strchr(path, '/'); subpath if (subpath) subpath++; } return -1; } and then at the beginning of name_ref() do this: int can_abbreviate_output = data-name_only; if (data-tags_only prefixcmp(path, refs/tags/)) return 0; if (data-ref_filter) { switch (subpath_matches(path, data-ref_filter)) { case -1: /* did not match */ return 0; default: /* matched subpath */ can_abbreviate_output = 1; break; case 0: /* matched fully */ break; } } The logic before calling name_rev() will be kept as only decide how the output looks like, without mixing the unrelated decide if we want to use it logic in. Looks good to me with the little change above! I'll resend v2 with changes in this and your other reply. Thanks, Namhyung -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] name-rev: Allow to omit refs/tags/ part in --refs option when --tags used
2013-06-18 AM 12:53, Junio C Hamano wrote: Junio C Hamano gits...@pobox.com writes: Wouldn't it make more sense to see if the given pattern matches a tail substring of the ref, instead of using the hardcoded strip refs/heads/, refs/tags or refs/, and then match once logic? That way, --refs=origin/* can find refs/remotes/origin/master by running fnmatch of origin/* against its substrings, i.e. refs/remotes/origin/master remotes/origin/master origin/master and find that the pattern matches it. Perhaps it is just the matter of adding something like: ... and then at the beginning of name_ref() do this: int can_abbreviate_output = data-name_only; if (data-tags_only prefixcmp(path, refs/tags/)) return 0; if (data-ref_filter) { switch (subpath_matches(path, data-ref_filter)) { case -1: /* did not match */ return 0; default: /* matched subpath */ can_abbreviate_output = 1; break; case 0: /* matched fully */ break; } } The logic before calling name_rev() will be kept as only decide how the output looks like, without mixing the unrelated decide if we want to use it logic in. ... which may make the call name_rev with this abbreviated path logic look something like this: if (o o-type == OBJ_COMMIT) { if (can_abbreviate_output) path = shorten_unambiguous_ref(path, 0); else if (!prefixcmp(path, refs/heads/)) path = path + 11; else if (data-tags_only data-name_only !prefixcmp(path, refs/tags/)) path = path + 10; else if (!prefixcmp(path, refs/)) path = path + 5; name_rev((struct commit *) o, xstrdup(path), 0, 0, deref); } Hmm.. I thought about it twice. This will affects the output of `--name-only --refs=refs/remotes/origin/*` case. (AFAIK it only affected to tags so far) As the name_only always sets can_abbreviate_output, it'll shorten the name of remote ref even if it's fully matched. $ ./git name-rev --refs=refs/remotes/origin/* a2055c2 a2055c2 remotes/origin/maint~642 $ ./git name-rev --refs=refs/remotes/origin/* --name-only a2055c2 origin/maint~642 I think it should be 'data-tags_only data-name_only' for compatibility reason. I also see that the 3rd condition of 'tags_only name_only' turned out to be useless for the similar reason. When name_only set, it'll take the first case so 3rd case cannot be reached. When it's not set it cannot take the third case too obviously. So I'll just remove it. Thanks, Namhyung -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2] name-rev: Allow to specify a subpath for --refs option
From: Namhyung Kim namhyung@lge.com In its current form, when an user wants to filter specific ref using --refs option, she needs to give something like --refs=refs/tags/v1.*. It'd be convenient providing a way to specify a subpath of ref pattern. For example, --refs=origin/* can find refs/remotes/origin/master by searching the pattern against its substrings in turn: refs/remotes/origin/master remotes/origin/master origin/master If it finds a match in a subpath, unambigous part of the ref path will be removed in the output. Many thanks to Junio C. Hamano for suggesting better logic and code. Signed-off-by: Namhyung Kim namhyung@lge.com --- Documentation/git-name-rev.txt | 3 ++- builtin/name-rev.c | 36 +--- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Documentation/git-name-rev.txt b/Documentation/git-name-rev.txt index ad1d146..6b0f1ba 100644 --- a/Documentation/git-name-rev.txt +++ b/Documentation/git-name-rev.txt @@ -25,7 +25,8 @@ OPTIONS Do not use branch names, but only tags to name the commits --refs=pattern:: - Only use refs whose names match a given shell pattern. + Only use refs whose names match a given shell pattern. The pattern + can be one of branch name, tag name or fully qualified ref name. --all:: List all commits reachable from all refs diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 6238247..87d4854 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -82,6 +82,20 @@ copy_data: } } +static int subpath_matches(const char *path, const char *filter) +{ + const char *subpath = path; + + while (subpath) { + if (!fnmatch(filter, subpath, 0)) + return subpath - path; + subpath = strchr(subpath, '/'); + if (subpath) + subpath++; + } + return -1; +} + struct name_ref_data { int tags_only; int name_only; @@ -92,13 +106,23 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void { struct object *o = parse_object(sha1); struct name_ref_data *data = cb_data; + int can_abbreviate_output = data-tags_only data-name_only; int deref = 0; if (data-tags_only prefixcmp(path, refs/tags/)) return 0; - if (data-ref_filter fnmatch(data-ref_filter, path, 0)) - return 0; + if (data-ref_filter) { + switch (subpath_matches(path, data-ref_filter)) { + case -1: /* did not match */ + return 0; + case 0: /* matched fully */ + break; + default: /* matched subpath */ + can_abbreviate_output = 1; + break; + } + } while (o o-type == OBJ_TAG) { struct tag *t = (struct tag *) o; @@ -110,12 +134,10 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void if (o o-type == OBJ_COMMIT) { struct commit *commit = (struct commit *)o; - if (!prefixcmp(path, refs/heads/)) + if (can_abbreviate_output) + path = shorten_unambiguous_ref(path, 0); + else if (!prefixcmp(path, refs/heads/)) path = path + 11; - else if (data-tags_only -data-name_only -!prefixcmp(path, refs/tags/)) - path = path + 10; else if (!prefixcmp(path, refs/)) path = path + 5; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] name-rev: Allow to omit refs/tags/ part in --refs option when --tags used
In its current form, when an user wants to filter specific ref using --refs option, she needs to give something like --refs=refs/tags/v1.*. This is not intuitive as users might think it's enough to give just actual tag name part like --refs=v1.*. It applies to refs other than just tags too. Change it for users to be able to use --refs=sth or --refs=remotes/sth. Also remove the leading 'tags/' part in the output when --tags option was given since the option restricts to work with tags only. This is what we have if --name-only option was given also. Signed-off-by: Namhyung Kim namhyung@lge.com --- builtin/name-rev.c | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builtin/name-rev.c b/builtin/name-rev.c index 6238247..446743b 100644 --- a/builtin/name-rev.c +++ b/builtin/name-rev.c @@ -97,7 +97,8 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void if (data-tags_only prefixcmp(path, refs/tags/)) return 0; - if (data-ref_filter fnmatch(data-ref_filter, path, 0)) + if (data-ref_filter !prefixcmp(data-ref_filter, refs/) +fnmatch(data-ref_filter, path, 0)) return 0; while (o o-type == OBJ_TAG) { @@ -113,12 +114,15 @@ static int name_ref(const char *path, const unsigned char *sha1, int flags, void if (!prefixcmp(path, refs/heads/)) path = path + 11; else if (data-tags_only -data-name_only !prefixcmp(path, refs/tags/)) path = path + 10; else if (!prefixcmp(path, refs/)) path = path + 5; + if (data-ref_filter prefixcmp(data-ref_filter, refs/) +fnmatch(data-ref_filter, path, 0)) + return 0; + name_rev(commit, xstrdup(path), 0, 0, deref); } return 0; -- 1.7.11.7 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] config: Add description of --local option
It was missed in the option list while mentioned from the general description. Add it for completeness. Signed-off-by: Namhyung Kim namhy...@gmail.com --- Documentation/git-config.txt |9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/git-config.txt b/Documentation/git-config.txt index d88a6fc..19a7be0 100644 --- a/Documentation/git-config.txt +++ b/Documentation/git-config.txt @@ -114,6 +114,15 @@ rather than from all available files. + See also FILES. +--local:: + For writing options: write to the repository .git/config file. + This is the default behavior. ++ +For reading options: read only from the repository .git/config rather than +from all available files. ++ +See also FILES. + -f config-file:: --file config-file:: Use the given config file instead of the one specified by GIT_CONFIG. -- 1.7.9.2 -- To unsubscribe from this list: send the line unsubscribe git in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html