Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update update-index --cacheinfo entries' format #708

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Update update-index --cacheinfo entries' format #708

wants to merge 2 commits into from

Conversation

vadim-vj
Copy link

@vadim-vj vadim-vj commented Aug 22, 2020

According to git-update-index manual page:

--cacheinfo <mode>,<object>,<path>
--cacheinfo <mode> <object> <path>
Directly insert the specified info into the index. For backward compatibility, you can also give these three arguments as three separate parameters, but new users are encouraged to use a single-parameter form.

So, my commits change every old-style entry in code to the new format. It's not entirely necessary, but it unifies --cacheinfo usage across the code.

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 22, 2020

Welcome to GitGitGadget

Hi @vadim-vj, and welcome to GitGitGadget, the GitHub App to send patch series to the Git mailing list from GitHub Pull Requests.

Please make sure that your Pull Request has a good description, as it will be used as cover letter.

Also, it is a good idea to review the commit messages one last time, as the Git project expects them in a quite specific form:

  • the lines should not exceed 76 columns,
  • the first line should be like a header and typically start with a prefix like "tests:" or "commit:", and
  • the commit messages' body should be describing the "why?" of the change.
  • Finally, the commit messages should end in a Signed-off-by: line matching the commits' author.

It is in general a good idea to await the automated test ("Checks") in this Pull Request before contributing the patches, e.g. to avoid trivial issues such as unportable code.

Contributing the patches

Before you can contribute the patches, your GitHub username needs to be added to the list of permitted users. Any already-permitted user can do that, by adding a comment to your PR of the form /allow. A good way to find other contributors is to locate recent pull requests where someone has been /allowed:

Both the person who commented /allow and the PR author are able to /allow you.

An alternative is the channel #git-devel on the FreeNode IRC network:

<newcontributor> I've just created my first PR, could someone please /allow me? https://github.com/gitgitgadget/git/pull/12345
<veteran> newcontributor: it is done
<newcontributor> thanks!

Once on the list of permitted usernames, you can contribute the patches to the Git mailing list by adding a PR comment /submit.

If you want to see what email(s) would be sent for a /submit request, add a PR comment /preview to have the email(s) sent to you. You must have a public GitHub email address for this.

After you submit, GitGitGadget will respond with another comment that contains the link to the cover letter mail in the Git mailing list archive. Please make sure to monitor the discussion in that thread and to address comments and suggestions (while the comments and suggestions will be mirrored into the PR by GitGitGadget, you will still want to reply via mail).

If you do not want to subscribe to the Git mailing list just to be able to respond to a mail, you can download the mbox from the Git mailing list archive (click the (raw) link), then import it into your mail program. If you use GMail, you can do this via:

curl -g --user "<EMailAddress>:<Password>" \
    --url "imaps://imap.gmail.com/INBOX" -T /path/to/raw.txt

To iterate on your change, i.e. send a revised patch or patch series, you will first want to (force-)push to the same branch. You probably also want to modify your Pull Request description (or title). It is a good idea to summarize the revision by adding something like this to the cover letter (read: by editing the first comment on the PR, i.e. the PR description):

Changes since v1:
- Fixed a typo in the commit message (found by ...)
- Added a code comment to ... as suggested by ...
...

To send a new iteration, just add another PR comment with the contents: /submit.

Need help?

New contributors who want advice are encouraged to join git-mentoring@googlegroups.com, where volunteers who regularly contribute to Git are willing to answer newbie questions, give advice, or otherwise provide mentoring to interested contributors. You must join in order to post or view messages, but anyone can join.

You may also be able to find help in real time in the developer IRC channel, #git-devel on Freenode. Remember that IRC does not support offline messaging, so if you send someone a private message and log out, they cannot respond to you. The scrollback of #git-devel is archived, though.

@dscho
Copy link
Member

dscho commented Aug 24, 2020

/allow

@dscho
Copy link
Member

dscho commented Aug 24, 2020

Please note that it might be necessary to reformulate the commit message to explain the "why do we want this?" a bit more convincingly. After all, the documentation that was quoted in the cover letter states that new users are encouraged to use the new format, but the "old form" is not even deprecated.

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 24, 2020

