Eric Sunshine [Mon, 4 May 2015 07:25:13 +0000 (03:25 -0400)]
git-hash-object.txt: document --literally option
Document the git-hash-object --literally option added by
5ba9a93
(hash-object: add --literally option, 2014-09-11).
While here, also correct a minor typesetting oversight.
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Sep 2014 20:14:51 +0000 (13:14 -0700)]
hash-object: add --literally option
This allows "hash-object --stdin" to just hash any garbage into a
"loose object" that may not pass the standard object parsing check
or fsck, so that different kind of corrupt objects we may encounter
in the field can be imitated in our test suite. That would in turn
allow us to test features that catch these corrupt objects.
Note that "cat-file" may need to learn "--literally" option to allow
us peek into a truly broken object.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Sep 2014 19:44:05 +0000 (12:44 -0700)]
hash-object: pass 'write_object' as a flag
Instead of forcing callers of lower level functions write
(write_object ? HASH_WRITE_OBJECT : 0), prepare the flag to be
passed down in the callchain from the command line parser.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Sep 2014 19:19:54 +0000 (12:19 -0700)]
hash-object: reduce file-scope statics
Most of the knobs that affect helper functions called from
cmd_hash_object() were passed to them as parameters already, and the
only effect of having them as file-scope statics was to make the
reader wonder if the parameters are hiding the file-scope global
values by accident. Adjust their initialisation and make them
function-local variables.
The only exception was no_filters hash_stdin_paths() peeked from the
file-scope global, which was converted to a parameter to the helper
function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Sep 2014 18:19:47 +0000 (11:19 -0700)]
Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 11 Sep 2014 17:33:37 +0000 (10:33 -0700)]
Merge branch 'br/imap-send-simplify-tunnel-child-process'
Code clean-up.
* br/imap-send-simplify-tunnel-child-process:
imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()
imap-send.c: imap_folder -> imap_server_conf.folder
git-imap-send: simplify tunnel construction
Junio C Hamano [Thu, 11 Sep 2014 17:33:36 +0000 (10:33 -0700)]
Merge branch 'jk/name-decoration-alloc'
The API to allocate the structure to keep track of commit
decoration was cumbersome to use, inviting lazy code to
overallocate memory.
* jk/name-decoration-alloc:
log-tree: use FLEX_ARRAY in name_decoration
log-tree: make name_decoration hash static
log-tree: make add_name_decoration a public function
Junio C Hamano [Thu, 11 Sep 2014 17:33:35 +0000 (10:33 -0700)]
Merge branch 'jn/unpack-trees-checkout-m-carry-deletion'
"git checkout -m" did not switch to another branch while carrying
the local changes forward when a path was deleted from the index.
* jn/unpack-trees-checkout-m-carry-deletion:
checkout -m: attempt merge when deletion of path was staged
unpack-trees: use 'cuddled' style for if-else cascade
unpack-trees: simplify 'all other failures' case
Junio C Hamano [Thu, 11 Sep 2014 17:33:35 +0000 (10:33 -0700)]
Merge branch 'rs/list-optim'
Fix a couple of "accumulate into a sorted list" to "accumulate and
then sort the list".
* rs/list-optim:
walker: avoid quadratic list insertion in mark_complete
sha1_name: avoid quadratic list insertion in handle_one_ref
Junio C Hamano [Thu, 11 Sep 2014 17:33:34 +0000 (10:33 -0700)]
Merge branch 'jk/fast-import-fixes'
With sufficiently long refnames, fast-import could have overflown
an on-stack buffer.
* jk/fast-import-fixes:
fast-import: fix buffer overflow in dump_tags
fast-import: clean up pack_data pointer in end_packfile
Junio C Hamano [Thu, 11 Sep 2014 17:33:33 +0000 (10:33 -0700)]
Merge branch 'jk/prune-top-level-refs-after-packing'
After "pack-refs --prune" packed refs at the top-level, it failed
to prune them.
* jk/prune-top-level-refs-after-packing:
pack-refs: prune top-level refs like "refs/foo"
Junio C Hamano [Thu, 11 Sep 2014 17:33:32 +0000 (10:33 -0700)]
Merge branch 'nd/large-blobs'
Teach a few codepaths to punt (instead of dying) when large blobs
that would not fit in core are involved in the operation.
* nd/large-blobs:
diff: shortcut for diff'ing two binary SHA-1 objects
diff --stat: mark any file larger than core.bigfilethreshold binary
diff.c: allow to pass more flags to diff_populate_filespec
sha1_file.c: do not die failing to malloc in unpack_compressed_entry
wrapper.c: introduce gentle xmallocz that does not die()
Junio C Hamano [Thu, 11 Sep 2014 17:33:32 +0000 (10:33 -0700)]
Merge branch 'nd/fetch-pass-quiet-to-gc-child-process'
Progress output from "git gc --auto" was visible in "git fetch -q".
* nd/fetch-pass-quiet-to-gc-child-process:
fetch: silence git-gc if --quiet is given
fetch: convert argv_gc_auto to struct argv_array
Junio C Hamano [Thu, 11 Sep 2014 17:33:32 +0000 (10:33 -0700)]
Merge branch 'dt/cache-tree-repair'
Add a few more places in "commit" and "checkout" that make sure
that the cache-tree is fully populated in the index.
* dt/cache-tree-repair:
cache-tree: do not try to use an invalidated subtree info to build a tree
cache-tree: Write updated cache-tree after commit
cache-tree: subdirectory tests
test-dump-cache-tree: invalid trees are not errors
cache-tree: create/update cache-tree on checkout
Junio C Hamano [Thu, 11 Sep 2014 17:33:30 +0000 (10:33 -0700)]
Merge branch 'rs/ref-transaction-1'
The second batch of the transactional ref update series.
* rs/ref-transaction-1: (22 commits)
update-ref --stdin: pass transaction around explicitly
update-ref --stdin: narrow scope of err strbuf
refs.c: make delete_ref use a transaction
refs.c: make prune_ref use a transaction to delete the ref
refs.c: remove lock_ref_sha1
refs.c: remove the update_ref_write function
refs.c: remove the update_ref_lock function
refs.c: make lock_ref_sha1 static
walker.c: use ref transaction for ref updates
fast-import.c: use a ref transaction when dumping tags
receive-pack.c: use a reference transaction for updating the refs
refs.c: change update_ref to use a transaction
branch.c: use ref transaction for all ref updates
fast-import.c: change update_branch to use ref transactions
sequencer.c: use ref transactions for all ref updates
commit.c: use ref transactions for updates
replace.c: use the ref transaction functions for updates
tag.c: use ref transactions when doing updates
refs.c: add transaction.status and track OPEN/CLOSED
refs.c: make ref_transaction_begin take an err argument
...
Junio C Hamano [Thu, 11 Sep 2014 17:33:30 +0000 (10:33 -0700)]
Merge branch 'nd/mv-code-cleaning'
Code clean-up.
* nd/mv-code-cleaning:
mv: no SP between function name and the first opening parenthese
mv: combine two if(s)
mv: unindent one level for directory move code
mv: move index search code out
mv: remove an "if" that's always true
mv: split submodule move preparation code out
mv: flatten error handling code block
mv: mark strings for translations
Junio C Hamano [Thu, 11 Sep 2014 17:33:29 +0000 (10:33 -0700)]
Merge branch 'mm/discourage-commit-a-to-finish-conflict-resolution'
* mm/discourage-commit-a-to-finish-conflict-resolution:
merge, pull: stop advising 'commit -a' in case of conflict
Junio C Hamano [Thu, 11 Sep 2014 17:33:29 +0000 (10:33 -0700)]
Merge branch 'jk/make-simplify-dependencies'
Admit that keeping LIB_H up-to-date, only for those that do not use
the automatically generated dependencies, is a losing battle, and
make it conservative by making everything depend on anything.
* jk/make-simplify-dependencies:
Makefile: drop CHECK_HEADER_DEPENDENCIES code
Makefile: use `find` to determine static header dependencies
i18n: treat "make pot" as an explicitly-invoked target
Junio C Hamano [Thu, 11 Sep 2014 17:33:28 +0000 (10:33 -0700)]
Merge branch 'et/spell-poll-infinite-with-minus-one-only'
We used to pass -1000 to poll(2), expecting it to also mean "no
timeout", which should be spelled as -1.
* et/spell-poll-infinite-with-minus-one-only:
upload-pack: keep poll(2)'s timeout to -1
Junio C Hamano [Thu, 11 Sep 2014 17:33:27 +0000 (10:33 -0700)]
Merge branch 'br/http-init-fix'
Code clean-up.
* br/http-init-fix:
http: style fixes for curl_multi_init error check
http.c: die if curl_*_init fails
Junio C Hamano [Thu, 11 Sep 2014 17:33:27 +0000 (10:33 -0700)]
Merge branch 'rs/child-process-init'
Code clean-up.
* rs/child-process-init:
run-command: inline prepare_run_command_v_opt()
run-command: call run_command_v_opt_cd_env() instead of duplicating it
run-command: introduce child_process_init()
run-command: introduce CHILD_PROCESS_INIT
Junio C Hamano [Thu, 11 Sep 2014 17:33:26 +0000 (10:33 -0700)]
Merge branch 'jk/contrib-subtree-make-all'
* jk/contrib-subtree-make-all:
subtree: make "all" default target of Makefile
Junio C Hamano [Thu, 11 Sep 2014 17:33:26 +0000 (10:33 -0700)]
Merge branch 'ta/config-set-2'
Update git_config() users with callback functions for a very narrow
scope with calls to config-set API that lets us query a single
variable.
* ta/config-set-2:
builtin/apply.c: replace `git_config()` with `git_config_get_string_const()`
merge-recursive.c: replace `git_config()` with `git_config_get_int()`
ll-merge.c: refactor `read_merge_config()` to use `git_config_string()`
fast-import.c: replace `git_config()` with `git_config_get_*()` family
branch.c: replace `git_config()` with `git_config_get_string()
alias.c: replace `git_config()` with `git_config_get_string()`
imap-send.c: replace `git_config()` with `git_config_get_*()` family
pager.c: replace `git_config()` with `git_config_get_value()`
builtin/gc.c: replace `git_config()` with `git_config_get_*()` family
rerere.c: replace `git_config()` with `git_config_get_*()` family
fetchpack.c: replace `git_config()` with `git_config_get_*()` family
archive.c: replace `git_config()` with `git_config_get_bool()` family
read-cache.c: replace `git_config()` with `git_config_get_*()` family
http-backend.c: replace `git_config()` with `git_config_get_bool()` family
daemon.c: replace `git_config()` with `git_config_get_bool()` family
Junio C Hamano [Thu, 11 Sep 2014 17:33:25 +0000 (10:33 -0700)]
Merge branch 'ta/config-set-1'
Use the new caching config-set API in git_config() calls.
* ta/config-set-1:
add tests for `git_config_get_string_const()`
add a test for semantic errors in config files
rewrite git_config() to use the config-set API
config: add `git_die_config()` to the config-set API
change `git_config()` return value to void
add line number and file name info to `config_set`
config.c: fix accuracy of line number in errors
config.c: mark error and warnings strings for translation
Junio C Hamano [Tue, 9 Sep 2014 20:06:26 +0000 (13:06 -0700)]
Update draft release notes to 2.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 9 Sep 2014 19:54:09 +0000 (12:54 -0700)]
Merge branch 'sp/pack-protocol-doc-on-shallow'
* sp/pack-protocol-doc-on-shallow:
Document LF appearing in shallow command during send-pack/receive-pack
Junio C Hamano [Tue, 9 Sep 2014 19:54:08 +0000 (12:54 -0700)]
Merge branch 'tf/imap-send-create'
* tf/imap-send-create:
imap-send: create target mailbox if it is missing
imap-send: clarify CRAM-MD5 vs LOGIN documentation
Junio C Hamano [Tue, 9 Sep 2014 19:54:08 +0000 (12:54 -0700)]
Merge branch 'jk/prompt-stash-could-be-packed'
The prompt script checked $GIT_DIR/ref/stash file to see if there
is a stash, which was a no-no.
* jk/prompt-stash-could-be-packed:
git-prompt: do not look for refs/stash in $GIT_DIR
Junio C Hamano [Tue, 9 Sep 2014 19:54:07 +0000 (12:54 -0700)]
Merge branch 'tb/pretty-format-cd-date-format'
Documentation update.
* tb/pretty-format-cd-date-format:
pretty: note that %cd respects the --date= option
Junio C Hamano [Tue, 9 Sep 2014 19:54:07 +0000 (12:54 -0700)]
Merge branch 'rs/inline-compat-path-macros'
* rs/inline-compat-path-macros:
turn path macros into inline function
Junio C Hamano [Tue, 9 Sep 2014 19:54:06 +0000 (12:54 -0700)]
Merge branch 'rs/clean-menu-item-defn'
* rs/clean-menu-item-defn:
clean: use f(void) instead of f() to declare a pointer to a function without arguments
Junio C Hamano [Tue, 9 Sep 2014 19:54:05 +0000 (12:54 -0700)]
Merge branch 'jc/config-mak-document-darwin-vs-macosx'
* jc/config-mak-document-darwin-vs-macosx:
config.mak.uname: add hint on uname_R for MacOS X
config.mak.uname: set NO_APPLE_COMMON_CRYPTO on older systems
Junio C Hamano [Tue, 9 Sep 2014 19:54:04 +0000 (12:54 -0700)]
Merge branch 'sb/mailsplit-dead-code-removal'
* sb/mailsplit-dead-code-removal:
mailsplit.c: remove dead code
Junio C Hamano [Tue, 9 Sep 2014 19:54:03 +0000 (12:54 -0700)]
Merge branch 'so/rebase-doc'
May need further updates to the description to explain what makes
various modes of operation to decide that the request can become a
"no-op".
* so/rebase-doc:
Documentation/git-rebase.txt: -f forces a rebase that would otherwise be a no-op
Junio C Hamano [Tue, 9 Sep 2014 19:54:03 +0000 (12:54 -0700)]
Merge branch 'sb/prepare-revision-walk-error-check'
* sb/prepare-revision-walk-error-check:
prepare_revision_walk(): check for return value in all places
Junio C Hamano [Tue, 9 Sep 2014 19:54:03 +0000 (12:54 -0700)]
Merge branch 'sb/blame-msg-i18n'
* sb/blame-msg-i18n:
builtin/blame.c: add translation to warning about failed revision walk
Junio C Hamano [Tue, 9 Sep 2014 19:54:02 +0000 (12:54 -0700)]
Merge branch 'nd/strbuf-utf8-replace'
* nd/strbuf-utf8-replace:
utf8.c: fix strbuf_utf8_replace() consuming data beyond input string
Junio C Hamano [Tue, 9 Sep 2014 19:54:01 +0000 (12:54 -0700)]
Merge branch 'sb/plug-leaks'
* sb/plug-leaks:
clone.c: don't leak memory in cmd_clone
remote.c: don't leak the base branch name in format_tracking_info
Junio C Hamano [Tue, 9 Sep 2014 19:54:01 +0000 (12:54 -0700)]
Merge branch 'rs/refresh-beyond-symlink'
"git add x" where x that used to be a directory has become a
symbolic link to a directory misbehaved.
* rs/refresh-beyond-symlink:
read-cache: check for leading symlinks when refreshing index
Junio C Hamano [Tue, 9 Sep 2014 19:54:00 +0000 (12:54 -0700)]
Merge branch 'la/init-doc'
* la/init-doc:
Documentation: git-init: flesh out example
Documentation: git-init: template directory: reword and cross-reference
Documentation: git-init: reword parenthetical statements
Documentation: git-init: --separate-git-dir: clarify
Documentation: git-init: template directory: reword
Documentation: git-init: list items facelift
Documentation: git-init: typographical fixes
Junio C Hamano [Tue, 9 Sep 2014 19:54:00 +0000 (12:54 -0700)]
Merge branch 'jk/stash-list-p'
Teach "git stash list -p" to show the difference between the base
commit version and the working tree version, which is in line with
what "git show" gives.
* jk/stash-list-p:
stash: default listing to working-tree diff
Junio C Hamano [Tue, 9 Sep 2014 19:53:59 +0000 (12:53 -0700)]
Merge branch 'mm/log-branch-desc-plug-leak'
* mm/log-branch-desc-plug-leak:
builtin/log.c: fix minor memory leak
Junio C Hamano [Tue, 9 Sep 2014 19:53:58 +0000 (12:53 -0700)]
Merge branch 'lf/bundle-exclusion'
"git bundle create" with date-range specification were meant to
exclude tags outside the range
* lf/bundle-exclusion:
bundle: fix exclusion of annotated tags
Junio C Hamano [Tue, 9 Sep 2014 19:53:58 +0000 (12:53 -0700)]
Merge branch 'jc/apply-ws-prefix'
Applying a patch not generated by Git in a subdirectory used to
check the whitespace breakage using the attributes for incorrect
paths. Also whitespace checks were performed even for paths
excluded via "git apply --exclude=<path>" mechanism.
* jc/apply-ws-prefix:
apply: omit ws check for excluded paths
apply: hoist use_patch() helper for path exclusion up
apply: use the right attribute for paths in non-Git patches
Junio C Hamano [Tue, 9 Sep 2014 19:53:56 +0000 (12:53 -0700)]
Merge branch 'jk/command-line-config-empty-string'
"git -c section.var command" and "git -c section.var= command"
should pass the configuration differently (the former should be
a boolean true, the latter should be an empty string).
* jk/command-line-config-empty-string:
config: teach "git -c" to recognize an empty string
Junio C Hamano [Tue, 9 Sep 2014 19:53:55 +0000 (12:53 -0700)]
Merge branch 'bc/imap-send-doc'
* bc/imap-send-doc:
imap-send doc: omit confusing "to use imap-send" modifier
Junio C Hamano [Tue, 9 Sep 2014 19:53:54 +0000 (12:53 -0700)]
Merge branch 'jc/not-mingw-cygwin'
We have been using NOT_{MINGW,CYGWIN} test prerequisites long
before Peff invented support for negated prerequisites e.g. !MINGW
and we still add more uses of the former. Convert them to the
latter to avoid confusion.
* jc/not-mingw-cygwin:
test prerequisites: enumerate with commas
test prerequisites: eradicate NOT_FOO
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:36 +0000 (09:29 +0700)]
mv: no SP between function name and the first opening parenthese
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:35 +0000 (09:29 +0700)]
mv: combine two if(s)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:34 +0000 (09:29 +0700)]
mv: unindent one level for directory move code
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:33 +0000 (09:29 +0700)]
mv: move index search code out
"Huh?" is removed from die() message.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:32 +0000 (09:29 +0700)]
mv: remove an "if" that's always true
This is inside an "else" block of "if (last - first < 1)", so we know
that "last - first >= 1" when we come here. No need to check
"last - first > 0".
While at there, save "argc + last - first" to a variable to shorten
the statements a bit.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy [Sun, 10 Aug 2014 02:29:31 +0000 (09:29 +0700)]
mv: split submodule move preparation code out
"Huh?" is removed from die() message.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 2 Sep 2014 21:16:20 +0000 (14:16 -0700)]
cache-tree: do not try to use an invalidated subtree info to build a tree
We punt from repairing the cache-tree during a branch switching if
it involves having to create a new tree object that does not yet
exist in the object store. "mkdir dir && >dir/file && git add dir"
followed by "git checkout" is one example, when a tree that records
the state of such "dir/" is not in the object store.
However, after discovering that we do not have a tree object that
records the state of "dir/", the caller failed to remember the fact
that it noticed the cache-tree entry it received for "dir/" is
invalidated, it already knows it should not be populating the level
that has "dir/" as its immediate subdirectory, and it is not an
error at all for the sublevel cache-tree entry gave it a bogus
object name it shouldn't even look at.
This led the caller to detect and report a non-existent error. The
end result was the same and we avoided stuffing a non-existent tree
to the cache-tree, but we shouldn't have issued an alarming error
message to the user.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder [Tue, 2 Sep 2014 21:11:21 +0000 (14:11 -0700)]
update-ref --stdin: pass transaction around explicitly
This makes it more obvious at a glance where the output of functions
parsing the --stdin stream goes.
No functional change intended.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder [Tue, 2 Sep 2014 21:10:52 +0000 (14:10 -0700)]
update-ref --stdin: narrow scope of err strbuf
Making the strbuf local in each function that needs to print errors
saves the reader from having to think about action at a distance,
such as
* errors piling up and being concatenated with no newline between
them
* errors unhandled in one function, to be later handled in another
* concurrency issues, if this code starts using threads some day
No functional change intended.
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 30 Apr 2014 16:22:45 +0000 (09:22 -0700)]
refs.c: make delete_ref use a transaction
Change delete_ref to use a ref transaction for the deletion. At the same time
since we no longer have any callers of repack_without_ref we can now delete
this function.
Change delete_ref to return 0 on success and 1 on failure instead of the
previous 0 on success either 1 or -1 on failure.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 30 Apr 2014 16:03:36 +0000 (09:03 -0700)]
refs.c: make prune_ref use a transaction to delete the ref
Change prune_ref to delete the ref using a ref transaction. To do this we also
need to add a new flag REF_ISPRUNING that will tell the transaction that we
do not want to delete this ref from the packed refs. This flag is private to
refs.c and not exposed to external callers.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Tue, 29 Apr 2014 22:45:52 +0000 (15:45 -0700)]
refs.c: remove lock_ref_sha1
lock_ref_sha1 was only called from one place in refs.c and only provided
a check that the refname was sane before adding back the initial "refs/"
part of the ref path name, the initial "refs/" that this caller had already
stripped off before calling lock_ref_sha1.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Tue, 29 Apr 2014 20:42:07 +0000 (13:42 -0700)]
refs.c: remove the update_ref_write function
Since we only call update_ref_write from a single place and we only call it
with onerr==QUIET_ON_ERR we can just as well get rid of it and just call
write_ref_sha1 directly. This changes the return status for _commit from
1 to -1 on failures when writing to the ref. Eventually we will want
_commit to start returning more detailed error conditions than the current
simple success/failure.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Tue, 29 Apr 2014 19:14:47 +0000 (12:14 -0700)]
refs.c: remove the update_ref_lock function
Since we now only call update_ref_lock with onerr==QUIET_ON_ERR we no longer
need this function and can replace it with just calling lock_any_ref_for_update
directly.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Mon, 28 Apr 2014 22:38:47 +0000 (15:38 -0700)]
refs.c: make lock_ref_sha1 static
No external callers reference lock_ref_sha1 any more so let's declare it
static.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Thu, 17 Apr 2014 18:31:06 +0000 (11:31 -0700)]
walker.c: use ref transaction for ref updates
Switch to using ref transactions in walker_fetch(). As part of the refactoring
to use ref transactions we also fix a potential memory leak where in the
original code if write_ref_sha1() would fail we would end up returning from
the function without free()ing the msg string.
Note that this function is only called when fetching from a remote HTTP
repository onto the local (most of the time single-user) repository which
likely means that the type of collisions that the previous locking would
protect against and cause the fetch to fail for are even more rare.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Mon, 28 Apr 2014 22:23:58 +0000 (15:23 -0700)]
fast-import.c: use a ref transaction when dumping tags
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Mon, 28 Apr 2014 21:36:15 +0000 (14:36 -0700)]
receive-pack.c: use a reference transaction for updating the refs
Wrap all the ref updates inside a transaction.
In the new API there is no distinction between failure to lock and
failure to write a ref. Both can be permanent (e.g., a ref
"refs/heads/topic" is blocking creation of the lock file
"refs/heads/topic/1.lock") or transient (e.g., file system full) and
there's no clear difference in how the client should respond, so
replace the two statuses "failed to lock" and "failed to write" with
a single status "failed to update ref". In both cases a more
detailed message is sent by sideband to diagnose the problem.
Example, before:
error: there are still refs under 'refs/heads/topic'
remote: error: failed to lock refs/heads/topic
To foo
! [remote rejected] HEAD -> topic (failed to lock)
After:
error: there are still refs under 'refs/heads/topic'
remote: error: Cannot lock the ref 'refs/heads/topic'.
To foo
! [remote rejected] HEAD -> topic (failed to update ref)
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Thu, 24 Apr 2014 23:36:55 +0000 (16:36 -0700)]
refs.c: change update_ref to use a transaction
Change the update_ref helper function to use a ref transaction internally.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 23:21:53 +0000 (16:21 -0700)]
branch.c: use ref transaction for all ref updates
Change create_branch to use a ref transaction when creating the new branch.
This also fixes a race condition in the old code where two concurrent
create_branch could race since the lock_any_ref_for_update/write_ref_sha1
did not protect against the ref already existing. I.e. one thread could end up
overwriting a branch even if the forcing flag is false.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 23:21:13 +0000 (16:21 -0700)]
fast-import.c: change update_branch to use ref transactions
Change update_branch() to use ref transactions for updates.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:37:45 +0000 (15:37 -0700)]
sequencer.c: use ref transactions for all ref updates
Change to use ref transactions for all updates to refs.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:34:19 +0000 (15:34 -0700)]
commit.c: use ref transactions for updates
Change commit.c to use ref transactions for all ref updates.
Make sure we pass a NULL pointer to ref_transaction_update if have_old
is false.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:32:29 +0000 (15:32 -0700)]
replace.c: use the ref transaction functions for updates
Update replace.c to use ref transactions for updates.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:30:41 +0000 (15:30 -0700)]
tag.c: use ref transactions when doing updates
Change tag.c to use ref transactions for all ref updates.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Tue, 29 Apr 2014 19:06:19 +0000 (12:06 -0700)]
refs.c: add transaction.status and track OPEN/CLOSED
Track the state of a transaction in a new state field. Check the field for
sanity, i.e. that state must be OPEN when _commit/_create/_delete or
_update is called or else die(BUG:...)
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Mon, 19 May 2014 17:42:34 +0000 (10:42 -0700)]
refs.c: make ref_transaction_begin take an err argument
Add an err argument to _begin so that on non-fatal failures in future ref
backends we can report a nice error back to the caller.
While _begin can currently never fail for other reasons than OOM, in which
case we die() anyway, we may add other types of backends in the future.
For example, a hypothetical MySQL backend could fail in _begin with
"Can not connect to MySQL server. No route to host".
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:27:45 +0000 (15:27 -0700)]
refs.c: update ref_transaction_delete to check for error and return status
Change ref_transaction_delete() to do basic error checking and return
non-zero on error. Update all callers to check the return for
ref_transaction_delete(). There are currently no conditions in _delete that
will return error but there will be in the future. Add an err argument that
will be updated on failure.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 16 Apr 2014 22:26:44 +0000 (15:26 -0700)]
refs.c: change ref_transaction_create to do error checking and return status
Do basic error checking in ref_transaction_create() and make it return
non-zero on error. Update all callers to check the result of
ref_transaction_create(). There are currently no conditions in _create that
will return error but there will be in the future. Add an err argument that
will be updated on failure.
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 2 Sep 2014 20:30:13 +0000 (13:30 -0700)]
Start the post-2.1 cycle
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 2 Sep 2014 20:27:45 +0000 (13:27 -0700)]
Merge branch 'rs/strbuf-getcwd'
Reduce the use of fixed sized buffer passed to getcwd() calls
by introducing xgetcwd() helper.
* rs/strbuf-getcwd:
use strbuf_add_absolute_path() to add absolute paths
abspath: convert absolute_path() to strbuf
use xgetcwd() to set $GIT_DIR
use xgetcwd() to get the current directory or die
wrapper: add xgetcwd()
abspath: convert real_path_internal() to strbuf
abspath: use strbuf_getcwd() to remember original working directory
setup: convert setup_git_directory_gently_1 et al. to strbuf
unix-sockets: use strbuf_getcwd()
strbuf: add strbuf_getcwd()
Junio C Hamano [Tue, 2 Sep 2014 20:27:39 +0000 (13:27 -0700)]
Merge branch 'ta/pretty-parse-config'
* ta/pretty-parse-config:
pretty.c: make git_pretty_formats_config return -1 on git_config_string failure
Junio C Hamano [Tue, 2 Sep 2014 20:27:12 +0000 (13:27 -0700)]
Merge branch 'bc/archive-pax-header-mode'
Implementations of "tar" that do not understand an extended pax
header would extract the contents of it in a regular file; make
sure the permission bits of this file follows the same tar.umask
configuration setting.
* bc/archive-pax-header-mode:
archive: honor tar.umask even for pax headers
Junio C Hamano [Tue, 2 Sep 2014 20:26:37 +0000 (13:26 -0700)]
Merge branch 'pr/remotes-in-hashmap'
Optimize remotes configuration look-up in a repository with very
many remotes defined.
* pr/remotes-in-hashmap:
use a hashmap to make remotes faster
Junio C Hamano [Tue, 2 Sep 2014 20:25:03 +0000 (13:25 -0700)]
Merge branch 'jk/pretty-empty-format'
"git log --pretty/format=" with an empty format string did not mean
the more obvious "No output whatsoever" but "Use default format",
which was counterintuitive.
* jk/pretty-empty-format:
pretty: make empty userformats truly empty
pretty: treat "--format=" as an empty userformat
revision: drop useless string offset when parsing "--pretty"
Junio C Hamano [Tue, 2 Sep 2014 20:24:17 +0000 (13:24 -0700)]
Merge branch 'ta/config-set'
Add in-core caching layer to let us avoid reading the same
configuration files number of times.
* ta/config-set:
test-config: add tests for the config_set API
add `config_set` API for caching config-like files
Junio C Hamano [Tue, 2 Sep 2014 20:24:04 +0000 (13:24 -0700)]
Merge branch 'rs/init-no-duplicate-real-path'
* rs/init-no-duplicate-real-path:
init: avoid superfluous real_path() calls
Junio C Hamano [Tue, 2 Sep 2014 20:23:19 +0000 (13:23 -0700)]
Merge branch 'mm/config-edit-global'
Start "git config --edit --global" from a skeletal per-user
configuration file contents, instead of a total blank, when the
user does not already have any. This immediately reduces the need
for a later "Have you forgotten setting core.user?" and we can add
more to the template as we gain more experience.
* mm/config-edit-global:
commit: advertise config --global --edit on guessed identity
home_config_paths(): let the caller ignore xdg path
config --global --edit: create a template file if needed
Junio C Hamano [Tue, 2 Sep 2014 20:20:12 +0000 (13:20 -0700)]
Merge branch 'jc/reopen-lock-file'
There are cases where you lock and open to write a file, close it to
show the updated contents to external processes, and then have to
update the file again while still holding the lock, but the lockfile
API lacked support for such an access pattern.
* jc/reopen-lock-file:
lockfile: allow reopening a closed but still locked file
René Scharfe [Sat, 30 Aug 2014 16:14:24 +0000 (18:14 +0200)]
imap-send: simplify v_issue_imap_cmd() and get_cmd_result() using starts_with()
Use starts_with() instead of memcmp() to check if NUL-terminated
strings match prefixes. This gets rid of some magic string length
constants.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 29 Aug 2014 17:18:22 +0000 (10:18 -0700)]
Merge git://github.com/git-l10n/git-po
* git://github.com/git-l10n/git-po:
po/TEAMS: add new members to German translation team
l10n: de.po: translate 38 new messages
Ralf Thielow [Tue, 26 Aug 2014 16:54:30 +0000 (18:54 +0200)]
po/TEAMS: add new members to German translation team
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Ralf Thielow [Fri, 20 Jun 2014 15:22:48 +0000 (17:22 +0200)]
l10n: de.po: translate 38 new messages
Translate 38 new messages came from git.pot update in
fe05e19
(l10n: git.pot: v2.1.0 round 1 (38 new, 9 removed)).
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Shawn Pearce [Wed, 27 Aug 2014 20:46:56 +0000 (13:46 -0700)]
Document LF appearing in shallow command during send-pack/receive-pack
The implementation sends an LF, but the protocol documentation was
missing this detail.
Signed-off-by: Shawn Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthieu Moy [Thu, 28 Aug 2014 09:46:58 +0000 (11:46 +0200)]
merge, pull: stop advising 'commit -a' in case of conflict
'git commit -a' is rarely a good way to mark conflicts as resolved:
the user anyway has to go manually through the list of conflicts to
do the actual resolution, and it is usually better to use "git add"
on each files after doing the resolution.
On the other hand, using 'git commit -a' is potentially dangerous,
as it makes it very easy to mistakenly commit conflict markers
without noticing, and even worse, the user may have started a merge
while having local changes that do not overlap with it in the
working tree.
While we're there, synchronize the 'git pull' and 'git merge'
messages: the first was ending with '... and make a commit.', but
not the latter.
Eventually, git should detect that conflicts have been resolved in
the working tree and tailor these messages further. Not only "use
git commit -a" could be resurected, but "Fix them up in the work
tree" should be dropped when it happens.
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 26 Aug 2014 10:24:20 +0000 (06:24 -0400)]
log-tree: use FLEX_ARRAY in name_decoration
We are already using the flex-array technique; let's
annotate it with our usual FLEX_ARRAY macro. Besides being
more readable, this is slightly more efficient on compilers
that understand flex-arrays.
Note that we need to bump the allocation in add_name_decoration,
which did not explicitly add one byte for the NUL terminator
of the string we are putting into the flex-array (it did not
need to before, because the struct itself was over-allocated
by one byte).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 22 Aug 2014 04:33:16 +0000 (00:33 -0400)]
Makefile: drop CHECK_HEADER_DEPENDENCIES code
This code was useful when we kept a static list of header
files, and it was easy to forget to update it. Since the last
commit, we generate the list dynamically.
Technically this could still be used to find a dependency
that our dynamic check misses (e.g., a header file without a
".h" extension). But that is reasonably unlikely to be
added, and even less likely to be noticed by this tool
(because it has to be run manually)., It is not worth
carrying around the cruft in the Makefile.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Tue, 26 Aug 2014 18:16:26 +0000 (11:16 -0700)]
Merge branch 'jk/diff-tree-t-fix'
Fix (rarely used) "git diff-tree -t" regression in 2.0.
* jk/diff-tree-t-fix:
intersect_paths: respect mode in git's tree-sort
Junio C Hamano [Tue, 26 Aug 2014 18:16:25 +0000 (11:16 -0700)]
Merge branch 'jk/pack-shallow-always-without-bitmap'
Reachability bitmaps do not work with shallow operations.
Fixes regression in 2.0.
* jk/pack-shallow-always-without-bitmap:
pack-objects: turn off bitmaps when we see --shallow lines
Junio C Hamano [Tue, 26 Aug 2014 18:16:25 +0000 (11:16 -0700)]
Merge branch 'jk/fix-profile-feedback-build'
Fix profile-feedback build broken in 2.1 for tarball releases.
* jk/fix-profile-feedback-build:
Makefile: make perf tests optional for profile build
René Scharfe [Mon, 28 Jul 2014 18:34:42 +0000 (20:34 +0200)]
use strbuf_add_absolute_path() to add absolute paths
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Mon, 28 Jul 2014 18:33:55 +0000 (20:33 +0200)]
abspath: convert absolute_path() to strbuf
Move most of the code of absolute_path() into the new function
strbuf_add_absolute_path() and in the process transform it to use
struct strbuf and xgetcwd() instead of a PATH_MAX-sized buffer,
which can be too small on some file systems.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Mon, 28 Jul 2014 18:31:57 +0000 (20:31 +0200)]
use xgetcwd() to set $GIT_DIR
Instead of dying of a segmentation fault if getcwd() returns NULL, use
xgetcwd() to make sure to write a useful error message and then exit
in an orderly fashion.
Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>