Junio C Hamano [Tue, 19 Sep 2017 01:47:53 +0000 (10:47 +0900)]
Merge branch 'nd/prune-in-worktree'
"git gc" and friends when multiple worktrees are used off of a
single repository did not consider the index and per-worktree refs
of other worktrees as the root for reachability traversal, making
objects that are in use only in other worktrees to be subject to
garbage collection.
* nd/prune-in-worktree:
refs.c: reindent get_submodule_ref_store()
refs.c: remove fallback-to-main-store code get_submodule_ref_store()
rev-list: expose and document --single-worktree
revision.c: --reflog add HEAD reflog from all worktrees
files-backend: make reflog iterator go through per-worktree reflog
revision.c: --all adds HEAD from all worktrees
refs: remove dead for_each_*_submodule()
refs.c: move for_each_remote_ref_submodule() to submodule.c
revision.c: use refs_for_each*() instead of for_each_*_submodule()
refs: add refs_head_ref()
refs: move submodule slash stripping code to get_submodule_ref_store
refs.c: refactor get_submodule_ref_store(), share common free block
revision.c: --indexed-objects add objects from all worktrees
revision.c: refactor add_index_objects_to_pending()
refs.c: use is_dir_sep() in resolve_gitlink_ref()
revision.h: new flag in struct rev_info wrt. worktree-related refs
Junio C Hamano [Tue, 19 Sep 2017 01:47:53 +0000 (10:47 +0900)]
Merge branch 'ma/split-symref-update-fix'
A leakfix.
* ma/split-symref-update-fix:
refs/files-backend: add `refname`, not "HEAD", to list
refs/files-backend: correct return value in lock_ref_for_update
refs/files-backend: fix memory leak in lock_ref_for_update
refs/files-backend: add longer-scoped copy of string to list
Junio C Hamano [Tue, 19 Sep 2017 01:47:52 +0000 (10:47 +0900)]
Merge branch 'mh/notes-cleanup'
Code clean-up.
* mh/notes-cleanup:
load_subtree(): check that `prefix_len` is in the expected range
load_subtree(): declare some variables to be `size_t`
hex_to_bytes(): simpler replacement for `get_oid_hex_segment()`
get_oid_hex_segment(): don't pad the rest of `oid`
load_subtree(): combine some common code
get_oid_hex_segment(): return 0 on success
load_subtree(): only consider blobs to be potential notes
load_subtree(): check earlier whether an internal node is a tree entry
load_subtree(): separate logic for internal vs. terminal entries
load_subtree(): fix incorrect comment
load_subtree(): reduce the scope of some local variables
load_subtree(): remove unnecessary conditional
notes: make GET_NIBBLE macro more robust
Junio C Hamano [Tue, 19 Sep 2017 01:47:52 +0000 (10:47 +0900)]
Merge branch 'mg/timestamp-t-fix'
A mismerge fix.
* mg/timestamp-t-fix:
name-rev: change ULONG_MAX to TIME_MAX
Junio C Hamano [Tue, 19 Sep 2017 01:47:52 +0000 (10:47 +0900)]
Merge branch 'ma/pkt-line-leakfix'
A leakfix.
* ma/pkt-line-leakfix:
pkt-line: re-'static'-ify buffer in packet_write_fmt_1()
Junio C Hamano [Tue, 19 Sep 2017 01:47:51 +0000 (10:47 +0900)]
Merge branch 'jk/config-lockfile-leak-fix'
A leakfix.
* jk/config-lockfile-leak-fix:
config: use a static lock_file struct
Junio C Hamano [Tue, 19 Sep 2017 01:47:50 +0000 (10:47 +0900)]
Merge branch 'dw/diff-highlight-makefile-fix'
Build clean-up.
* dw/diff-highlight-makefile-fix:
diff-highlight: add clean target to Makefile
Junio C Hamano [Tue, 19 Sep 2017 01:47:50 +0000 (10:47 +0900)]
Merge branch 'ti/external-sha1dc'
Platforms that ship with a separate sha1 with collision detection
library can link to it instead of using the copy we ship as part of
our source tree.
* ti/external-sha1dc:
sha1dc: allow building with the external sha1dc library
sha1dc: build git plumbing code more explicitly
Junio C Hamano [Sun, 10 Sep 2017 08:15:43 +0000 (17:15 +0900)]
Sync with maint
* maint:
RelNotes: further fixes for 2.14.2 from the master front
Junio C Hamano [Sun, 10 Sep 2017 08:15:09 +0000 (17:15 +0900)]
The seventh batch post 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 10 Sep 2017 08:08:25 +0000 (17:08 +0900)]
Merge branch 'rs/apply-epoch'
Code simplification.
* rs/apply-epoch:
apply: remove epoch date from regex
apply: check date of potential epoch timestamps first
Junio C Hamano [Sun, 10 Sep 2017 08:08:25 +0000 (17:08 +0900)]
Merge branch 'jk/drop-sha1-entry-pos'
Code clean-up.
* jk/drop-sha1-entry-pos:
sha1-lookup: remove sha1_entry_pos() from header file
Junio C Hamano [Sun, 10 Sep 2017 08:08:23 +0000 (17:08 +0900)]
Merge branch 'nd/worktree-kill-parse-ref'
"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
Junio C Hamano [Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)]
Merge branch 'mm/send-email-cc-cruft'
In addition to "cc: <a@dd.re.ss> # cruft", "cc: a@dd.re.ss # cruft"
was taught to "git send-email" as a valid way to tell it that it
needs to also send a carbon copy to <a@dd.re.ss> in the trailer
section.
* mm/send-email-cc-cruft:
send-email: don't use Mail::Address, even if available
send-email: fix garbage removal after address
Junio C Hamano [Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)]
Merge branch 'ls/convert-filter-progress'
The codepath to call external process filter for smudge/clean
operation learned to show the progress meter.
* ls/convert-filter-progress:
convert: display progress for filtered objects that have been delayed
Junio C Hamano [Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)]
Merge branch 'ma/up-to-date'
Message and doc updates.
* ma/up-to-date:
treewide: correct several "up-to-date" to "up to date"
Documentation/user-manual: update outdated example output
Junio C Hamano [Sun, 10 Sep 2017 08:08:22 +0000 (17:08 +0900)]
Merge branch 'ma/ts-cleanups'
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
Junio C Hamano [Sun, 10 Sep 2017 08:06:09 +0000 (17:06 +0900)]
RelNotes: further fixes for 2.14.2 from the master front
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 10 Sep 2017 08:03:10 +0000 (17:03 +0900)]
Merge branch 'jt/doc-pack-objects-fix' into maint
Doc updates.
* jt/doc-pack-objects-fix:
Doc: clarify that pack-objects makes packs, plural
Junio C Hamano [Sun, 10 Sep 2017 08:03:09 +0000 (17:03 +0900)]
Merge branch 'jn/vcs-svn-cleanup' into maint
Code clean-up.
* jn/vcs-svn-cleanup:
vcs-svn: move remaining repo_tree functions to fast_export.h
vcs-svn: remove repo_delete wrapper function
vcs-svn: remove custom mode constants
vcs-svn: remove more unused prototypes and declarations
Junio C Hamano [Sun, 10 Sep 2017 08:03:08 +0000 (17:03 +0900)]
Merge branch 'bc/vcs-svn-cleanup' into maint
Code clean-up.
* bc/vcs-svn-cleanup:
vcs-svn: rename repo functions to "svn_repo"
vcs-svn: remove unused prototypes
Junio C Hamano [Sun, 10 Sep 2017 08:03:07 +0000 (17:03 +0900)]
Merge branch 'jk/doc-the-this' into maint
Doc clean-up.
* jk/doc-the-this:
doc: fix typo in sendemail.identity
Junio C Hamano [Sun, 10 Sep 2017 08:03:07 +0000 (17:03 +0900)]
Merge branch 'rs/commit-h-single-parent-cleanup' into maint
Code clean-up.
* rs/commit-h-single-parent-cleanup:
commit: remove unused inline function single_parent()
Junio C Hamano [Sun, 10 Sep 2017 08:03:06 +0000 (17:03 +0900)]
Merge branch 'mg/format-ref-doc-fix' into maint
Doc fix.
* mg/format-ref-doc-fix:
Documentation/git-for-each-ref: clarify peeling of tags for --format
Documentation: use proper wording for ref format strings
Junio C Hamano [Sun, 10 Sep 2017 08:03:06 +0000 (17:03 +0900)]
Merge branch 'sb/submodule-parallel-update' into maint
Code clean-up.
* sb/submodule-parallel-update:
submodule.sh: remove unused variable
Junio C Hamano [Sun, 10 Sep 2017 08:03:05 +0000 (17:03 +0900)]
Merge branch 'hv/t5526-andand-chain-fix' into maint
Test fix.
* hv/t5526-andand-chain-fix:
t5526: fix some broken && chains
Junio C Hamano [Sun, 10 Sep 2017 08:03:04 +0000 (17:03 +0900)]
Merge branch 'sb/sha1-file-cleanup' into maint
Code clean-up.
* sb/sha1-file-cleanup:
sha1_file: make read_info_alternates static
Junio C Hamano [Sun, 10 Sep 2017 08:03:04 +0000 (17:03 +0900)]
Merge branch 'rs/t1002-do-not-use-sum' into maint
Test simplification.
* rs/t1002-do-not-use-sum:
t1002: stop using sum(1)
Junio C Hamano [Sun, 10 Sep 2017 08:03:03 +0000 (17:03 +0900)]
Merge branch 'ah/doc-empty-string-is-false' into maint
Doc update.
* ah/doc-empty-string-is-false:
doc: clarify "config --bool" behaviour with empty string
Junio C Hamano [Sun, 10 Sep 2017 08:03:02 +0000 (17:03 +0900)]
Merge branch 'rs/merge-microcleanup' into maint
Code clean-up.
* rs/merge-microcleanup:
merge: use skip_prefix()
Junio C Hamano [Sun, 10 Sep 2017 08:03:02 +0000 (17:03 +0900)]
Merge branch 'rs/find-pack-entry-bisection' into maint
Code clean-up.
* rs/find-pack-entry-bisection:
sha1_file: avoid comparison if no packed hash matches the first byte
Junio C Hamano [Sun, 10 Sep 2017 08:03:01 +0000 (17:03 +0900)]
Merge branch 'rs/apply-lose-prefix-length' into maint
Code clean-up.
* rs/apply-lose-prefix-length:
apply: remove prefix_length member from apply_state
Junio C Hamano [Sun, 10 Sep 2017 08:03:00 +0000 (17:03 +0900)]
Merge branch 'rj/add-chmod-error-message' into maint
Message fix.
* rj/add-chmod-error-message:
builtin/add: add detail to a 'cannot chmod' error message
Junio C Hamano [Sun, 10 Sep 2017 08:02:59 +0000 (17:02 +0900)]
Merge branch 'jk/hashcmp-memcmp' into maint
Code clean-up.
* jk/hashcmp-memcmp:
hashcmp: use memcmp instead of open-coded loop
Junio C Hamano [Sun, 10 Sep 2017 08:02:58 +0000 (17:02 +0900)]
Merge branch 'rs/t3700-clean-leftover' into maint
A test fix.
* rs/t3700-clean-leftover:
t3700: fix broken test under !POSIXPERM
Junio C Hamano [Sun, 10 Sep 2017 08:02:57 +0000 (17:02 +0900)]
Merge branch 'jc/perl-git-comment-typofix' into maint
A comment fix.
* jc/perl-git-comment-typofix:
perl/Git.pm: typofix in a comment
Junio C Hamano [Sun, 10 Sep 2017 08:02:56 +0000 (17:02 +0900)]
Merge branch 'mf/no-dashed-subcommands' into maint
Code clean-up.
* mf/no-dashed-subcommands:
scripts: use "git foo" not "git-foo"
Junio C Hamano [Sun, 10 Sep 2017 08:02:56 +0000 (17:02 +0900)]
Merge branch 'ab/ref-filter-no-contains' into maint
A test fix.
* ab/ref-filter-no-contains:
tests: don't give unportable ">" to "test" built-in, use -gt
Junio C Hamano [Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)]
Merge branch 'rs/archive-excluded-directory' into maint
"git archive" did not work well with pathspecs and the
export-ignore attribute.
We may want to resurrect the "we don't archive an empty directory"
bonus patch, but I do not mind merging the above early to 'next'
and leave it as a separate follow-up enhancement.
cf. <
20170820090629.tumvqwzkromcykjf@sigill.intra.peff.net>
* rs/archive-excluded-directory:
archive: don't queue excluded directories
archive: factor out helper functions for handling attributes
t5001: add tests for export-ignore attributes and exclude pathspecs
Junio C Hamano [Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)]
Merge branch 'mg/killed-merge' into maint
Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress. This has been fixed.
* mg/killed-merge:
merge: save merge state earlier
merge: split write_merge_state in two
merge: clarify call chain
Documentation/git-merge: explain --continue
Junio C Hamano [Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)]
Merge branch 'tb/apply-with-crlf' into maint
"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings. The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.
* tb/apply-with-crlf:
apply: file commited with CRLF should roundtrip diff and apply
convert: add SAFE_CRLF_KEEP_CRLF
Junio C Hamano [Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)]
Merge branch 'cc/subprocess-handshake-missing-capabilities' into maint
When handshake with a subprocess filter notices that the process
asked for an unknown capability, Git did not report what program
the offending subprocess was running. This has been corrected.
We may want a follow-up fix to tighten the error checking, though.
* cc/subprocess-handshake-missing-capabilities:
sub-process: print the cmd when a capability is unsupported
Junio C Hamano [Sun, 10 Sep 2017 08:02:55 +0000 (17:02 +0900)]
Merge branch 'as/grep-quiet-no-match-exit-code-fix' into maint
"git grep -L" and "git grep --quiet -L" reported different exit
codes; this has been corrected.
* as/grep-quiet-no-match-exit-code-fix:
git-grep: correct exit code with --quiet and -L
Junio C Hamano [Sun, 10 Sep 2017 08:02:54 +0000 (17:02 +0900)]
Merge branch 'kd/stash-with-bash-4.4' into maint
bash 4.4 or newer gave a warning on NUL byte in command
substitution done in "git stash"; this has been squelched.
* kd/stash-with-bash-4.4:
stash: prevent warning about null bytes in input
Junio C Hamano [Sun, 10 Sep 2017 08:02:54 +0000 (17:02 +0900)]
Merge branch 'rs/win32-syslog-leakfix' into maint
Memory leak in an error codepath has been plugged.
* rs/win32-syslog-leakfix:
win32: plug memory leak on realloc() failure in syslog()
Junio C Hamano [Sun, 10 Sep 2017 08:02:53 +0000 (17:02 +0900)]
Merge branch 'rs/unpack-entry-leakfix' into maint
Memory leak in an error codepath has been plugged.
* rs/unpack-entry-leakfix:
sha1_file: release delta_stack on error in unpack_entry()
Junio C Hamano [Sun, 10 Sep 2017 08:02:52 +0000 (17:02 +0900)]
Merge branch 'rs/fsck-obj-leakfix' into maint
Memory leak in an error codepath has been plugged.
* rs/fsck-obj-leakfix:
fsck: free buffers on error in fsck_obj()
Junio C Hamano [Sun, 10 Sep 2017 08:02:52 +0000 (17:02 +0900)]
Merge branch 'ur/svn-local-zone' into maint
"git svn" used with "--localtime" option did not compute the tz
offset for the timestamp in question and instead always used the
current time, which has been corrected.
* ur/svn-local-zone:
git svn fetch: Create correct commit timestamp when using --localtime
Junio C Hamano [Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)]
Merge branch 'pw/am-signoff' into maint
"git am -s" has been taught that some input may end with a trailer
block that is not Signed-off-by: and it should refrain from adding
an extra blank line before adding a new sign-off in such a case.
* pw/am-signoff:
am: fix signoff when other trailers are present
Junio C Hamano [Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)]
Merge branch 'rs/in-obsd-basename-dirname-take-const' into maint
Portability fix.
* rs/in-obsd-basename-dirname-take-const:
test-path-utils: handle const parameter of basename and dirname
Junio C Hamano [Sun, 10 Sep 2017 08:02:51 +0000 (17:02 +0900)]
Merge branch 'rs/t4062-obsd' into maint
Test portability fix.
* rs/t4062-obsd:
t4062: use less than 256 repetitions in regex
Junio C Hamano [Sun, 10 Sep 2017 08:02:50 +0000 (17:02 +0900)]
Merge branch 'rs/obsd-getcwd-workaround' into maint
Test portability fix for BSDs.
* rs/obsd-getcwd-workaround:
t0001: skip test with restrictive permissions if getpwd(3) respects them
Junio C Hamano [Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)]
Merge branch 'bw/clone-recursive-quiet' into maint
"git clone --recurse-submodules --quiet" did not pass the quiet
option down to submodules.
* bw/clone-recursive-quiet:
clone: teach recursive clones to respect -q
Junio C Hamano [Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)]
Merge branch 'pw/sequence-rerere-autoupdate' into maint
Commands like "git rebase" accepted the --rerere-autoupdate option
from the command line, but did not always use it. This has been
fixed.
* pw/sequence-rerere-autoupdate:
cherry-pick/revert: reject --rerere-autoupdate when continuing
cherry-pick/revert: remember --rerere-autoupdate
t3504: use test_commit
rebase -i: honor --rerere-autoupdate
rebase: honor --rerere-autoupdate
am: remember --rerere-autoupdate setting
Junio C Hamano [Sun, 10 Sep 2017 08:02:49 +0000 (17:02 +0900)]
Merge branch 'bw/push-options-recursively-to-submodules' into maint
"git push --recurse-submodules $there HEAD:$target" was not
propagated down to the submodules, but now it is.
* bw/push-options-recursively-to-submodules:
submodule--helper: teach push-check to handle HEAD
Junio C Hamano [Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)]
Merge branch 'ma/pager-per-subcommand-action' into maint
The "tag.pager" configuration variable was useless for those who
actually create tag objects, as it interfered with the use of an
editor. A new mechanism has been introduced for commands to enable
pager depending on what operation is being carried out to fix this,
and then "git tag -l" is made to run pager by default.
If this works out OK, I think there are low-hanging fruits in
other commands like "git branch" that outputs long list in one mode
while taking input in another.
* ma/pager-per-subcommand-action:
git.c: ignore pager.* when launching builtin as dashed external
tag: change default of `pager.tag` to "on"
tag: respect `pager.tag` in list-mode only
t7006: add tests for how git tag paginates
git.c: provide setup_auto_pager()
git.c: let builtins opt for handling `pager.foo` themselves
builtin.h: take over documentation from api-builtin.txt
Junio C Hamano [Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)]
Merge branch 'jk/rev-list-empty-input' into maint
"git log --tag=no-such-tag" showed log starting from HEAD, which
has been fixed---it now shows nothing.
* jk/rev-list-empty-input:
revision: do not fallback to default when rev_input_given is set
rev-list: don't show usage when we see empty ref patterns
revision: add rev_input_given flag
t6018: flesh out empty input/output rev-list tests
Junio C Hamano [Sun, 10 Sep 2017 08:02:48 +0000 (17:02 +0900)]
Merge branch 'st/lib-gpg-kill-stray-agent' into maint
Some versions of GnuPG fails to kill gpg-agent it auto-spawned
and such a left-over agent can interfere with a test. Work it
around by attempting to kill one before starting a new test.
* st/lib-gpg-kill-stray-agent:
t: lib-gpg: flush gpg agent on startup
Martin Ågren [Sat, 9 Sep 2017 06:57:18 +0000 (08:57 +0200)]
refs/files-backend: add `refname`, not "HEAD", to list
An earlier patch rewrote `split_symref_update()` to add a copy of a
string to a string list instead of adding the original string. That was
so that the original string could be freed in a later patch, but it is
also conceptually cleaner, since now all calls to `string_list_insert()`
and `string_list_append()` add `update->refname`. --- Except a literal
"HEAD" is added in `split_head_update()`.
Restructure `split_head_update()` in the same way as the earlier patch
did for `split_symref_update()`. This does not correct any practical
problem, but makes things conceptually cleaner. The downside is a call
to `string_list_has_string()`, which should be relatively cheap.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren [Sat, 9 Sep 2017 06:57:17 +0000 (08:57 +0200)]
refs/files-backend: correct return value in lock_ref_for_update
In one code path we return a literal -1 and not a symbolic constant. The
value -1 would be interpreted as TRANSACTION_NAME_CONFLICT, which is
wrong. Use TRANSACTION_GENERIC_ERROR instead (that is the only other
return value we have to choose from).
Noticed-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren [Sat, 9 Sep 2017 06:57:16 +0000 (08:57 +0200)]
refs/files-backend: fix memory leak in lock_ref_for_update
After the previous patch, none of the functions we call hold on to
`referent.buf`, so we can safely release the string buffer before
returning.
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren [Sat, 9 Sep 2017 06:57:15 +0000 (08:57 +0200)]
refs/files-backend: add longer-scoped copy of string to list
split_symref_update() receives a string-pointer `referent` and adds it
to the list of `affected_refnames`. The list simply holds on to the
pointers it is given, it does not copy the strings and it does not ever
free them. The `referent` string in split_symref_update() belongs to a
string buffer in the caller. After we return, the string will be leaked.
In the next patch, we want to properly release the string buffer in the
caller, but we can't safely do so until we've made sure that
`affected_refnames` will not be holding on to a pointer to the string.
We could configure the list to handle its own resources, but it would
mean some alloc/free-churning. The list is already handling other
strings (through other code paths) which we do not need to worry about,
and we'd be memory-churning those strings too, completely unnecessary.
Observe that split_symref_update() creates a `new_update`-object through
ref_transaction_add_update(), after which `new_update->refname` is a
copy of `referent`. The difference is, this copy will be freed, and it
will be freed *after* `affected_refnames` has been cleared.
Rearrange the handling of `referent`, so that we don't add it directly
to `affected_refnames`. Instead, first just check whether `referent`
exists in the string list, and later add `new_update->refname`.
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Fri, 8 Sep 2017 16:10:10 +0000 (18:10 +0200)]
load_subtree(): check that `prefix_len` is in the expected range
This value, which is stashed in the last byte of an object_id hash,
gets handed around a lot. So add a sanity check before using it in
`load_subtree()`.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 6 Sep 2017 04:15:24 +0000 (13:15 +0900)]
The sixth batch post 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)]
Merge branch 'rs/archive-excluded-directory'
"git archive" did not work well with pathspecs and the
export-ignore attribute.
* rs/archive-excluded-directory:
archive: don't queue excluded directories
archive: factor out helper functions for handling attributes
t5001: add tests for export-ignore attributes and exclude pathspecs
Junio C Hamano [Wed, 6 Sep 2017 04:11:25 +0000 (13:11 +0900)]
Merge branch 'po/read-graft-line'
Conversion from uchar[20] to struct object_id continues; this is to
ensure that we do not assume sizeof(struct object_id) is the same
as the length of SHA-1 hash (or length of longest hash we support).
* po/read-graft-line:
commit: rewrite read_graft_line
commit: allocate array using object_id size
commit: replace the raw buffer with strbuf in read_graft_line
sha1_file: fix definition of null_sha1
Junio C Hamano [Wed, 6 Sep 2017 04:11:24 +0000 (13:11 +0900)]
Merge branch 'ks/branch-set-upstream'
"branch --set-upstream" that has been deprecated in Git 1.8 has
finally been retired.
* ks/branch-set-upstream:
branch: quote branch/ref names to improve readability
builtin/branch: stop supporting the "--set-upstream" option
t3200: cleanup cruft of a test
Martin Ågren [Sun, 27 Aug 2017 07:37:32 +0000 (09:37 +0200)]
pkt-line: re-'static'-ify buffer in packet_write_fmt_1()
The static-ness was silently dropped in commit
70428d1a5 ("pkt-line: add
packet_write_fmt_gently()", 2016-10-16). As a result, for each call to
packet_write_fmt_1, we allocate and leak a buffer.
We could keep the strbuf non-static and instead make sure we always
release it before returning (but not before we die, so that we don't
touch errno). That would also prepare us for threaded use. But until
that needs to happen, let's just restore the static-ness so that we get
back to a situation where we (eventually) do not continuosly keep
allocating memory.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 29 Aug 2017 18:58:50 +0000 (14:58 -0400)]
config: use a static lock_file struct
When modifying git config, we xcalloc() a struct lock_file
but never free it. This is necessary because the tempfile
code (upon which the locking code is built) requires that
the resulting struct remain valid through the life of the
program. However, it also confuses leak-checkers like
valgrind because only the inner "struct tempfile" is still
reachable; no pointer to the outer lock_file is kept.
Other code paths solve this by using a single static lock
struct. We can do the same here, because we know that we'll
only lock and modify one config file at a time (and
assertions within the lockfile code will ensure that this
remains the case).
That removes a real leak (when we fail to free the struct
after locking fails) as well as removes the valgrind false
positive. It also means that doing N sequential
config-writes will use a constant amount of memory, rather
than leaving stale lock_files for each.
Note that since "lock" is no longer a pointer, it can't be
NULL anymore. But that's OK. We used that feature only to
avoid calling rollback_lock_file() on an already-committed
lock. Since the lockfile code keeps its own "active" flag,
it's a noop to rollback an inactive lock, and we don't have
to worry about this ourselves.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Watkins [Tue, 29 Aug 2017 11:23:11 +0000 (12:23 +0100)]
diff-highlight: add clean target to Makefile
Now that `make` produces a file, we should have a clean target to remove
it.
Signed-off-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael J Gruber [Wed, 30 Aug 2017 09:46:06 +0000 (11:46 +0200)]
name-rev: change ULONG_MAX to TIME_MAX
Earlier,
dddbad728c ("timestamp_t: a new data type for timestamps",
2017-04-26) changed several types to timestamp_t.
5589e87fd8 ("name-rev: change a "long" variable to timestamp_t",
2017-05-20) cleaned up a missed variable, but both missed a _MAX
constant.
Change the remaining constant to the one appropriate for the current
type
Signed-off-by: Michael J Gruber <git@grubix.eu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 27 Aug 2017 06:00:01 +0000 (23:00 -0700)]
The fifth batch post 2.14
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 27 Aug 2017 05:55:10 +0000 (22:55 -0700)]
Merge branch 'mg/killed-merge'
Killing "git merge --edit" before the editor returns control left
the repository in a state with MERGE_MSG but without MERGE_HEAD,
which incorrectly tells the subsequent "git commit" that there was
a squash merge in progress. This has been fixed.
* mg/killed-merge:
merge: save merge state earlier
merge: split write_merge_state in two
merge: clarify call chain
Documentation/git-merge: explain --continue
Junio C Hamano [Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)]
Merge branch 'jt/packmigrate'
Code movement to make it easier to hack later.
* jt/packmigrate: (23 commits)
pack: move for_each_packed_object()
pack: move has_pack_index()
pack: move has_sha1_pack()
pack: move find_pack_entry() and make it global
pack: move find_sha1_pack()
pack: move find_pack_entry_one(), is_pack_valid()
pack: move check_pack_index_ptr(), nth_packed_object_offset()
pack: move nth_packed_object_{sha1,oid}
pack: move clear_delta_base_cache(), packed_object_info(), unpack_entry()
pack: move unpack_object_header()
pack: move get_size_from_delta()
pack: move unpack_object_header_buffer()
pack: move {,re}prepare_packed_git and approximate_object_count
pack: move install_packed_git()
pack: move add_packed_git()
pack: move unuse_pack()
pack: move use_pack()
pack: move pack-closing functions
pack: move release_pack_memory()
pack: move open_pack_index(), parse_pack_index()
...
Junio C Hamano [Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)]
Merge branch 'mh/ref-lock-entry'
The code to acquire a lock on a reference (e.g. while accepting a
push from a client) used to immediately fail when the reference is
already locked---now it waits for a very short while and retries,
which can make it succeed if the lock holder was holding it during
a read-only operation.
* mh/ref-lock-entry:
refs: retry acquiring reference locks for 100ms
Junio C Hamano [Sun, 27 Aug 2017 05:55:09 +0000 (22:55 -0700)]
Merge branch 'jt/doc-pack-objects-fix'
Doc updates.
* jt/doc-pack-objects-fix:
Doc: clarify that pack-objects makes packs, plural
Junio C Hamano [Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)]
Merge branch 'jc/cutoff-config'
"[gc] rerereResolved = 5.days" used to be invalid, as the variable
is defined to take an integer counting the number of days. It now
is allowed.
* jc/cutoff-config:
rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
rerere: represent time duration in timestamp_t internally
t4200: parameterize "rerere gc" custom expiry test
t4200: gather "rerere gc" together
t4200: make "rerere gc" test more robust
t4200: give us a clean slate after "rerere gc" tests
Junio C Hamano [Sun, 27 Aug 2017 05:55:08 +0000 (22:55 -0700)]
Merge branch 'kw/write-index-reduce-alloc'
We used to spend more than necessary cycles allocating and freeing
piece of memory while writing each index entry out. This has been
optimized.
* kw/write-index-reduce-alloc:
read-cache: avoid allocating every ondisk entry when writing
read-cache: fix memory leak in do_write_index
perf: add test for writing the index
Junio C Hamano [Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)]
Merge branch 'bw/submodule-config-cleanup'
Code clean-up to avoid mixing values read from the .gitmodules file
and values read from the .git/config file.
* bw/submodule-config-cleanup:
submodule: remove gitmodules_config
unpack-trees: improve loading of .gitmodules
submodule-config: lazy-load a repository's .gitmodules file
submodule-config: move submodule-config functions to submodule-config.c
submodule-config: remove support for overlaying repository config
diff: stop allowing diff to have submodules configured in .git/config
submodule: remove submodule_config callback routine
unpack-trees: don't respect submodule.update
submodule: don't rely on overlayed config when setting diffopts
fetch: don't overlay config with submodule-config
submodule--helper: don't overlay config in update-clone
submodule--helper: don't overlay config in remote_submodule_branch
add, reset: ensure submodules can be added or reset
submodule: don't use submodule_from_name
t7411: check configuration parsing errors
Junio C Hamano [Sun, 27 Aug 2017 05:55:07 +0000 (22:55 -0700)]
Merge branch 'js/gitweb-raw-blob-link-in-history'
"gitweb" shows a link to visit the 'raw' contents of blbos in the
history overview page.
* js/gitweb-raw-blob-link-in-history:
gitweb: add 'raw' blob_plain link in history overview
Junio C Hamano [Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)]
Merge branch 'po/object-id'
* po/object-id:
sha1_file: convert index_stream to struct object_id
sha1_file: convert hash_sha1_file_literally to struct object_id
sha1_file: convert index_fd to struct object_id
sha1_file: convert index_path to struct object_id
read-cache: convert to struct object_id
builtin/hash-object: convert to struct object_id
Junio C Hamano [Sun, 27 Aug 2017 05:55:06 +0000 (22:55 -0700)]
Merge branch 'jn/vcs-svn-cleanup'
Code clean-up.
* jn/vcs-svn-cleanup:
vcs-svn: move remaining repo_tree functions to fast_export.h
vcs-svn: remove repo_delete wrapper function
vcs-svn: remove custom mode constants
vcs-svn: remove more unused prototypes and declarations
Junio C Hamano [Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)]
Merge branch 'bc/vcs-svn-cleanup'
Code clean-up.
* bc/vcs-svn-cleanup:
vcs-svn: rename repo functions to "svn_repo"
vcs-svn: remove unused prototypes
Junio C Hamano [Sun, 27 Aug 2017 05:55:05 +0000 (22:55 -0700)]
Merge branch 'tb/apply-with-crlf'
"git apply" that is used as a better "patch -p1" failed to apply a
taken from a file with CRLF line endings to a file with CRLF line
endings. The root cause was because it misused convert_to_git()
that tried to do "safe-crlf" processing by looking at the index
entry at the same path, which is a nonsense---in that mode, "apply"
is not working on the data in (or derived from) the index at all.
This has been fixed.
* tb/apply-with-crlf:
apply: file commited with CRLF should roundtrip diff and apply
convert: add SAFE_CRLF_KEEP_CRLF
Junio C Hamano [Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)]
Merge branch 'jt/stash-tests'
Test update to improve coverage for "git stash" operations.
* jt/stash-tests:
stash: add a test for stashing in a detached state
stash: add a test for when apply fails during stash branch
stash: add a test for stash create with no files
Junio C Hamano [Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)]
Merge branch 'jk/trailers-parse'
"git interpret-trailers" has been taught a "--parse" and a few
other options to make it easier for scripts to grab existing
trailer lines from a commit log message.
* jk/trailers-parse:
doc/interpret-trailers: fix "the this" typo
pretty: support normalization options for %(trailers)
t4205: refactor %(trailers) tests
pretty: move trailer formatting to trailer.c
interpret-trailers: add --parse convenience option
interpret-trailers: add an option to unfold values
interpret-trailers: add an option to show only existing trailers
interpret-trailers: add an option to show only the trailers
trailer: put process_trailers() options into a struct
Junio C Hamano [Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)]
Merge branch 'pb/trailers-from-command-line'
"git interpret-trailers" learned to take the trailer specifications
from the command line that overrides the configured values.
* pb/trailers-from-command-line:
interpret-trailers: fix documentation typo
interpret-trailers: add options for actions
trailers: introduce struct new_trailer_item
trailers: export action enums and corresponding lookup functions
Junio C Hamano [Sun, 27 Aug 2017 05:55:04 +0000 (22:55 -0700)]
Merge branch 'jt/diff-color-move-fix'
A handful of bugfixes and an improvement to "diff --color-moved".
* jt/diff-color-move-fix:
diff: define block by number of alphanumeric chars
diff: respect MIN_BLOCK_LENGTH for last block
diff: avoid redundantly clearing a flag
Junio C Hamano [Sun, 27 Aug 2017 05:55:03 +0000 (22:55 -0700)]
Merge branch 'sb/diff-color-move'
"git diff" has been taught to optionally paint new lines that are
the same as deleted lines elsewhere differently from genuinely new
lines.
* sb/diff-color-move: (25 commits)
diff: document the new --color-moved setting
diff.c: add dimming to moved line detection
diff.c: color moved lines differently, plain mode
diff.c: color moved lines differently
diff.c: buffer all output if asked to
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_SUMMARY
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_STAT_SEP
diff.c: convert word diffing to use emit_diff_symbol
diff.c: convert show_stats to use emit_diff_symbol
diff.c: convert emit_binary_diff_body to use emit_diff_symbol
submodule.c: migrate diff output to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_REWRITE_DIFF
diff.c: emit_diff_symbol learns about DIFF_SYMBOL_BINARY_FILES
diff.c: emit_diff_symbol learns DIFF_SYMBOL_HEADER
diff.c: emit_diff_symbol learns DIFF_SYMBOL_FILEPAIR_{PLUS, MINUS}
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_INCOMPLETE
diff.c: emit_diff_symbol learns DIFF_SYMBOL_WORDS[_PORCELAIN]
diff.c: migrate emit_line_checked to use emit_diff_symbol
diff.c: emit_diff_symbol learns DIFF_SYMBOL_NO_LF_EOF
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_FRAGINFO
...
Michael Haggerty [Sat, 26 Aug 2017 08:28:12 +0000 (10:28 +0200)]
load_subtree(): declare some variables to be `size_t`
* `prefix_len`
* `path_len`
* `i`
It's good hygiene.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:11 +0000 (10:28 +0200)]
hex_to_bytes(): simpler replacement for `get_oid_hex_segment()`
Now that `get_oid_hex_segment()` does less, it makes sense to rename
it and simplify its semantics:
* Instead of a `hex_len` parameter, which was the number of hex
characters (and had to be even), use a `len` parameter, which is the
number of resulting bytes. This removes then need for the check that
`hex_len` is even and to divide it by two to determine the number of
bytes. For good hygiene, declare the `len` parameter to be `size_t`
instead of `unsigned int`.
* Change the order of the arguments to the more traditional (dst,
src, len).
* Rename the function to `hex_to_bytes()`.
* Remove a loop variable: just count `len` down instead.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:10 +0000 (10:28 +0200)]
get_oid_hex_segment(): don't pad the rest of `oid`
Remove the feature of `get_oid_hex_segment()` that it pads the rest of
the `oid` argument with zeros. Instead, do this at the caller who
needs it.
This makes the functionality of this function more coherent and
removes the need for its `oid_len` argument.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:09 +0000 (10:28 +0200)]
load_subtree(): combine some common code
Write the length into `object_oid` (before copying) rather than
`l->key_oid` (after copying). Then combine some code from the two `if`
blocks.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:08 +0000 (10:28 +0200)]
get_oid_hex_segment(): return 0 on success
Nobody cares about the return value of get_oid_hex_segment() except to
check whether it failed. So just return 0 on success.
And while we're updating its docstring, update it for some argument
renaming that happened a while ago.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:07 +0000 (10:28 +0200)]
load_subtree(): only consider blobs to be potential notes
The old code converted any entry whose path constituted a full SHA-1
as a leaf node, without regard for the type of the entry. But only
blobs can be notes. So treat entries whose paths *look like* notes
paths but that are not blobs as non-notes.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:06 +0000 (10:28 +0200)]
load_subtree(): check earlier whether an internal node is a tree entry
If an entry is not a tree entry, then it cannot possibly be an
internal node. But the old code checked this condition only after
allocating a leaf_node object and therefore leaked that memory.
Instead, check before even entering this branch of the code.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:05 +0000 (10:28 +0200)]
load_subtree(): separate logic for internal vs. terminal entries
There are only two legitimate notes path components:
* A hexadecimal string that fills the rest of the SHA-1
* A two-digit hexadecimal string that constitutes another internal
node.
So handle those two cases at the top level, and reject others as
non-notes without trying to parse them. The logic separation also
simplifies upcoming changes.
This prevents us from leaking memory for a leaf_node in the case of
wrong-sized paths. There are still memory leaks in this code; they will
be fixed in upcoming commits.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:04 +0000 (10:28 +0200)]
load_subtree(): fix incorrect comment
This comment was added in
851c2b3791 (Teach notes code to properly
preserve non-notes in the notes tree, 2010-02-13) when the
corresponding code was added. But I believe it was incorrect even
then. The condition `path_len != 2` a dozen lines up prevents a path
like "dead/beef" from being converted to "de/ad/beef", and indeed the
test added in commit
851c2b3 verifies that this case works correctly.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:03 +0000 (10:28 +0200)]
load_subtree(): reduce the scope of some local variables
Declare the variables inside the loop, to make it more obvious that
their values are not carried across loop iterations.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Michael Haggerty [Sat, 26 Aug 2017 08:28:02 +0000 (10:28 +0200)]
load_subtree(): remove unnecessary conditional
At this point in the code, len is *always* <= 20.
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>