User vadim-vj is now allowed to use GitGitGadget.

The old three separate parameters format (`<mode> <object> <path>`)
is replaced with the modern, single-parameter form
(`<mode>,<object>,<path>`).

Different parts of Git code use different syntax, so the commit unifies
it. According to `git-update-index` manual page, the new form is
preferred.

Signed-off-by: Vadim Sannikov <vsj.vadim@gmail.com>
The old three separate parameters format (`<mode> <object> <path>`)
is replaced with the modern, single-parameter form
(`<mode>,<object>,<path>`).

Different parts of Git code use different syntax, so the commit unifies
it. According to `git-update-index` manual page, the new form is
preferred.

Signed-off-by: Vadim Sannikov <vsj.vadim@gmail.com>
@vadim-vj
Copy link
Author

/submit

@gitgitgadget
Copy link

gitgitgadget bot commented Aug 24, 2020

Submitted as pull.708.git.1598280703.gitgitgadget@gmail.com

To fetch this version into FETCH_HEAD:

git fetch https://github.com/gitgitgadget/git pr-708/vadim-vj/cacheinfo-modern-format-v1

To fetch this version to local tag pr-708/vadim-vj/cacheinfo-modern-format-v1:

git fetch --no-tags https://github.com/gitgitgadget/git tag pr-708/vadim-vj/cacheinfo-modern-format-v1

@@ -71,7 +71,7 @@ case "${1:-.}${2:-.}${3:-.}" in
".$2.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the Git mailing list, Junio C Hamano wrote (reply to this):

"Vadim Sannikov via GitGitGadget" <gitgitgadget@gmail.com> writes:

> Subject: Re: [PATCH 1/2] Unify `update-index --cacheinfo` usage

Perhaps

	update-index: use single-argument form of --cacheinfo

see Documentation/SubmittingPatches[[summary-section]]

> Different parts of Git code use different syntax, so the commit unifies
> it. According to `git-update-index` manual page, the new form is
> preferred.

It is _encouraged_ to new users, but it is not like the old form is
getting removed.  IOW, there is no strong "preference".

	The "--cacheinfo" option of "update-index" can take two
	forms, but we encourage new users to use the form where the
	mode, object, and path are concatenated with a comma, into a
	single parameter.  Update the in-tree users of the command
	to also use the form to help new users who may want to copy
	and paste from our code.

or something?

This step is good, but it is not welcome to change the tests in such
a way that the three-separate-parameter form is not tested at all.
As long as we have tests to ensure the single-parameter form works
OK, no change is needed.

Thanks.

