summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2017-11-06refs: rename constant `REF_NODEREF` to `REF_NO_DEREF`Michael Haggerty
Even after working with this code for years, I still see this constant name as "ref node ref". Rename it to make it's meaning clearer. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06refs: tidy up and adjust visibility of the `ref_update` flagsMichael Haggerty
The constants used for `ref_update::flags` were rather disorganized: * The definitions in `refs.h` were not close to the functions that used them. * Maybe constants were defined in `refs-internal.h`, making them visible to the whole refs module, when in fact they only made sense for the files backend. * Their documentation wasn't very consistent and partly still referred to sha1s rather than oids. * The numerical values followed no rational scheme Fix all of these problems. The main functional improvement is that some constants' visibility is now limited to `files-backend.c`. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06ref_transaction_add_update(): remove a checkMichael Haggerty
We want to make `REF_ISPRUNING` internal to the files backend. For this to be possible, `ref_transaction_add_update()` mustn't know about it. So move the check that `REF_ISPRUNING` is only used with `REF_NODEREF` from this function to `files_transaction_prepare()`. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06ref_transaction_update(): die on disallowed flagsMichael Haggerty
Callers shouldn't be passing disallowed flags into `ref_transaction_update()`. So instead of masking them off, treat it as a bug if any are set. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06prune_ref(): call `ref_transaction_add_update()` directlyMichael Haggerty
`prune_ref()` needs to use the `REF_ISPRUNING` flag, but we want to make that flag private to the files backend. So instead of calling `ref_transaction_delete()`, which is a public function and therefore shouldn't allow the `REF_ISPRUNING` flag, change `prune_ref()` to call `ref_transaction_add_update()`, which is private to the refs module. (Note that we don't need any of the other services provided by `ref_transaction_delete()`.) This allows us to change `ref_transaction_update()` to reject the `REF_ISPRUNING` flag. Do so by adjusting `REF_TRANSACTION_UPDATE_ALLOWED_FLAGS`. Also add parentheses to its definition to avoid potential future mishaps. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-11-06files_transaction_prepare(): don't leak flags to packed transactionMichael Haggerty
The files backend uses `ref_update::flags` for several internal flags. But those flags have no meaning to the packed backend. So when adding updates for the packed-refs transaction, only use flags that make sense to the packed backend. `REF_NODEREF` is part of the public interface, and it's logically what we want, so include it. In fact it is actually ignored by the packed backend (which doesn't support symbolic references), but that's its own business. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-28Merge branch 'bc/object-id' into baseMichael Haggerty
2017-10-28Hopefully final batch before 2.15Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-28Merge branch 'sg/rev-list-doc-reorder-fix'Junio C Hamano
Doc flow fix. * sg/rev-list-doc-reorder-fix: rev-list-options.txt: use correct directional reference
2017-10-28Merge branch 'sb/rev-parse-show-superproject-root'Junio C Hamano
Doc markup fix. * sb/rev-parse-show-superproject-root: docs: fix formatting of rev-parse's --show-superproject-working-tree
2017-10-28Merge branch 'ao/path-use-xmalloc'Junio C Hamano
A possible oom error is now caught as a fatal error, instead of continuing and dereferencing NULL. * ao/path-use-xmalloc: path.c: use xmalloc() in add_to_trie()
2017-10-28Merge branch 'np/config-path-doc'Junio C Hamano
Doc update. * np/config-path-doc: config doc: clarify "git config --path" example
2017-10-27docs: fix formatting of rev-parse's --show-superproject-working-treeSebastian Schuberth
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-27rev-list-options.txt: use correct directional referenceSZEDER Gábor
The descriptions of the options '--parents', '--children' and '--graph' say "see 'History Simplification' below", although the referred section is in fact above the description of these options. Send readers in the right direction by saying "above" instead of "below". Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-26Merge branch 'mh/ref-locking-fix'Junio C Hamano
Transactions to update multiple references that involves a deletion was quite broken in an error codepath and did not abort everything correctly. * mh/ref-locking-fix: files_transaction_prepare(): fix handling of ref lock failure t1404: add a bunch of tests of D/F conflicts
2017-10-25path.c: use xmalloc() in add_to_trie()Andrey Okoshkin
Add usage of xmalloc() instead of malloc() in add_to_trie() as xmalloc wraps and checks memory allocation result. Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-25files_transaction_prepare(): fix handling of ref lock failureMichael Haggerty
Since dc39e09942 (files_ref_store: use a transaction to update packed refs, 2017-09-08), failure to lock a reference has been handled incorrectly by `files_transaction_prepare()`. If `lock_ref_for_update()` fails in the lock-acquisition loop of that function, it sets `ret` then breaks out of that loop. Prior to dc39e09942, that was OK, because the only thing following the loop was the cleanup code. But dc39e09942 added another blurb of code between the loop and the cleanup. That blurb sometimes resets `ret` to zero, making the cleanup code think that the locking was successful. Specifically, whenever * One or more reference deletions have been processed successfully in the lock-acquisition loop. (Processing the first such reference causes a packed-ref transaction to be initialized.) * Then `lock_ref_for_update()` fails for a subsequent reference. Such a failure can happen for a number of reasons, such as the old SHA-1 not being correct, lock contention, etc. This causes a `break` out of the lock-acquisition loop. * The `packed-refs` lock is acquired successfully and `ref_transaction_prepare()` succeeds for the packed-ref transaction. This has the effect of resetting `ret` back to 0, and making the cleanup code think that lock acquisition was successful. In that case, any reference updates that were processed prior to breaking out of the loop would be carried out (loose and packed), but the reference that couldn't be locked and any subsequent references would silently be ignored. This can easily cause data loss if, for example, the user was trying to push a new name for an existing branch while deleting the old name. After the push, the branch could be left unreachable, and could even subsequently be garbage-collected. This problem was noticed in the context of deleting one reference and creating another in a single transaction, when the two references D/F conflict with each other, like git update-ref --stdin <<EOF delete refs/foo create refs/foo/bar HEAD EOF This triggers the above bug because the deletion is processed successfully for `refs/foo`, then the D/F conflict causes `lock_ref_for_update()` to fail when `refs/foo/bar` is processed. In this case the transaction *should* fail, but instead it causes `refs/foo` to be deleted without creating `refs/foo`. This could easily result in data loss. The fix is simple: instead of just breaking out of the loop, jump directly to the cleanup code. This fixes some tests in t1404 that were added in the previous commit. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-25t1404: add a bunch of tests of D/F conflictsMichael Haggerty
It is currently not allowed, in a single transaction, to add one reference and delete another reference if the two reference names D/F conflict with each other (e.g., like `refs/foo/bar` and `refs/foo`). The reason is that the code would need to take locks $GIT_DIR/refs/foo.lock $GIT_DIR/refs/foo/bar.lock But the latter lock couldn't coexist with the loose reference file $GIT_DIR/refs/foo , because `$GIT_DIR/refs/foo` cannot be both a directory and a file at the same time (hence the name "D/F conflict). Add a bunch of tests that we cleanly reject such transactions. In fact, many of the new tests currently fail. They will be fixed in the next commit along with an explanation. Reported-by: Jeff King <peff@peff.net> Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-24Merge tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano
l10n for Git 2.15.0 round 2 * tag 'l10n-2.15.0-rnd2' of git://github.com/git-l10n/git-po: (22 commits) l10n: zh_CN: review for git v2.15.0 l10n round 2 l10n: zh_CN: for git v2.15.0 l10n round 2 l10n: de.po: fix typos l10n: de.po: translate 70 new messages l10n: ru.po: update Russian translation l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 round 2 l10n: sv.po: Update Swedish translation (3245t0f0u) l10n: fr.po: v2.15.0 round 2 l10n: fr.po change translation of "First, rewinding" l10n: fr.po fix some mistakes l10n: Update Catalan translation l10n: ko.po: Update Korean translation l10n: es.po: v2.15.0 round 2 l10n: git.pot: v2.15.0 round 2 (2 new, 2 removed) l10n: ru.po: update Russian translation l10n: bg.po: Updated Bulgarian translation (3245t) l10n: sv.po: Update Swedish translation (3245t0f0u) l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 l10n: es.po: Update translation v2.15.0 round 1 l10n: git.pot: v2.15.0 round 1 (68 new, 36 removed) ...
2017-10-24Merge branch 'jx/zh_CN-proposed' of github.com:jiangxin/gitJiang Xin
* 'jx/zh_CN-proposed' of github.com:jiangxin/git: l10n: zh_CN: review for git v2.15.0 l10n round 2 l10n: zh_CN: for git v2.15.0 l10n round 2
2017-10-24l10n: zh_CN: review for git v2.15.0 l10n round 2Ray Chen
Signed-off-by: Ray Chen <oldsharp@gmail.com>
2017-10-24l10n: zh_CN: for git v2.15.0 l10n round 2Jiang Xin
Translate 69 messages (3245t0f0u) for git v2.15.0-rc2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Reviewed-by: 依云 <lilydjwg@gmail.com>
2017-10-24Merge branch 'master' of https://github.com/ralfth/git-po-deJiang Xin
* 'master' of https://github.com/ralfth/git-po-de: l10n: de.po: fix typos l10n: de.po: translate 70 new messages
2017-10-23l10n: de.po: fix typosAndre Hinrichs
Signed-off-by: Andre Hinrichs <andre.hinrichs@gmx.de> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2017-10-23l10n: de.po: translate 70 new messagesRalf Thielow
Translate 70 new messages came from git.pot update in 25eab542b (l10n: git.pot: v2.15.0 round 1 (68 new, 36 removed)) and 9c07fab78 (l10n: git.pot: v2.15.0 round 2 (2 new, 2 removed)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2017-10-23Sync with 2.14.3Junio C Hamano
2017-10-23Git 2.14.3v2.14.3Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-23Merge branch 'jk/info-alternates-fix' into maintJunio C Hamano
A regression fix for 2.11 that made the code to read the list of alternate object stores overrun the end of the string. * jk/info-alternates-fix: read_info_alternates: warn on non-trivial errors read_info_alternates: read contents into strbuf
2017-10-23Merge branch 'jc/fetch-refspec-doc-update' into maintJunio C Hamano
"git fetch <there> <src>:<dst>" allows an object name on the <src> side when the other side accepts such a request since Git v2.5, but the documentation was left stale. * jc/fetch-refspec-doc-update: fetch doc: src side of refspec could be full SHA-1
2017-10-23Merge branch 'jk/write-in-full-fix' into maintJunio C Hamano
Many codepaths did not diagnose write failures correctly when disks go full, due to their misuse of write_in_full() helper function, which have been corrected. * jk/write-in-full-fix: read_pack_header: handle signed/unsigned comparison in read result config: flip return value of store_write_*() notes-merge: use ssize_t for write_in_full() return value pkt-line: check write_in_full() errors against "< 0" convert less-trivial versions of "write_in_full() != len" avoid "write_in_full(fd, buf, len) != len" pattern get-tar-commit-id: check write_in_full() return against 0 config: avoid "write_in_full(fd, buf, len) < len" pattern
2017-10-23Merge branch 'rj/no-sign-compare' into maintJunio C Hamano
Many codepaths have been updated to squelch -Wsign-compare warnings. * rj/no-sign-compare: ALLOC_GROW: avoid -Wsign-compare warnings cache.h: hex2chr() - avoid -Wsign-compare warnings commit-slab.h: avoid -Wsign-compare warnings git-compat-util.h: xsize_t() - avoid -Wsign-compare warnings
2017-10-23Merge branch 'ma/ts-cleanups' into maintJunio C Hamano
Assorted bugfixes and clean-ups. * ma/ts-cleanups: ThreadSanitizer: add suppressions strbuf_setlen: don't write to strbuf_slopbuf pack-objects: take lock before accessing `remaining` convert: always initialize attr_action in convert_attrs
2017-10-23Merge branch 'ls/travis-scriptify' into maintJunio C Hamano
The scripts to drive TravisCI has been reorganized and then an optimization to avoid spending cycles on a branch whose tip is tagged has been implemented. * ls/travis-scriptify: travis-ci: fix "skip_branch_tip_with_tag()" string comparison travis: dedent a few scripts that are indented overly deeply travis-ci: skip a branch build if equal tag is present travis-ci: move Travis CI code into dedicated scripts
2017-10-23Merge branch 'er/fast-import-dump-refs-on-checkpoint' into maintJunio C Hamano
The checkpoint command "git fast-import" did not flush updates to refs and marks unless at least one object was created since the last checkpoint, which has been corrected, as these things can happen without any new object getting created. * er/fast-import-dump-refs-on-checkpoint: fast-import: checkpoint: dump branches/tags/marks even if object_count==0
2017-10-23Merge branch 'jt/fast-export-copy-modify-fix' into maintJunio C Hamano
"git fast-export" with -M/-C option issued "copy" instruction on a path that is simultaneously modified, which was incorrect. * jt/fast-export-copy-modify-fix: fast-export: do not copy from modified file
2017-10-23Merge branch 'nd/worktree-kill-parse-ref' into maintJunio C Hamano
"git branch -M a b" while on a branch that is completely unrelated to either branch a or branch b misbehaved when multiple worktree was in use. This has been fixed. * nd/worktree-kill-parse-ref: branch: fix branch renaming not updating HEADs correctly
2017-10-22l10n: ru.po: update Russian translationDimitriy Ryazantcev
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
2017-10-22Merge branch 'master' of https://github.com/vnwildman/gitJiang Xin
* 'master' of https://github.com/vnwildman/git: l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 round 2
2017-10-19Git 2.15-rc2v2.15.0-rc2Junio C Hamano
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-19Merge branch 'jc/branch-force-doc-readability-fix'Junio C Hamano
Doc update. * jc/branch-force-doc-readability-fix: branch doc: sprinkle a few commas for readability
2017-10-19Merge branch 'dg/filter-branch-filter-order-doc'Junio C Hamano
Update the documentation for "git filter-branch" so that the filter options are listed in the same order as they are applied, as described in an earlier part of the doc. * dg/filter-branch-filter-order-doc: doc: list filter-branch subdirectory-filter first
2017-10-19Merge branch 'jc/fetch-refspec-doc-update'Junio C Hamano
"git fetch <there> <src>:<dst>" allows an object name on the <src> side when the other side accepts such a request since Git v2.5, but the documentation was left stale. * jc/fetch-refspec-doc-update: fetch doc: src side of refspec could be full SHA-1
2017-10-19Merge branch 'wk/merge-options-gpg-sign-doc'Junio C Hamano
Doc updates. * wk/merge-options-gpg-sign-doc: Documentation/merge-options.txt: describe -S/--gpg-sign for 'pull'
2017-10-19config doc: clarify "git config --path" exampleNathan Payre
Change the word "bla" to "section.variable"; "bla" is a placeholder for a variable name but it wasn't clear for everyone. While we're here, also reformat this sample command line to use monospace instead of italics, to better match the rest of the file. Use a space instead of a dash in "git config", as is common in the rest of Git's documentation. Reported-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: MOY Matthieu <matthieu.moy@univ-lyon1.fr> Signed-off-by: Daniel Bensoussan <daniel.bensoussan--bohm@etu.univ-lyon1.fr> Signed-off-by: Timothee Albertin <timothee.albertin@etu.univ-lyon1.fr> Signed-off-by: Nathan Payre <nathan.payre@etu.univ-lyon1.fr> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-10-19Merge branch 'l10n_fr_v2.15.0r2' of git://github.com/jnavila/gitJiang Xin
* 'l10n_fr_v2.15.0r2' of git://github.com/jnavila/git: l10n: fr.po: v2.15.0 round 2 l10n: fr.po change translation of "First, rewinding" l10n: fr.po fix some mistakes
2017-10-19Merge branch 'master' of git://github.com/nafmo/git-l10n-svJiang Xin
* 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (3245t0f0u)
2017-10-19Merge branch 'master' of https://github.com/Softcatala/git-poJiang Xin
* 'master' of https://github.com/Softcatala/git-po: l10n: Update Catalan translation
2017-10-19Merge branch 'translation' of https://github.com/ChrisADR/git-poJiang Xin
* 'translation' of https://github.com/ChrisADR/git-po: l10n: es.po: v2.15.0 round 2
2017-10-19l10n: vi.po(3245t): Updated Vietnamese translation for v2.15.0 round 2Tran Ngoc Quan
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2017-10-18l10n: sv.po: Update Swedish translation (3245t0f0u)Peter Krefting
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>