Update update-index --cacheinfo entries' format
PATCH 1/2 Unify `update-index --cacheinfo` usage
In reply to Vadim Sannikov via GitGitGadgetFrom: Vadim Sannikov <[email protected]>
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.
--- 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(-)
git-merge-one-file.sh +3 -3
@@ -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" ;;
git-mergetool.sh +1 -1
@@ -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 () {
merge-recursive.c +1 -1
@@ -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 ;
po/bg.po +2 -2
@@ -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"
po/ca.po +2 -2
@@ -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
po/de.po +2 -2
@@ -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"
po/el.po +1 -1
@@ -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 ""
po/es.po +2 -2
@@ -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"
po/fr.po +2 -2
@@ -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"
po/git.pot +1 -1
@@ -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 ""
po/it.po +2 -2
@@ -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"
po/ko.po +2 -2
@@ -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"
po/ru.po +6 -2
@@ -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
po/sv.po +2 -2
@@ -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"
po/tr.po +2 -2
@@ -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"
po/vi.po +2 -2
@@ -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"
po/zh_CN.po +2 -2
@@ -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"
po/zh_TW.po +2 -2
@@ -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"
Signature · 1 line
gitgitgadget
cover Update update-index --cacheinfo entries' format
According to git-update-index manual page:
Quoted 4 lines
--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.
Vadim Sannikov (2):
Unify update-index --cacheinfo usage
Unify update-index --cacheinfo usage (tests)
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 ++-- t/lib-submodule-update.sh | 2 +- t/t0028-working-tree-encoding.sh | 4 ++-- t/t1006-cat-file.sh | 2 +- t/t1010-mktree.sh | 2 +- t/t1050-large.sh | 2 +- t/t1450-fsck.sh | 4 ++-- t/t3600-rm.sh | 4 ++-- t/t5520-pull.sh | 2 +- t/t5526-fetch-submodules.sh | 18 +++++++++--------- t/t5531-deep-submodule-push.sh | 2 +- t/t6130-pathspec-noglob.sh | 2 +- t/t6430-merge-recursive.sh | 2 +- t/t7003-filter-branch.sh | 2 +- t/t7011-skip-worktree-reading.sh | 4 ++-- t/t7012-skip-worktree-writing.sh | 4 ++-- t/t7113-post-index-change-hook.sh | 2 +- t/t7406-submodule-update.sh | 4 ++-- t/t9350-fast-export.sh | 8 ++++---- t/test-lib-functions.sh | 2 +- 37 files changed, 73 insertions(+), 69 deletions(-)
base-commit: 675a4aaf3b226c0089108221b96559e0baae5de9
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-708%2Fvadim-vj%2Fcacheinfo-modern-format-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-708/vadim-vj/cacheinfo-modern-format-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/708
Signature · 1 line
gitgitgadget
PATCH 2/2 Unify `update-index --cacheinfo` usage (tests)
From: Vadim Sannikov <[email protected]>
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.
--- t/lib-submodule-update.sh | 2 +- t/t0028-working-tree-encoding.sh | 4 ++-- t/t1006-cat-file.sh | 2 +- t/t1010-mktree.sh | 2 +- t/t1050-large.sh | 2 +- t/t1450-fsck.sh | 4 ++-- t/t3600-rm.sh | 4 ++-- t/t5520-pull.sh | 2 +- t/t5526-fetch-submodules.sh | 18 +++++++++--------- t/t5531-deep-submodule-push.sh | 2 +- t/t6130-pathspec-noglob.sh | 2 +- t/t6430-merge-recursive.sh | 2 +- t/t7003-filter-branch.sh | 2 +- t/t7011-skip-worktree-reading.sh | 4 ++-- t/t7012-skip-worktree-writing.sh | 4 ++-- t/t7113-post-index-change-hook.sh | 2 +- t/t7406-submodule-update.sh | 4 ++-- t/t9350-fast-export.sh | 8 ++++---- t/test-lib-functions.sh | 2 +- 19 files changed, 36 insertions(+), 36 deletions(-)
t/lib-submodule-update.sh +1 -1
@@ -139,7 +139,7 @@ create_lib_submodule_repo () { git revert HEAD && git checkout -b invalid_sub1 add_sub1 && - git update-index --cacheinfo 160000 $(test_oid numeric) sub1 && + git update-index --cacheinfo 160000,$(test_oid numeric),sub1 && git commit -m "Invalid sub1 commit" && git checkout -b valid_sub1 && git revert HEAD &&
t/t0028-working-tree-encoding.sh +2 -2
@@ -213,7 +213,7 @@ test_expect_success 'error if encoding round trip is not the same during refresh echo "*.utf16le text working-tree-encoding=utf-16le" >.gitattributes && echo "hallo" >nonsense.utf16le && TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16le) && - git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16le && + git update-index --add --cacheinfo 100644,$TEST_HASH,nonsense.utf16le && COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) && git update-ref refs/heads/master $COMMIT &&
@@ -229,7 +229,7 @@ test_expect_success 'error if encoding garbage is already in Git' ' # This simulates a Git version that has no checkoutEncoding support cp nobom.utf16be.raw nonsense.utf16 && TEST_HASH=$(git hash-object --no-filters -w nonsense.utf16) && - git update-index --add --cacheinfo 100644 $TEST_HASH nonsense.utf16 && + git update-index --add --cacheinfo 100644,$TEST_HASH,nonsense.utf16 && COMMIT=$(git commit-tree -p $(git rev-parse HEAD) -m "plain commit" $(git write-tree)) && git update-ref refs/heads/master $COMMIT &&
t/t1006-cat-file.sh +1 -1
@@ -134,7 +134,7 @@ run_tests 'blob' $hello_sha1 $hello_size "$hello_content" "$hello_content" test_expect_success '--batch-check without %(rest) considers whole line' ' echo "$hello_sha1 blob $hello_size" >expect && - git update-index --add --cacheinfo 100644 $hello_sha1 "white space" && + git update-index --add --cacheinfo 100644,$hello_sha1,"white space" && test_when_finished "git update-index --remove \"white space\"" && echo ":white space" | git cat-file --batch-check >actual && test_cmp expect actual
t/t1010-mktree.sh +1 -1
@@ -23,7 +23,7 @@ test_expect_success setup ' test_tick && git commit -q -m one && H=$(git rev-parse HEAD) && - git update-index --add --cacheinfo 160000 $H sub && + git update-index --add --cacheinfo 160000,$H,sub && test_tick && git commit -q -m two && git rev-parse HEAD^{tree} >tree.withsub &&
t/t1050-large.sh +1 -1
@@ -90,7 +90,7 @@ test_expect_success 'add a large file or two' ' test_expect_success 'checkout a large file' ' large1=$(git rev-parse :large1) && - git update-index --add --cacheinfo 100644 $large1 another && + git update-index --add --cacheinfo 100644,$large1,another && git checkout another && test_cmp large1 another '
t/t1450-fsck.sh +2 -2
@@ -59,7 +59,7 @@ test_expect_success 'object with bad sha1' ' sha="$(dirname $new)$(basename $new)" && mv .git/objects/$old .git/objects/$new && test_when_finished "remove_object $sha" && - git update-index --add --cacheinfo 100644 $sha foo && + git update-index --add --cacheinfo 100644,$sha,foo && test_when_finished "git read-tree -u --reset HEAD" && tree=$(git write-tree) && test_when_finished "remove_object $tree" &&
@@ -438,7 +438,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' ' sha="$(dirname $new)$(basename $new)" && mv .git/objects/$old .git/objects/$new && test_when_finished "remove_object $sha" && - git update-index --add --cacheinfo 100644 $sha foo && + git update-index --add --cacheinfo 100644,$sha,foo && test_when_finished "git read-tree -u --reset HEAD" && tree=$(git write-tree) && test_when_finished "remove_object $tree" &&
t/t3600-rm.sh +2 -2
@@ -305,7 +305,7 @@ EOF test_expect_success 'rm removes empty submodules from work tree' ' mkdir submod && hash=$(git rev-parse HEAD) && - git update-index --add --cacheinfo 160000 "$hash" submod && + git update-index --add --cacheinfo 160000,"$hash",submod && git config -f .gitmodules submodule.sub.url ./. && git config -f .gitmodules submodule.sub.path submod && git submodule init &&
@@ -632,7 +632,7 @@ test_expect_success 'setup subsubmodule' ' ( cd submod && hash=$(git rev-parse HEAD) && - git update-index --add --cacheinfo 160000 "$hash" subsubmod && + git update-index --add --cacheinfo 160000,"$hash",subsubmod && git config -f .gitmodules submodule.sub.url ../. && git config -f .gitmodules submodule.sub.path subsubmod && git submodule init &&
t/t5520-pull.sh +1 -1
@@ -350,7 +350,7 @@ test_expect_success 'failed --rebase shows advice' ' git checkout -b diverging && test_commit attributes .gitattributes "* text=auto" attrs && sha1="$(printf "1\\r\\n" | git hash-object -w --stdin)" && - git update-index --cacheinfo 0644 $sha1 file && + git update-index --cacheinfo 0644,$sha1,file && git commit -m v1-with-cr && # force checkout because `git reset --hard` will not leave clean `file` git checkout -f -b fails-to-rebase HEAD^ &&
t/t5526-fetch-submodules.sh +9 -9
@@ -614,12 +614,12 @@ test_expect_success "fetch new submodule commits on-demand outside standard refs C=$(git -C submodule commit-tree -m "new change outside refs/heads" HEAD^{tree}) && git -C submodule update-ref refs/changes/1 $C && - git update-index --cacheinfo 160000 $C submodule && + git update-index --cacheinfo 160000,$C,submodule && test_tick && D=$(git -C sub1 commit-tree -m "new change outside refs/heads" HEAD^{tree}) && git -C sub1 update-ref refs/changes/2 $D && - git update-index --cacheinfo 160000 $D sub1 && + git update-index --cacheinfo 160000,$D,sub1 && git commit -m "updated submodules outside of refs/heads" && E=$(git rev-parse HEAD) &&
@@ -638,12 +638,12 @@ test_expect_success 'fetch new submodule commit on-demand in FETCH_HEAD' ' C=$(git -C submodule commit-tree -m "another change outside refs/heads" HEAD^{tree}) && git -C submodule update-ref refs/changes/4 $C && - git update-index --cacheinfo 160000 $C submodule && + git update-index --cacheinfo 160000,$C,submodule && test_tick && D=$(git -C sub1 commit-tree -m "another change outside refs/heads" HEAD^{tree}) && git -C sub1 update-ref refs/changes/5 $D && - git update-index --cacheinfo 160000 $D sub1 && + git update-index --cacheinfo 160000,$D,sub1 && git commit -m "updated submodules outside of refs/heads" && E=$(git rev-parse HEAD) &&
@@ -669,12 +669,12 @@ test_expect_success 'fetch new submodule commits on-demand without .gitmodules e C=$(git -C submodule commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) && git -C submodule update-ref refs/changes/7 $C && - git update-index --cacheinfo 160000 $C submodule && + git update-index --cacheinfo 160000,$C,submodule && test_tick && D=$(git -C sub1 commit-tree -m "yet another change outside refs/heads" HEAD^{tree}) && git -C sub1 update-ref refs/changes/8 $D && - git update-index --cacheinfo 160000 $D sub1 && + git update-index --cacheinfo 160000,$D,sub1 && git commit -m "updated submodules outside of refs/heads" && E=$(git rev-parse HEAD) &&
@@ -696,15 +696,15 @@ test_expect_success 'fetch new submodule commit intermittently referenced by sup F=$(git -C sub1 commit-tree -m "change 12 outside refs/heads" HEAD^{tree}) && git -C sub1 update-ref refs/changes/10 $D && - git update-index --cacheinfo 160000 $D sub1 && + git update-index --cacheinfo 160000,$D,sub1 && git commit -m "updated submodules outside of refs/heads" && git -C sub1 update-ref refs/changes/11 $E && - git update-index --cacheinfo 160000 $E sub1 && + git update-index --cacheinfo 160000,$E,sub1 && git commit -m "updated submodules outside of refs/heads" && git -C sub1 update-ref refs/changes/12 $F && - git update-index --cacheinfo 160000 $F sub1 && + git update-index --cacheinfo 160000,$F,sub1 && git commit -m "updated submodules outside of refs/heads" && G=$(git rev-parse HEAD) &&
t/t5531-deep-submodule-push.sh +1 -1
@@ -301,7 +301,7 @@ test_expect_success 'push succeeds if submodule commit disabling recursion from test_expect_success 'submodule entry pointing at a tag is error' ' git -C work/gar/bage tag -a test1 -m "tag" && tag=$(git -C work/gar/bage rev-parse test1^{tag}) && - git -C work update-index --cacheinfo 160000 "$tag" gar/bage && + git -C work update-index --cacheinfo 160000,"$tag",gar/bage && git -C work commit -m "bad commit" && test_when_finished "git -C work reset --hard HEAD^" && test_must_fail git -C work push --recurse-submodules=on-demand ../pub.git master 2>err &&
t/t6130-pathspec-noglob.sh +1 -1
@@ -11,7 +11,7 @@ test_expect_success 'create commits with glob characters' ' # on Windows (the tests below do not depend on the presence # of the file in the worktree) git config core.protectNTFS false && - git update-index --add --cacheinfo 100644 "$(git rev-parse HEAD:foo)" "f*" && + git update-index --add --cacheinfo 100644,"$(git rev-parse HEAD:foo)","f*" && test_tick && git commit -m star && test_commit bracket "f[o][o]"
t/t6430-merge-recursive.sh +1 -1
@@ -246,7 +246,7 @@ test_expect_success 'setup 7' ' git rm d/e && test_tick && git commit -m "remove d/e" && - git update-index --add --cacheinfo 160000 $c1 d && + git update-index --add --cacheinfo 160000,$c1,d && test_tick && git commit -m "make d/ a submodule" '
t/t7003-filter-branch.sh +1 -1
@@ -467,7 +467,7 @@ test_expect_success 'replace submodule revision' ' git reset --hard original && git filter-branch -f --tree-filter \ "if git ls-files --error-unmatch -- submod > /dev/null 2>&1 - then git update-index --cacheinfo 160000 $invalid submod + then git update-index --cacheinfo 160000,$invalid,submod fi" HEAD && test $orig_head != $(git show-ref --hash --head HEAD) '
t/t7011-skip-worktree-reading.sh +2 -2
@@ -26,7 +26,7 @@ EOF setup_absent() { test -f 1 && rm 1 git update-index --remove 1 && - git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && + git update-index --add --cacheinfo 100644,$EMPTY_BLOB,1 && git update-index --skip-worktree 1 }
@@ -40,7 +40,7 @@ test_absent() { setup_dirty() { git update-index --force-remove 1 && echo dirty > 1 && - git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && + git update-index --add --cacheinfo 100644,$EMPTY_BLOB,1 && git update-index --skip-worktree 1 }
t/t7012-skip-worktree-writing.sh +2 -2
@@ -56,7 +56,7 @@ test_expect_success 'read-tree removes worktree, dirty case' ' setup_absent() { test -f 1 && rm 1 git update-index --remove 1 && - git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && + git update-index --add --cacheinfo 100644,$EMPTY_BLOB,1 && git update-index --skip-worktree 1 }
@@ -70,7 +70,7 @@ test_absent() { setup_dirty() { git update-index --force-remove 1 && echo dirty > 1 && - git update-index --add --cacheinfo 100644 $EMPTY_BLOB 1 && + git update-index --add --cacheinfo 100644,$EMPTY_BLOB,1 && git update-index --skip-worktree 1 }
t/t7113-post-index-change-hook.sh +1 -1
@@ -132,7 +132,7 @@ test_expect_success 'test reset --mixed and update-index triggers the hook' ' test_path_is_file testsuccess && rm -f testsuccess && test_path_is_missing testfailure && git hash-object -w --stdin <dir1/file2.txt >expect && - git update-index --cacheinfo 100644 "$(cat expect)" dir1/file1.txt && + git update-index --cacheinfo 100644,"$(cat expect)",dir1/file1.txt && test_path_is_file testsuccess && rm -f testsuccess && test_path_is_missing testfailure && git update-index --skip-worktree dir1/file2.txt &&
t/t7406-submodule-update.sh +2 -2
@@ -517,7 +517,7 @@ test_expect_success 'submodule init does not copy command into .git/config' ' git ls-files -s submodule >out && H=$(cut -d" " -f2 out) && mkdir submodule1 && - git update-index --add --cacheinfo 160000 $H submodule1 && + git update-index --add --cacheinfo 160000,$H,submodule1 && git config -f .gitmodules submodule.submodule1.path submodule1 && git config -f .gitmodules submodule.submodule1.url ../submodule && git config -f .gitmodules submodule.submodule1.update !false &&
@@ -928,7 +928,7 @@ test_expect_success 'submodule update properly revives a moved submodule' ' git rm --cached submodule2 && rm -rf submodule2 && mkdir -p "moved/sub module" && - git update-index --add --cacheinfo 160000 $H "moved/sub module" && + git update-index --add --cacheinfo 160000,$H,"moved/sub module" && git config -f .gitmodules submodule.submodule2.path "moved/sub module" && git commit -am "post move" && git submodule update &&
t/t9350-fast-export.sh +4 -4
@@ -604,10 +604,10 @@ test_expect_success 'fast-export quotes pathnames' ' (cd crazy-paths && blob=$(echo foo | git hash-object -w --stdin) && git -c core.protectNTFS=false update-index --add \ - --cacheinfo 100644 $blob "$(printf "path with\\nnewline")" \ - --cacheinfo 100644 $blob "path with \"quote\"" \ - --cacheinfo 100644 $blob "path with \\backslash" \ - --cacheinfo 100644 $blob "path with space" && + --cacheinfo 100644,$blob,"$(printf "path with\\nnewline")" \ + --cacheinfo 100644,$blob,"path with \"quote\"" \ + --cacheinfo 100644,$blob,"path with \\backslash" \ + --cacheinfo 100644,$blob,"path with space" && git commit -m addition && git ls-files -z -s | perl -0pe "s{\\t}{$&subdir/}" >index && git read-tree --empty &&
t/test-lib-functions.sh +1 -1
@@ -1230,7 +1230,7 @@ test_ln_s_add () { else printf '%s' "$1" >"$2" && ln_s_obj=$(git hash-object -w "$2") && - git update-index --add --cacheinfo 120000 $ln_s_obj "$2" && + git update-index --add --cacheinfo 120000,$ln_s_obj,"$2" && # pick up stat info from the file git update-index "$2" fi
Signature · 1 line
gitgitgadget
Re: [PATCH 1/2] Unify `update-index --cacheinfo` usage
In reply to Vadim Sannikov via GitGitGadgetQuoted 1 line · Vadim Sannikov via GitGitGadget
Subject: Re: [PATCH 1/2] Unify
update-index --cacheinfousage
Perhaps
update-index: use single-argument form of --cacheinfo
see Documentation/SubmittingPatches[[summary-section]]
Quoted 3 lines
Different parts of Git code use different syntax, so the commit unifies it. According to
git-update-indexmanual 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.
Quoted 371 lines
Signed-off-by Vadim Sannikov <[email protected]>--- 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(-)git-merge-one-file.sh +3
-3@@ -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" ;;git-mergetool.sh +1
-1@@ -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 () {merge-recursive.c +1
-1@@ -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 ;po/bg.po +2
-2@@ -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"po/ca.po +2
-2@@ -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:1268po/de.po +2
-2@@ -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"po/el.po +1
-1@@ -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 ""po/es.po +2
-2@@ -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"po/fr.po +2
-2@@ -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"po/git.pot +1
-1@@ -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 ""po/it.po +2
-2@@ -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"po/ko.po +2
-2@@ -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"po/ru.po +6
-2@@ -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-formatpo/sv.po +2
-2@@ -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"po/tr.po +2
-2@@ -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"po/vi.po +2
-2@@ -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"po/zh_CN.po +2
-2@@ -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"po/zh_TW.po +2
-2@@ -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"