> Signed-off-by: Vadim Sannikov <vsj.vadim@gmail.com>
> ---
>  git-merge-one-file.sh | 6 +++---
>  git-mergetool.sh      | 2 +-
>  merge-recursive.c     | 2 +-
>  po/bg.po              | 4 ++--
>  po/ca.po              | 4 ++--
>  po/de.po              | 4 ++--
>  po/el.po              | 2 +-
>  po/es.po              | 4 ++--
>  po/fr.po              | 4 ++--
>  po/git.pot            | 2 +-
>  po/it.po              | 4 ++--
>  po/ko.po              | 4 ++--
>  po/ru.po              | 8 ++++++--
>  po/sv.po              | 4 ++--
>  po/tr.po              | 4 ++--
>  po/vi.po              | 4 ++--
>  po/zh_CN.po           | 4 ++--
>  po/zh_TW.po           | 4 ++--
>  18 files changed, 37 insertions(+), 33 deletions(-)
>
> diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh
> index f6d9852d2f..5691c4e7ff 100755
> --- a/git-merge-one-file.sh
> +++ b/git-merge-one-file.sh
> @@ -71,7 +71,7 @@ case "${1:-.}${2:-.}${3:-.}" in
>  ".$2.")
>  	# the other side did not add and we added so there is nothing
>  	# to be done, except making the path merged.
> -	exec git update-index --add --cacheinfo "$6" "$2" "$4"
> +	exec git update-index --add --cacheinfo "$6","$2","$4"
>  	;;
>  "..$3")
>  	echo "Adding $4"
> @@ -80,7 +80,7 @@ case "${1:-.}${2:-.}${3:-.}" in
>  		echo "ERROR: untracked $4 is overwritten by the merge." >&2
>  		exit 1
>  	fi
> -	git update-index --add --cacheinfo "$7" "$3" "$4" &&
> +	git update-index --add --cacheinfo "$7","$3","$4" &&
>  		exec git checkout-index -u -f -- "$4"
>  	;;
>  
> @@ -95,7 +95,7 @@ case "${1:-.}${2:-.}${3:-.}" in
>  		exit 1
>  	fi
>  	echo "Adding $4"
> -	git update-index --add --cacheinfo "$6" "$2" "$4" &&
> +	git update-index --add --cacheinfo "$6","$2","$4" &&
>  		exec git checkout-index -u -f -- "$4"
>  	;;
>  
> diff --git a/git-mergetool.sh b/git-mergetool.sh
> index e3f6d543fb..ad37b15f4b 100755
> --- a/git-mergetool.sh
> +++ b/git-mergetool.sh
> @@ -224,7 +224,7 @@ stage_submodule () {
>  	)
>  	test -n "$work_rel_path" ||
>  	die "fatal: unable to get path of module $path relative to work tree"
> -	git update-index --add --replace --cacheinfo 160000 "$submodule_sha1" "${work_rel_path%/}" || die
> +	git update-index --add --replace --cacheinfo 160000,"$submodule_sha1","${work_rel_path%/}" || die
>  }
>  
>  checkout_staged_file () {
> diff --git a/merge-recursive.c b/merge-recursive.c
> index d0214335a7..dfe6f67ec8 100644
> --- a/merge-recursive.c
> +++ b/merge-recursive.c
> @@ -1259,7 +1259,7 @@ static int merge_submodule(struct merge_options *opt,
>  		       "If this is correct simply add it to the index "
>  		       "for example\n"
>  		       "by using:\n\n"
> -		       "  git update-index --cacheinfo 160000 %s \"%s\"\n\n"
> +		       "  git update-index --cacheinfo 160000,%s,\"%s\"\n\n"
>  		       "which will accept this suggestion.\n"),
>  		       oid_to_hex(&merges.objects[0].item->oid), path);
>  		break;
> diff --git a/po/bg.po b/po/bg.po
> index a189b16dc4..517c0e6b49 100644
> --- a/po/bg.po
> +++ b/po/bg.po
> @@ -4737,13 +4737,13 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Ако това е така, добавете го към индекса с команда като следната:\n"
>  "\n"
> -"    git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "Това приема предложеното.\n"
>  
> diff --git a/po/ca.po b/po/ca.po
> index c43c21bc22..61c3a7f9b0 100644
> --- a/po/ca.po
> +++ b/po/ca.po
> @@ -4592,12 +4592,12 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Si això és correcte simplement afegiu-ho a l'índex per exemple utilitzant "
> -"git update-index --cacheinfo 160000 per cents \"%s\" que acceptaran aquest "
> +"  git update-index --cacheinfo 160000,%s,\"%s\" que acceptaran aquest "
>  "suggeriment.\n"
>  
>  #: merge-recursive.c:1268
> diff --git a/po/de.po b/po/de.po
> index 656de24218..ec0106f2b8 100644
> --- a/po/de.po
> +++ b/po/de.po
> @@ -4641,14 +4641,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Falls das korrekt ist, fügen Sie es einfach der Staging-Area, zum Beispiel "
>  "mit:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "hinzu, um diesen Vorschlag zu akzeptieren.\n"
>  
> diff --git a/po/el.po b/po/el.po
> index 703f46d0c7..e775885187 100644
> --- a/po/el.po
> +++ b/po/el.po
> @@ -3075,7 +3075,7 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
> diff --git a/po/es.po b/po/es.po
> index 41a72ca6fb..1c1aeebe47 100644
> --- a/po/es.po
> +++ b/po/es.po
> @@ -4572,14 +4572,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Si esto es correcto simplemente agrégalo al índice por ejemplo\n"
>  "usando:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "el cual aceptará esta sugerencia.\n"
>  
> diff --git a/po/fr.po b/po/fr.po
> index d20fc440ab..157c41ff4c 100644
> --- a/po/fr.po
> +++ b/po/fr.po
> @@ -4714,14 +4714,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Si c'est correct, ajoutez le simplement à l'index\n"
>  "en utilisant par exemple :\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "qui acceptera cette suggestion.\n"
>  
> diff --git a/po/git.pot b/po/git.pot
> index 198b6e0a4a..2d50bebf5a 100644
> --- a/po/git.pot
> +++ b/po/git.pot
> @@ -4256,7 +4256,7 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
> diff --git a/po/it.po b/po/it.po
> index 53523e76df..c8264dd7bc 100644
> --- a/po/it.po
> +++ b/po/it.po
> @@ -4649,14 +4649,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Se è corretta aggiungila semplicemente all'indice, ad esempio\n"
>  "usando:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "per accettare questo suggerimento.\n"
>  
> diff --git a/po/ko.po b/po/ko.po
> index dcfe21c223..47b611edee 100644
> --- a/po/ko.po
> +++ b/po/ko.po
> @@ -2361,14 +2361,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "이 제안이 맞으면 인덱스에 추가하면 됩니다. 예를 들어\n"
>  "다음 명령을 사용하면:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "제안을 받아들이게 됩니다.\n"
>  
> diff --git a/po/ru.po b/po/ru.po
> index a77b462e62..a928cd879e 100644
> --- a/po/ru.po
> +++ b/po/ru.po
> @@ -3523,10 +3523,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
> -msgstr "Если оно верное, то просто добавьте его в индекс, например так:\n\n  git update-index --cacheinfo 160000 %s \"%s\"\n\nтем самым принимая это предположение.\n"
> +msgstr "Если оно верное, то просто добавьте его в индекс, например так:\n"
> +"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
> +"\n"
> +"тем самым принимая это предположение.\n"
>  
>  #: merge-recursive.c:1252
>  #, c-format
> diff --git a/po/sv.po b/po/sv.po
> index 93f3c6f3f7..f5a850f0b7 100644
> --- a/po/sv.po
> +++ b/po/sv.po
> @@ -4551,14 +4551,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Om detta är riktigt lägger du bara till det i indexet, till\n"
>  "exempel så här:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "vilket godtar lösningen.\n"
>  
> diff --git a/po/tr.po b/po/tr.po
> index 9a17c19b25..af5f9ba7f8 100644
> --- a/po/tr.po
> +++ b/po/tr.po
> @@ -4619,13 +4619,13 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Eğer bu doğruysa yalnızca indekse ekleyin, örneğinbu öneriyi kabul edecek:\n"
>  "\n"
> -"\tgit update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "komutunu kullanmanız yeterlidir.\n"
>  
> diff --git a/po/vi.po b/po/vi.po
> index d730cf1141..beec050125 100644
> --- a/po/vi.po
> +++ b/po/vi.po
> @@ -4548,14 +4548,14 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "Nếu đây là đúng đơn giản thêm nó vào mục lục ví dụ\n"
>  "bằng cách dùng:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "cái mà sẽ chấp nhận gợi ý này.\n"
>  
> diff --git a/po/zh_CN.po b/po/zh_CN.po
> index a531819623..69dd29140b 100644
> --- a/po/zh_CN.po
> +++ b/po/zh_CN.po
> @@ -4567,13 +4567,13 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "如果这个正确,将其添加到索引,例如使用命令:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "以接受此建议。\n"
>  
> diff --git a/po/zh_TW.po b/po/zh_TW.po
> index 9334b46faa..18e6b8985a 100644
> --- a/po/zh_TW.po
> +++ b/po/zh_TW.po
> @@ -4692,13 +4692,13 @@ msgid ""
>  "If this is correct simply add it to the index for example\n"
>  "by using:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "which will accept this suggestion.\n"
>  msgstr ""
>  "如果這個正確,將其新增到索引,例如使用指令:\n"
>  "\n"
> -"  git update-index --cacheinfo 160000 %s \"%s\"\n"
> +"  git update-index --cacheinfo 160000,%s,\"%s\"\n"
>  "\n"
>  "以接受此建議。\n"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants