From: Heiko Voigt <hvoigt@hvoigt.net>
To: Prathamesh Chavan <pc44800@gmail.com>
Cc: git@vger.kernel.org, sbeller@google.com,
christian.couder@gmail.com, gitster@pobox.com
Subject: Re: [GSoC][PATCH 3/4] submodule: port set_name_rev() from shell to C
Date: Mon, 21 Aug 2017 18:47:30 +0200 [thread overview]
Message-ID: <20170821164730.GC1618@book.hvoigt.net> (raw)
In-Reply-To: <20170821161515.23775-3-pc44800@gmail.com>
On Mon, Aug 21, 2017 at 09:45:14PM +0530, Prathamesh Chavan wrote:
> Function set_name_rev() is ported from git-submodule to the
> submodule--helper builtin. The function get_name_rev() generates the
> value of the revision name as required, and the function
> print_name_rev() handles the formating and printing of the obtained
> revision name.
>
> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: Stefan Beller <sbeller@google.com>
> Signed-off-by: Prathamesh Chavan <pc44800@gmail.com>
> ---
> builtin/submodule--helper.c | 63 +++++++++++++++++++++++++++++++++++++++++++++
> git-submodule.sh | 16 ++----------
> 2 files changed, 65 insertions(+), 14 deletions(-)
>
> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 7803457ba..a4bff3f38 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
[...]
> @@ -1242,6 +1304,7 @@ static struct cmd_struct commands[] = {
> {"relative-path", resolve_relative_path, 0},
> {"resolve-relative-url", resolve_relative_url, 0},
> {"resolve-relative-url-test", resolve_relative_url_test, 0},
> + {"print-name-rev", print_name_rev, 0},
I see the function in git-submodule.sh was named kind of reverse. How
about we do it more naturally here and call this 'rev-name' instead?
That makes is more clear to me and is also similar to the used variable
name 'revname'.
I would also prefix it differently like 'get' or 'calculate' instead of
'print' since it tries to find a name and is not just a simple lookup.
So in summary I would prefer something like 'get-rev-name' as a name for
the subcommand here.
> {"init", module_init, SUPPORT_SUPER_PREFIX},
> {"remote-branch", resolve_remote_submodule_branch, 0},
> {"push-check", push_check, 0},
> diff --git a/git-submodule.sh b/git-submodule.sh
> index e131760ee..e988167e0 100755
> --- a/git-submodule.sh
> +++ b/git-submodule.sh
> @@ -759,18 +759,6 @@ cmd_update()
> }
> }
>
> -set_name_rev () {
> - revname=$( (
> - sanitize_submodule_env
> - cd "$1" && {
> - git describe "$2" 2>/dev/null ||
> - git describe --tags "$2" 2>/dev/null ||
> - git describe --contains "$2" 2>/dev/null ||
> - git describe --all --always "$2"
> - }
> - ) )
> - test -z "$revname" || revname=" ($revname)"
> -}
> #
> # Show commit summary for submodules in index or working tree
> #
> @@ -1042,14 +1030,14 @@ cmd_status()
> fi
> if git diff-files --ignore-submodules=dirty --quiet -- "$sm_path"
> then
> - set_name_rev "$sm_path" "$sha1"
> + revname=$(git submodule--helper print-name-rev "$sm_path" "$sha1")
> say " $sha1 $displaypath$revname"
> else
> if test -z "$cached"
> then
> sha1=$(sanitize_submodule_env; cd "$sm_path" && git rev-parse --verify HEAD)
> fi
> - set_name_rev "$sm_path" "$sha1"
> + revname=$(git submodule--helper print-name-rev "$sm_path" "$sha1")
> say "+$sha1 $displaypath$revname"
> fi
>
> --
> 2.13.0
>
next prev parent reply other threads:[~2017-08-21 16:47 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-21 16:15 [GSoC][PATCH 1/4] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-08-21 16:15 ` [GSoC][PATCH 2/4] submodule--helper: introduce for_each_submodule_list() Prathamesh Chavan
2017-08-22 22:37 ` Junio C Hamano
2017-08-21 16:15 ` [GSoC][PATCH 3/4] submodule: port set_name_rev() from shell to C Prathamesh Chavan
2017-08-21 16:47 ` Heiko Voigt [this message]
2017-08-21 17:24 ` Prathamesh Chavan
2017-08-21 16:15 ` [GSoC][PATCH 4/4] submodule: port submodule subcommand 'status' " Prathamesh Chavan
2017-08-22 22:29 ` [GSoC][PATCH 1/4] submodule--helper: introduce get_submodule_displaypath() Junio C Hamano
2017-08-23 18:15 ` [GSoC][PATCH v2 0/4] submodule: Incremental rewrite of git-submodules Prathamesh Chavan
2017-08-23 18:15 ` [GSoC][PATCH v2 1/4] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-08-23 18:15 ` [GSoC][PATCH v2 2/4] submodule--helper: introduce for_each_submodule() Prathamesh Chavan
2017-08-23 19:13 ` Junio C Hamano
2017-08-23 19:31 ` Stefan Beller
2017-08-23 19:52 ` Junio C Hamano
2017-08-24 19:50 ` [GSoC][PATCH v3 0/4] Incremental rewrite of git-submodules Prathamesh Chavan
2017-08-24 19:50 ` [GSoC][PATCH v3 1/4] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-08-24 19:50 ` [GSoC][PATCH v3 2/4] submodule--helper: introduce for_each_listed_submodule() Prathamesh Chavan
2017-08-24 19:50 ` [GSoC][PATCH v3 3/4] submodule: port set_name_rev() from shell to C Prathamesh Chavan
2017-08-24 19:50 ` [GSoC][PATCH v3 4/4] submodule: port submodule subcommand 'status' " Prathamesh Chavan
2017-08-25 18:51 ` [GSoC][PATCH v3 0/4] Incremental rewrite of git-submodules Junio C Hamano
2017-08-25 19:15 ` Stefan Beller
2017-08-25 20:32 ` Junio C Hamano
2017-08-27 11:50 ` Prathamesh Chavan
2017-08-28 11:55 ` [GSoC][PATCH v4 " Prathamesh Chavan
2017-08-28 11:55 ` [GSoC][PATCH v4 1/4] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-09-21 15:06 ` Han-Wen Nienhuys
2017-08-28 11:55 ` [GSoC][PATCH v4 2/4] submodule--helper: introduce for_each_listed_submodule() Prathamesh Chavan
2017-08-28 11:55 ` [GSoC][PATCH v4 3/4] submodule: port set_name_rev() from shell to C Prathamesh Chavan
2017-09-21 15:31 ` Han-Wen Nienhuys
2017-08-28 11:55 ` [GSoC][PATCH v4 4/4] submodule: port submodule subcommand 'status' " Prathamesh Chavan
2017-09-21 16:10 ` Han-Wen Nienhuys
2017-09-24 12:08 ` [PATCH v5 0/4] Incremental rewrite of git-submodules Prathamesh Chavan
2017-09-24 12:08 ` [PATCH v5 1/4] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-09-25 3:35 ` Junio C Hamano
2017-09-24 12:08 ` [PATCH v5 2/4] submodule--helper: introduce for_each_listed_submodule() Prathamesh Chavan
2017-09-25 3:43 ` Junio C Hamano
2017-09-24 12:08 ` [PATCH v5 3/4] submodule: port set_name_rev() from shell to C Prathamesh Chavan
2017-09-25 3:51 ` Junio C Hamano
2017-09-25 3:55 ` Junio C Hamano
2017-09-24 12:08 ` [PATCH v5 4/4] submodule: port submodule subcommand 'status' " Prathamesh Chavan
2017-09-25 5:06 ` Junio C Hamano
2017-09-29 9:44 ` [PATCH v6 0/3] Incremental rewrite of git-submodules Prathamesh Chavan
2017-09-29 9:44 ` [PATCH v6 1/3] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-10-02 0:44 ` Junio C Hamano
2017-09-29 9:44 ` [PATCH v6 2/3] submodule--helper: introduce for_each_listed_submodule() Prathamesh Chavan
2017-10-02 0:55 ` Junio C Hamano
2017-09-29 9:44 ` [PATCH v6 3/3] submodule: port submodule subcommand 'status' from shell to C Prathamesh Chavan
2017-10-02 1:08 ` Junio C Hamano
2017-10-06 13:24 ` [PATCH v7 0/3] Incremental rewrite of git-submodules Prathamesh Chavan
2017-10-06 13:24 ` [PATCH v7 1/3] submodule--helper: introduce get_submodule_displaypath() Prathamesh Chavan
2017-10-06 21:12 ` Eric Sunshine
2017-10-06 13:24 ` [PATCH v7 2/3] submodule--helper: introduce for_each_listed_submodule() Prathamesh Chavan
2017-10-06 21:56 ` Eric Sunshine
2017-10-06 13:24 ` [PATCH v7 3/3] submodule: port submodule subcommand 'status' from shell to C Prathamesh Chavan
2017-10-07 8:51 ` [PATCH v7 0/3] Incremental rewrite of git-submodules Junio C Hamano
2017-10-07 9:35 ` Eric Sunshine
2017-10-02 0:39 ` [PATCH v6 " Junio C Hamano
2017-08-23 18:15 ` [GSoC][PATCH v2 3/4] submodule: port set_name_rev() from shell to C Prathamesh Chavan
2017-08-23 18:15 ` [GSoC][PATCH v2 4/4] submodule: port submodule subcommand 'status' " Prathamesh Chavan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170821164730.GC1618@book.hvoigt.net \
--to=hvoigt@hvoigt.net \
--cc=christian.couder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=pc44800@gmail.com \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).