Junio C Hamano [Wed, 16 Jul 2014 18:32:33 +0000 (11:32 -0700)]
Merge branch 'kb/path-max-must-go'
* kb/path-max-must-go:
cache.h: rename cache_def_free to cache_def_clear
Junio C Hamano [Wed, 16 Jul 2014 18:29:06 +0000 (11:29 -0700)]
Merge branch 'cb/filter-branch-prune-empty-degenerate-merges'
"filter-branch" left an empty single-parent commit that results when
all parents of a merge commit gets mapped to the same commit, even
under "--prune-empty".
* cb/filter-branch-prune-empty-degenerate-merges:
filter-branch: eliminate duplicate mapped parents
Junio C Hamano [Wed, 16 Jul 2014 18:26:04 +0000 (11:26 -0700)]
Merge branch 'mk/merge-incomplete-files'
Merging changes into a file that ends in an incomplete line made the
last line into a complete one, even when the other branch did not
change anything around the end of file.
* mk/merge-incomplete-files:
git-merge-file: do not add LF at EOF while applying unrelated change
t6023-merge-file.sh: fix and mark as broken invalid tests
Junio C Hamano [Wed, 16 Jul 2014 18:25:59 +0000 (11:25 -0700)]
Merge branch 'jk/strip-suffix'
* jk/strip-suffix:
prepare_packed_git_one: refactor duplicate-pack check
verify-pack: use strbuf_strip_suffix
strbuf: implement strbuf_strip_suffix
index-pack: use strip_suffix to avoid magic numbers
use strip_suffix instead of ends_with in simple cases
replace has_extension with ends_with
implement ends_with via strip_suffix
add strip_suffix function
sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
Junio C Hamano [Wed, 16 Jul 2014 18:25:57 +0000 (11:25 -0700)]
Merge branch 'ep/submodule-code-cleanup'
* ep/submodule-code-cleanup:
submodule.c: use the ARRAY_SIZE macro
Junio C Hamano [Wed, 16 Jul 2014 18:25:55 +0000 (11:25 -0700)]
Merge branch 'jk/replace-edit-raw'
Teach "git replace --edit" mode a "--raw" option to allow
editing the bare-metal representation data of objects.
* jk/replace-edit-raw:
replace: add a --raw mode for --edit
Junio C Hamano [Wed, 16 Jul 2014 18:25:47 +0000 (11:25 -0700)]
Merge branch 'cc/replace-edit'
Teach "git replace" an "--edit" mode.
* cc/replace-edit:
replace: use argv_array in export_object
avoid double close of descriptors handed to run_command
replace: replace spaces with tabs in indentation
Junio C Hamano [Wed, 16 Jul 2014 18:25:45 +0000 (11:25 -0700)]
Merge branch 'tb/crlf-tests'
* tb/crlf-tests:
t0027: combinations of core.autocrlf, core.eol and text
t0025: rename the test files
Junio C Hamano [Wed, 16 Jul 2014 18:25:40 +0000 (11:25 -0700)]
Merge branch 'nd/split-index'
An experiment to use two files (the base file and incremental
changes relative to it) to represent the index to reduce I/O cost
of rewriting a large index when only small part of the working tree
changes.
* nd/split-index: (32 commits)
t1700: new tests for split-index mode
t2104: make sure split index mode is off for the version test
read-cache: force split index mode with GIT_TEST_SPLIT_INDEX
read-tree: note about dropping split-index mode or index version
read-tree: force split-index mode off on --index-output
rev-parse: add --shared-index-path to get shared index path
update-index --split-index: do not split if $GIT_DIR is read only
update-index: new options to enable/disable split index mode
split-index: strip pathname of on-disk replaced entries
split-index: do not invalidate cache-tree at read time
split-index: the reading part
split-index: the writing part
read-cache: mark updated entries for split index
read-cache: save deleted entries in split index
read-cache: mark new entries for split index
read-cache: split-index mode
read-cache: save index SHA-1 after reading
entry.c: update cache_changed if refresh_cache is set in checkout_entry()
cache-tree: mark istate->cache_changed on prime_cache_tree()
cache-tree: mark istate->cache_changed on cache tree update
...
Karsten Blees [Tue, 15 Jul 2014 22:53:27 +0000 (00:53 +0200)]
MinGW: fix compile error due to missing ELOOP
MinGW and MSVC before 2010 don't define ELOOP, use EMLINK (aka "Too many
links") instead.
Signed-off-by: Karsten Blees <blees@dcon.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Øyvind A. Holm [Tue, 15 Jul 2014 13:40:24 +0000 (15:40 +0200)]
.gitignore: "git-verify-commit" is a generated file
builtin/verify-commit.c was added in commit
d07b00b ("verify-commit:
scriptable commit signature verification", 2014-06-23), update
.gitignore to ignore the generated file.
Signed-off-by: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees [Fri, 11 Jul 2014 23:02:34 +0000 (01:02 +0200)]
cache.h: rename cache_def_free to cache_def_clear
Rename cache_def_free to cache_def_clear as it doesn't free the struct
cache_def, but just clears its content.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 Jul 2014 18:37:56 +0000 (11:37 -0700)]
Merge branch 'maint'
* maint:
Start preparing for 2.0.2
Junio C Hamano [Thu, 10 Jul 2014 18:37:30 +0000 (11:37 -0700)]
Seventh batch for 2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 Jul 2014 18:27:55 +0000 (11:27 -0700)]
Merge branch 'dt/refs-check-refname-component-sse-fix'
Fixes to a topic that is already in 'master'.
* dt/refs-check-refname-component-sse-fix:
refs: fix valgrind suppression file
refs.c: handle REFNAME_REFSPEC_PATTERN at end of page
Junio C Hamano [Thu, 10 Jul 2014 18:27:53 +0000 (11:27 -0700)]
Merge branch 'rs/simplify-archive-tests'
* rs/simplify-archive-tests:
t5000, t5003: simplify commit
Junio C Hamano [Thu, 10 Jul 2014 18:27:52 +0000 (11:27 -0700)]
Merge branch 'rs/fix-alt-odb-path-comparison'
* rs/fix-alt-odb-path-comparison:
sha1_file: avoid overrunning alternate object base string
Junio C Hamano [Thu, 10 Jul 2014 18:27:50 +0000 (11:27 -0700)]
Merge branch 'rs/status-code-clean-up'
* rs/status-code-clean-up:
wt-status: simplify building of summary limit argument
wt-status: use argv_array for environment
Junio C Hamano [Thu, 10 Jul 2014 18:27:47 +0000 (11:27 -0700)]
Merge branch 'kb/path-max-must-go'
* kb/path-max-must-go:
symlinks: remove PATH_MAX limitation
Junio C Hamano [Thu, 10 Jul 2014 18:27:33 +0000 (11:27 -0700)]
Merge branch 'mg/verify-commit'
Add 'verify-commit' to be used in a way similar to 'verify-tag' is
used. Further work on verifying the mergetags might be needed.
* mg/verify-commit:
t7510: test verify-commit
t7510: exit for loop with test result
verify-commit: scriptable commit signature verification
gpg-interface: provide access to the payload
gpg-interface: provide clear helper for struct signature_check
Junio C Hamano [Thu, 10 Jul 2014 18:17:24 +0000 (11:17 -0700)]
Merge branch 'jc/fix-clone-single-starting-at-a-tag'
"git clone -b brefs/tags/bar" would have mistakenly thought we were
following a single tag, even though it was a name of the branch,
because it incorrectly used strstr().
* jc/fix-clone-single-starting-at-a-tag:
builtin/clone.c: detect a clone starting at a tag correctly
Junio C Hamano [Thu, 10 Jul 2014 18:15:10 +0000 (11:15 -0700)]
Start preparing for 2.0.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Thu, 10 Jul 2014 18:10:52 +0000 (11:10 -0700)]
Merge branch 'pb/trim-trailing-spaces' into maint
* pb/trim-trailing-spaces:
t0008: do not depend on 'echo' handling backslashes specially
dir.c:trim_trailing_spaces(): fix for " \ " sequence
Junio C Hamano [Thu, 10 Jul 2014 18:10:05 +0000 (11:10 -0700)]
Merge branch 'jk/repack-pack-keep-objects' into maint
* jk/repack-pack-keep-objects:
repack: s/write_bitmap/&s/ in code
repack: respect pack.writebitmaps
repack: do not accidentally pack kept objects by default
Junio C Hamano [Thu, 10 Jul 2014 18:08:31 +0000 (11:08 -0700)]
Merge branch 'mc/doc-submodule-sync-recurse' into maint
* mc/doc-submodule-sync-recurse:
submodule: document "sync --recursive"
Junio C Hamano [Wed, 9 Jul 2014 18:54:17 +0000 (11:54 -0700)]
Sixth batch for 2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 9 Jul 2014 18:34:28 +0000 (11:34 -0700)]
Merge branch 'sk/mingw-unicode-spawn-args'
* sk/mingw-unicode-spawn-args:
Win32: Unicode arguments (incoming)
Win32: Unicode arguments (outgoing)
MinGW: disable CRT command line globbing
Win32: fix potential multi-threading issue
Win32: simplify internal mingw_spawn* APIs
Win32: let mingw_execve() return an int
Junio C Hamano [Wed, 9 Jul 2014 18:34:27 +0000 (11:34 -0700)]
Merge branch 'sk/mingw-dirent'
* sk/mingw-dirent:
Win32 dirent: improve dirent implementation
Win32 dirent: clarify #include directives
Win32 dirent: change FILENAME_MAX to MAX_PATH
Win32 dirent: remove unused dirent.d_reclen member
Win32 dirent: remove unused dirent.d_ino member
Junio C Hamano [Wed, 9 Jul 2014 18:34:25 +0000 (11:34 -0700)]
Merge branch 'sk/mingw-uni-console'
* sk/mingw-uni-console:
Win32: reliably detect console pipe handles
Win32: fix broken pipe detection
Win32: Thread-safe windows console output
Win32: add Unicode conversion functions
Win32: warn if the console font doesn't support Unicode
Win32: detect console streams more reliably
Win32: support Unicode console output
Junio C Hamano [Wed, 9 Jul 2014 18:34:22 +0000 (11:34 -0700)]
Merge branch 'sk/mingw-main'
* sk/mingw-main:
mingw: avoid const warning
Win32: move main macro to a function
Junio C Hamano [Wed, 9 Jul 2014 18:34:13 +0000 (11:34 -0700)]
Merge branch 'jk/pretty-G-format-fixes'
* jk/pretty-G-format-fixes:
move "%G" format test from t7510 to t6006
pretty: avoid reading past end-of-string with "%G"
t7510: check %G* pretty-format output
t7510: test a commit signed by an unknown key
t7510: use consistent &&-chains in loop
t7510: stop referring to master in later tests
Junio C Hamano [Wed, 9 Jul 2014 18:34:05 +0000 (11:34 -0700)]
Merge branch 'jk/xstrfmt'
* jk/xstrfmt:
setup_git_env(): introduce git_path_from_env() helper
unique_path: fix unlikely heap overflow
walker_fetch: fix minor memory leak
merge: use argv_array when spawning merge strategy
sequencer: use argv_array_pushf
setup_git_env: use git_pathdup instead of xmalloc + sprintf
use xstrfmt to replace xmalloc + strcpy/strcat
use xstrfmt to replace xmalloc + sprintf
use xstrdup instead of xmalloc + strcpy
use xstrfmt in favor of manual size calculations
strbuf: add xstrfmt helper
Junio C Hamano [Wed, 9 Jul 2014 18:33:27 +0000 (11:33 -0700)]
Merge branch 'jk/skip-prefix'
* jk/skip-prefix:
http-push: refactor parsing of remote object names
imap-send: use skip_prefix instead of using magic numbers
use skip_prefix to avoid repeated calculations
git: avoid magic number with skip_prefix
fetch-pack: refactor parsing in get_ack
fast-import: refactor parsing of spaces
stat_opt: check extra strlen call
daemon: use skip_prefix to avoid magic numbers
fast-import: use skip_prefix for parsing input
use skip_prefix to avoid repeating strings
use skip_prefix to avoid magic numbers
transport-helper: avoid reading past end-of-string
fast-import: fix read of uninitialized argv memory
apply: use skip_prefix instead of raw addition
refactor skip_prefix to return a boolean
avoid using skip_prefix as a boolean
daemon: mark some strings as const
parse_diff_color_slot: drop ofs parameter
David Turner [Fri, 4 Jul 2014 20:24:01 +0000 (13:24 -0700)]
refs: fix valgrind suppression file
Add all of the ways in which check_refname_format violates valgrind's
expectations to the valgrind suppression file; remove an assumption about
the call chain of check_refname_format from same.
Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torsten Bögershausen [Sun, 29 Jun 2014 06:34:54 +0000 (08:34 +0200)]
t0027: combinations of core.autocrlf, core.eol and text
Historically there are 3 different parameters controlling how line endings
are handled by Git:
- core.autocrlf
- core.eol
- the "text" attribute in .gitattributes
There are different types of content:
- (1) Files with only LF
- (2) Files with only CRLF
- (3) Files with mixed LF and CRLF
- (4) Files with LF and/or CRLF with CR not followed by LF
- (5) Files which are binary (e.g. have NUL bytes)
Recently the question came up, how files with mixed EOLs are handled by Git
(and libgit2) when they are checked out and core.autocrlf=true.
See
http://git.661346.n2.nabble.com/The-different-EOL-behavior-between-libgit2-based-software-and-official-Git-td7613670.html#
a7613801
Add the EXPENSIVE t0027-auto-crlf.sh to test all combination of files
and parameters for both "git add/commit" and "git checkout".
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Torsten Bögershausen [Sun, 29 Jun 2014 06:34:22 +0000 (08:34 +0200)]
t0025: rename the test files
The current test files are named one, two and three.
Make it clearer what the tests do and rename them into
LFonly, CRLFonly and LFwithNUL.
After the renaming we can see easier that we may want more test cases
for 2 types of files:
- files which have mixed LF and CRLF line endings,
- files which have mixed LF and CR line endings.
See commit
fd6cce9e, "Add per-repository eol normalization" and
"the new safer autocrlf handling" in convert.c
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Tue, 8 Jul 2014 16:23:37 +0000 (18:23 +0200)]
line-log: use commit_list_append() instead of duplicating its code
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Tue, 8 Jul 2014 16:21:05 +0000 (18:21 +0200)]
diff-tree: call free_commit_list() instead of duplicating its code
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Sat, 5 Jul 2014 19:35:01 +0000 (21:35 +0200)]
t5000, t5003: simplify commit
Add the whole directory of test files at once using git add instead of
calling git update-index on each of them and use git commit instead of
the plumbing commands write-tree, update-ref and commit-tree to build
the commit. This simplifies the code considerably.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Karsten Blees [Fri, 4 Jul 2014 22:41:46 +0000 (00:41 +0200)]
symlinks: remove PATH_MAX limitation
'git checkout' fails if a directory is longer than PATH_MAX, because the
lstat_cache in symlinks.c checks if the leading directory exists using
PATH_MAX-bounded string operations.
Remove the limitation by using strbuf instead.
Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
David Turner [Sat, 5 Jul 2014 19:00:59 +0000 (12:00 -0700)]
refs.c: handle REFNAME_REFSPEC_PATTERN at end of page
When a ref crosses a memory page boundary, we restart the parsing
at the beginning with the bytewise code. Pass the original flags
to that code, rather than the current flags.
Reported-By: Øyvind A. Holm <sunny@sunbase.org>
Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 2 Jul 2014 19:53:07 +0000 (12:53 -0700)]
Merge branch 'dt/refs-check-refname-component-sse'
Further micro-optimization of a leaf-function.
* dt/refs-check-refname-component-sse:
refs.c: SSE2 optimizations for check_refname_component
Junio C Hamano [Wed, 2 Jul 2014 19:53:05 +0000 (12:53 -0700)]
Merge branch 'ye/http-extract-charset'
* ye/http-extract-charset:
http: fix charset detection of extract_content_type()
Junio C Hamano [Wed, 2 Jul 2014 19:53:04 +0000 (12:53 -0700)]
Merge branch 'bc/fix-rebase-merge-skip'
"git rebase --skip" did not work well when it stopped due to a
conflict twice in a row.
* bc/fix-rebase-merge-skip:
rebase--merge: fix --skip with two conflicts in a row
Junio C Hamano [Wed, 2 Jul 2014 19:53:02 +0000 (12:53 -0700)]
Merge branch 'jk/commit-buffer-length'
Move "commit->buffer" out of the in-core commit object and keep
track of their lengths. Use this to optimize the code paths to
validate GPG signatures in commit objects.
* jk/commit-buffer-length:
reuse cached commit buffer when parsing signatures
commit: record buffer length in cache
commit: convert commit->buffer to a slab
commit-slab: provide a static initializer
use get_commit_buffer everywhere
convert logmsg_reencode to get_commit_buffer
use get_commit_buffer to avoid duplicate code
use get_cached_commit_buffer where appropriate
provide helpers to access the commit buffer
provide a helper to set the commit buffer
provide a helper to free commit buffer
sequencer: use logmsg_reencode in get_message
logmsg_reencode: return const buffer
do not create "struct commit" with xcalloc
commit: push commit_index update into alloc_commit_node
alloc: include any-object allocations in alloc_report
replace dangerous uses of strbuf_attach
commit_tree: take a pointer/len pair rather than a const strbuf
Ronnie Sahlberg [Wed, 2 Jul 2014 18:24:05 +0000 (11:24 -0700)]
enums: remove trailing ',' after last item in enum
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 2 Jul 2014 19:52:46 +0000 (12:52 -0700)]
Merge branch 'maint'
* maint:
t7300: repair filesystem permissions with test_when_finished
enums: remove trailing ',' after last item in enum
Junio C Hamano [Wed, 2 Jul 2014 19:51:50 +0000 (12:51 -0700)]
Merge branch 'maint-1.8.5' into maint
* maint-1.8.5:
t7300: repair filesystem permissions with test_when_finished
enums: remove trailing ',' after last item in enum
Jeff King [Wed, 2 Jul 2014 18:44:30 +0000 (14:44 -0400)]
t7300: repair filesystem permissions with test_when_finished
We create a directory that cannot be removed, confirm that
it cannot be removed, and then fix it like:
chmod 0 foo &&
test_must_fail git clean -d -f &&
chmod 755 foo
If the middle step fails but leaves the directory (e.g., the
bug is that clean does not notice the failure), this
pollutes the test repo with an unremovable directory. Not
only does this cause further tests to fail, but it means
that "rm -rf" fails on the whole trash directory, and the
user has to intervene manually to even re-run the test script.
We can bump the "chmod 755" recovery to a test_when_finished
block to be sure that it always runs.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ronnie Sahlberg [Wed, 2 Jul 2014 18:24:05 +0000 (11:24 -0700)]
enums: remove trailing ',' after last item in enum
Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Tue, 1 Jul 2014 18:00:01 +0000 (20:00 +0200)]
sha1_file: avoid overrunning alternate object base string
While checking if a new alternate object database is a duplicate make
sure that old and new base paths have the same length before comparing
them with memcmp. This avoids overrunning the buffer of the existing
entry if the new one is longer and it stops rejecting foobar/ after
foo/ was already added.
Signed-off-by: Rene Scharfe <ls.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Charles Bailey [Mon, 30 Jun 2014 21:20:27 +0000 (22:20 +0100)]
filter-branch: eliminate duplicate mapped parents
When multiple parents of a merge commit get mapped to the same
commit, filter-branch used to pass all instances of the parent
commit to the parent and commit filters and to "git commit-tree" or
"git_commit_non_empty_tree".
This can often happen when extracting a small project from a large
repository; merges can join history with no commits on any branch
which affect the paths being retained. Once the intermediate
commits have been filtered out, all the immediate parents of the
merge commit can end up being mapped to the same commit - either the
original merge-base or an ancestor of it.
"git commit-tree" would display an error but write the commit with
the normalized parents in any case. "git_commit_non_empty_tree"
would fail to notice that the commit being made was in fact a
non-merge commit and would retain it even if a further pass with
"--prune-empty" would discard the commit as empty.
Ensure that duplicate parents are pruned before the parent filter to
make "--prune-empty" idempotent, removing all empty non-merge
commits in a singe pass.
Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Max Kirillov [Sat, 28 Jun 2014 22:04:46 +0000 (01:04 +0300)]
git-merge-file: do not add LF at EOF while applying unrelated change
If 'current-file' does not contain LF at EOF, and change between
'base-file' and 'other-file' does not change any line close to EOF, the
3-way merge should not add LF to EOF. This is what 'diff3 -m' does, and
seems to be a reasonable expectation.
The change which introduced the behavior is
cd1d61c44f. It always calls
function xdl_recs_copy() for sides with add_nl == 1. In fact, it looks
like the only case when this is needed is when 2 files are being
union-merged, and they do not have LF at EOF (strictly speaking, the
first of them).
Add tests:
* "merge without conflict (missing LF at EOF, away from change in the
other file)" and "merge does not add LF away of change", to demonstrate
the changed behavior.
* "conflict at EOF without LF resolved by --union", to verify that the
union-merge at the end inerts newline between versions.
* some more tests which I felt like not covering the functionality well
Signed-off-by: Max Kirillov <max@max630.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Max Kirillov [Sat, 28 Jun 2014 22:04:45 +0000 (01:04 +0300)]
t6023-merge-file.sh: fix and mark as broken invalid tests
Tests "merge without conflict (missing LF at EOF" and "merge result
added missing LF" are meaningless - the first one is identical to
"merge without conflict" and the second compares results of those
identical tests, which are always same.
This has been so since their addition in
ba1f5f3537. Probably "new4.txt"
was meant to be used instead of "new2.txt". Unfortunately, the current
merge-file breaks with new4 - conflict is reported. They also fail at
that revision if fixed.
Fix the file reference to "new4.txt" and mark the tests as failing -
they look like legitimate expectations, just not satisfied at time
being.
Signed-off-by: Max Kirillov <max@max630.net>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 17:04:03 +0000 (13:04 -0400)]
prepare_packed_git_one: refactor duplicate-pack check
When we are reloading the list of packs, we check whether a
particular pack has been loaded. This is slightly tricky,
because we load packs based on the presence of their ".idx"
files, but record the name of the matching ".pack" file.
Therefore we want to compare their bases.
The existing code stripped off ".idx" from a file we found,
then compared that whole base length to strings containing
the ".pack" version. This meant we could end up comparing
bytes past what the ".pack" string contained, if the ".idx"
file name was much longer.
In practice, it worked OK because memcmp would end up seeing
a difference in the two strings and would return early
before hitting the full length. However, memcmp may
sometimes read extra bytes past a difference (e.g., because
it is comparing 64-bit words), or is even free to compare in
reverse order.
Furthermore, our memcmp made no guarantees that we matched
the whole pack name, up to ".pack". So "foo.idx" would match
"foo-bar.pack", which is wrong (but does not typically
happen, because our pack names have a fixed size).
We can fix both issues, avoid magic numbers, and document
that we expect to compare against a string with ".pack" by
using strip_suffix.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 17:02:05 +0000 (13:02 -0400)]
verify-pack: use strbuf_strip_suffix
In this code, we try to convert both "foo.idx" and "foo"
into "foo.pack". By stripping the suffix, we can avoid a
confusing use of strbuf_splice, and make it clear that both
cases are adding ".pack" to the end.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 17:01:51 +0000 (13:01 -0400)]
strbuf: implement strbuf_strip_suffix
You can almost get away with just calling "strip_suffix_mem"
on a strbuf's buf and len fields. But we also need to move
the NUL-terminator to satisfy strbuf's invariants. Let's
provide a convenience wrapper that handles this.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 16:59:10 +0000 (12:59 -0400)]
index-pack: use strip_suffix to avoid magic numbers
We also switch to using strbufs, which lets us avoid the
potentially dangerous combination of a manual malloc
followed by a strcpy.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 16:58:51 +0000 (12:58 -0400)]
use strip_suffix instead of ends_with in simple cases
When stripping a suffix like:
if (ends_with(str, "foo"))
buf = xmemdupz(str, strlen(str) - 3);
we can instead use strip_suffix to avoid the constant 3,
which must match the literal "foo" (we sometimes use
strlen("foo") instead, but that means we are repeating
ourselves). The example above becomes:
if (strip_suffix(str, "foo", &len))
buf = xmemdupz(str, len);
This also saves a strlen(), since we calculate the string
length when detecting the suffix.
Note that in some cases we also switch from xstrndup to
xmemdupz, which saves a further strlen call.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 16:58:25 +0000 (12:58 -0400)]
replace has_extension with ends_with
These two are almost the same function, with the exception
that has_extension only matches if there is content before
the suffix. So ends_with(".exe", ".exe") is true, but
has_extension would not be.
This distinction does not matter to any of the callers,
though, and we can just replace uses of has_extension with
ends_with. We prefer the "ends_with" name because it is more
generic, and there is nothing about the function that
requires it to be used for file extensions.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 16:58:08 +0000 (12:58 -0400)]
implement ends_with via strip_suffix
The ends_with function is essentially a simplified version
of strip_suffix, in which we throw away the stripped length.
Implementing it as an inline on top of strip_suffix has two
advantages:
1. We save a bit of duplicated code.
2. The suffix is typically a string literal, and we call
strlen on it. By making the function inline, many
compilers can replace the strlen call with a constant.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Mon, 30 Jun 2014 16:57:51 +0000 (12:57 -0400)]
add strip_suffix function
Many callers of ends_with want to not only find out whether
a string has a suffix, but want to also strip it off. Doing
that separately has two minor problems:
1. We often run over the string twice (once to find
the suffix, and then once more to find its length to
subtract the suffix length).
2. We have to specify the suffix length again, which means
either a magic number, or repeating ourselves with
strlen("suffix").
Just as we have skip_prefix to avoid these cases with
starts_with, we can add a strip_suffix to avoid them with
ends_with.
Note that we add two forms of strip_suffix here: one that
takes a string, with the resulting length as an
out-parameter; and one that takes a pointer/length pair, and
reuses the length as an out-parameter. The latter is more
efficient when the caller already has the length (e.g., when
using strbufs), but it can be easy to confuse the two, as
they take the same number and types of parameters.
For that reason, the "mem" form puts its length parameter
next to the buffer (since they are a pair), and the string
form puts it at the end (since it is an out-parameter). The
compiler can notice when you get the order wrong, which
should help prevent writing one when you meant the other.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Mon, 30 Jun 2014 16:55:52 +0000 (12:55 -0400)]
sha1_file: replace PATH_MAX buffer with strbuf in prepare_packed_git_one()
Instead of using strbuf to create a message string in case a path is
too long for our fixed-size buffer, replace that buffer with a strbuf
and thus get rid of the limitation.
Helped-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Elia Pinto [Fri, 27 Jun 2014 12:11:39 +0000 (05:11 -0700)]
submodule.c: use the ARRAY_SIZE macro
Use the ARRAY_SIZE macro to get the number
of elements in an array.
Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Sun, 29 Jun 2014 20:55:44 +0000 (22:55 +0200)]
wt-status: simplify building of summary limit argument
Use argv_array_pushf for building the number string for the option
--summary-limit directly instead of using an intermediate buffer.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe [Sun, 29 Jun 2014 20:47:00 +0000 (22:47 +0200)]
wt-status: use argv_array for environment
Instead of using a PATH_MAX buffer, use argv_array for constructing the
environment for git submodule summary. This simplifies the code a bit
and removes the arbitrary length limit.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Fri, 27 Jun 2014 18:23:03 +0000 (11:23 -0700)]
Merge git://ozlabs.org/~paulus/gitk
* git://ozlabs.org/~paulus/gitk:
gitk: Add visiblerefs option, which lists always-shown branches
gitk: Catch mkdtemp errors
gitk: Use mktemp -d to avoid predictable temporary directories
gitk: Honor TMPDIR when viewing external diffs
Max Kirillov [Tue, 24 Jun 2014 05:19:44 +0000 (08:19 +0300)]
gitk: Add visiblerefs option, which lists always-shown branches
When many branches contain a commit, the branches used to be shown in
the form "A, B and many more", where A, B can be master of current
HEAD. But there are more which might be interesting to always know about.
For example, "origin/master".
The new option, visiblerefs, is stored in ~/.gitk. It contains a list
of references which are always shown before "and many more" if they
contain the commit. By default it is `{"master"}', which is compatible
with previous behavior.
Signed-off-by: Max Kirillov <max@max630.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
David Aguilar [Thu, 19 Jun 2014 02:53:14 +0000 (19:53 -0700)]
gitk: Catch mkdtemp errors
105b5d3f ("gitk: Use mktemp -d to avoid predictable temporary
directories") introduced a dependency on mkdtemp, which is not
available on Windows.
Use the original temporary directory behavior when mkdtemp fails.
This makes the code use mkdtemp when available and gracefully
fallback to the existing behavior when it is not available.
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Junio C Hamano [Thu, 26 Jun 2014 20:46:09 +0000 (13:46 -0700)]
Merge early parts from git://ozlabs.org/~paulus/gitk.git
* master~2:
gitk: Show staged submodules regardless of ignore config
gitk: Allow displaying time zones from author and commit dates timestamps
gitk: Switch to patch mode when searching for line origin
gitk: Replace SHA1 entry field on keyboard paste
l10n: Init Vietnamese translation
Junio C Hamano [Thu, 26 Jun 2014 20:44:11 +0000 (13:44 -0700)]
Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui:
git-gui: tolerate major version changes when comparing the git version
git-gui: show staged submodules regardless of ignore config
Jeff King [Tue, 24 Jun 2014 09:46:31 +0000 (05:46 -0400)]
replace: add a --raw mode for --edit
One of the purposes of "git replace --edit" is to help a
user repair objects which are malformed or corrupted.
Usually we pretty-print trees with "ls-tree", which is much
easier to work with than the raw binary data. However, some
forms of corruption break the tree-walker, in which case our
pretty-printing fails, rendering "--edit" useless for the
user.
This patch introduces a "--raw" option, which lets you edit
the binary data in these instances.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 24 Jun 2014 09:46:05 +0000 (05:46 -0400)]
replace: use argv_array in export_object
This is a little more verbose, but will make it easier to
make parts of our command-line conditional (without
resorting to magic numbers or lots of NULLs to get an
appropriately sized argv array).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 24 Jun 2014 09:45:46 +0000 (05:45 -0400)]
avoid double close of descriptors handed to run_command
When a file descriptor is given to run_command via the
"in", "out", or "err" parameters, run_command takes
ownership. The descriptor will be closed in the parent
process whether the process is spawned successfully or not,
and closing it again is wrong.
In practice this has not caused problems, because we usually
close() right after start_command returns, meaning no other
code has opened a descriptor in the meantime. So we just get
EBADF and ignore it (rather than accidentally closing
somebody else's descriptor!).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 24 Jun 2014 09:43:07 +0000 (05:43 -0400)]
replace: replace spaces with tabs in indentation
This matches our usual style and the surrounding code.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 25 Jun 2014 21:42:17 +0000 (17:42 -0400)]
move "%G" format test from t7510 to t6006
The final test in t7510 checks that "--format" placeholders
that look similar to GPG placeholders (but that we don't
actually understand) are passed through. That test was
placed in t7510, since the other GPG placeholder tests are
there. However, it does not have a GPG prerequisite, because
it is not actually checking any signed commits.
This causes the test to erroneously fail when gpg is not
installed on a system, however. Not because we need signed
commits, but because we need _any_ commit to run "git log".
If we don't have gpg installed, t7510 doesn't create any
commits at all.
We can fix this by moving the test into t6006. This is
arguably a better place anyway, because it is where we test
most of the other placeholders (we do not test GPG
placeholders there because of the infrastructure needed to
make signed commits).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 25 Jun 2014 19:32:58 +0000 (12:32 -0700)]
Sync with maint
Junio C Hamano [Wed, 25 Jun 2014 19:32:23 +0000 (12:32 -0700)]
Fifth batch for 2.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 25 Jun 2014 19:23:57 +0000 (12:23 -0700)]
Merge branch 'jm/dedup-name-compare'
* jm/dedup-name-compare:
cleanup duplicate name_compare() functions
name-hash.c: replace cache_name_compare() with memcmp(3)
Junio C Hamano [Wed, 25 Jun 2014 19:23:56 +0000 (12:23 -0700)]
Merge branch 'ep/avoid-test-a-o'
Update tests and scripts to avoid "test ... -a ...", which is often
more error-prone than "test ... && test ...".
Squashed misconversion fix-up into git-submodule.sh updates.
* ep/avoid-test-a-o:
git-submodule.sh: avoid "echo" path-like values
git-submodule.sh: avoid "test <cond> -a/-o <cond>"
t/test-lib-functions.sh: avoid "test <cond> -a/-o <cond>"
t/t9814-git-p4-rename.sh: avoid "test <cond> -a/-o <cond>"
t/t5538-push-shallow.sh: avoid "test <cond> -a/-o <cond>"
t/t5403-post-checkout-hook.sh: avoid "test <cond> -a/-o <cond>"
t/t5000-tar-tree.sh: avoid "test <cond> -a/-o <cond>"
t/t4102-apply-rename.sh: avoid "test <cond> -a/-o <cond>"
t/t0026-eol-config.sh: avoid "test <cond> -a/-o <cond>"
t/t0025-crlf-auto.sh: avoid "test <cond> -a/-o <cond>"
t/lib-httpd.sh: avoid "test <cond> -a/-o <cond>"
git-rebase--interactive.sh: avoid "test <cond> -a/-o <cond>"
git-mergetool.sh: avoid "test <cond> -a/-o <cond>"
git-bisect.sh: avoid "test <cond> -a/-o <cond>"
contrib/examples/git-resolve.sh: avoid "test <cond> -a/-o <cond>"
contrib/examples/git-repack.sh: avoid "test <cond> -a/-o <cond>"
contrib/examples/git-merge.sh: avoid "test <cond> -a/-o <cond>"
contrib/examples/git-commit.sh: avoid "test <cond> -a/-o <cond>"
contrib/examples/git-clone.sh: avoid "test <cond> -a/-o <cond>"
check_bindir: avoid "test <cond> -a/-o <cond>"
Junio C Hamano [Wed, 25 Jun 2014 19:23:54 +0000 (12:23 -0700)]
Merge branch 'tb/unicode-7.0-display-width'
* tb/unicode-7.0-display-width:
Update of unicode_width.h to Unicode Version 7.0
Junio C Hamano [Wed, 25 Jun 2014 19:23:52 +0000 (12:23 -0700)]
Merge branch 'ye/doc-http-proto'
* ye/doc-http-proto:
http-protocol.txt: Basic Auth is defined in RFC 2617, not RFC 2616
Junio C Hamano [Wed, 25 Jun 2014 19:23:36 +0000 (12:23 -0700)]
Merge branch 'rs/blame-refactor'
* rs/blame-refactor:
blame: simplify prepare_lines()
blame: factor out get_next_line()
Junio C Hamano [Wed, 25 Jun 2014 19:23:34 +0000 (12:23 -0700)]
Merge branch 'pb/trim-trailing-spaces'
* pb/trim-trailing-spaces:
t0008: do not depend on 'echo' handling backslashes specially
Junio C Hamano [Wed, 25 Jun 2014 19:23:29 +0000 (12:23 -0700)]
Merge branch 'mc/doc-submodule-sync-recurse'
* mc/doc-submodule-sync-recurse:
submodule: document "sync --recursive"
Junio C Hamano [Wed, 25 Jun 2014 19:23:27 +0000 (12:23 -0700)]
Merge branch 'sp/complete-ext-alias'
* sp/complete-ext-alias:
completion: handle '!f() { ... }; f' and "!sh -c '...' -" aliases
Junio C Hamano [Wed, 25 Jun 2014 19:23:24 +0000 (12:23 -0700)]
Merge branch 'mc/git-p4-prepare-p4-only'
* mc/git-p4-prepare-p4-only:
git-p4: fix submit in non --prepare-p4-only mode
Junio C Hamano [Wed, 25 Jun 2014 19:23:19 +0000 (12:23 -0700)]
Merge branch 'jk/repack-pack-writebitmaps-config'
* jk/repack-pack-writebitmaps-config:
t7700: drop explicit --no-pack-kept-objects from .keep test
repack: introduce repack.writeBitmaps config option
repack: simplify handling of --write-bitmap-index
pack-objects: stop respecting pack.writebitmaps
Junio C Hamano [Wed, 25 Jun 2014 19:22:00 +0000 (12:22 -0700)]
Merge branch 'nd/init-restore-env'
Some subcommands do not want to be aliased because of the side
effects that happens while the definitions of the aliases are looked
up from configuration system.
* nd/init-restore-env:
git potty: restore environments after alias expansion
Junio C Hamano [Wed, 25 Jun 2014 19:21:51 +0000 (12:21 -0700)]
Merge branch 'jk/repack-pack-keep-objects'
Recent updates to "git repack" started to duplicate objects that
are in packfiles marked with .keep flag into the new packfile by
mistake.
* jk/repack-pack-keep-objects:
repack: s/write_bitmap/&s/ in code
repack: respect pack.writebitmaps
repack: do not accidentally pack kept objects by default
Junio C Hamano [Wed, 25 Jun 2014 19:21:45 +0000 (12:21 -0700)]
Merge branch 'fr/sequencer-fail-with-not-one-upon-no-ff'
* fr/sequencer-fail-with-not-one-upon-no-ff:
sequencer: signal failed ff as an aborted, not a conflicted merge
Junio C Hamano [Wed, 25 Jun 2014 19:21:11 +0000 (12:21 -0700)]
Git 2.0.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 25 Jun 2014 18:50:13 +0000 (11:50 -0700)]
Merge branch 'na/no-http-test-in-the-middle' into maint
The mode to run tests with HTTP server tests disabled was broken.
* na/no-http-test-in-the-middle:
t5538: move http push tests out to t5542
Junio C Hamano [Wed, 25 Jun 2014 18:50:03 +0000 (11:50 -0700)]
Merge branch 'jl/status-added-submodule-is-never-ignored' into maint
"git status" (and "git commit") behaved as if changes in a modified
submodule are not there if submodule.*.ignore configuration is set,
which was misleading. The configuration is only to unclutter diff
output during the course of development, and should not to hide
changes in the "status" output to cause the users forget to commit
them.
* jl/status-added-submodule-is-never-ignored:
commit -m: commit staged submodules regardless of ignore config
status/commit: show staged submodules regardless of ignore config
Junio C Hamano [Wed, 25 Jun 2014 18:49:48 +0000 (11:49 -0700)]
Merge branch 'ym/fix-opportunistic-index-update-race' into maint
"git status", even though it is a read-only operation, tries to
update the index with refreshed lstat(2) info to optimize future
accesses to the working tree opportunistically, but this could
race with a "read-write" operation that modify the index while it
is running. Detect such a race and avoid overwriting the index.
* ym/fix-opportunistic-index-update-race:
read-cache.c: verify index file before we opportunistically update it
wrapper.c: add xpread() similar to xread()
Junio C Hamano [Wed, 25 Jun 2014 18:49:39 +0000 (11:49 -0700)]
Merge branch 'mk/show-s-no-extra-blank-line-for-merges' into maint
"git show -s" (i.e. show log message only) used to incorrectly emit
an extra blank line after a merge commit.
* mk/show-s-no-extra-blank-line-for-merges:
git-show: fix 'git show -s' to not add extra terminator after merge commit
Junio C Hamano [Wed, 25 Jun 2014 18:49:31 +0000 (11:49 -0700)]
Merge branch 'rr/rebase-autostash-fix' into maint
The autostash mode of "git rebase -i" did not restore the dirty
working tree state if the user aborted the interactive rebase by
emptying the insn sheet.
* rr/rebase-autostash-fix:
rebase -i: test "Nothing to do" case with autostash
rebase -i: handle "Nothing to do" case with autostash
Junio C Hamano [Wed, 25 Jun 2014 18:49:10 +0000 (11:49 -0700)]
Merge branch 'jc/shortlog-ref-exclude' into maint
"git log --exclude=<glob> --all | git shortlog" worked as expected,
but "git shortlog --exclude=<glob> --all", which is supposed to be
identical to the above pipeline, was not accepted at the command
line argument parser level.
* jc/shortlog-ref-exclude:
shortlog: allow --exclude=<glob> to be passed
Junio C Hamano [Wed, 25 Jun 2014 18:49:01 +0000 (11:49 -0700)]
Merge branch 'jl/remote-rm-prune' into maint
"git remote rm" and "git remote prune" can involve removing many
refs at once, which is not a very efficient thing to do when very
many refs exist in the packed-refs file.
* jl/remote-rm-prune:
remote prune: optimize "dangling symref" check/warning
remote: repack packed-refs once when deleting multiple refs
remote rm: delete remote configuration as the last
Junio C Hamano [Wed, 25 Jun 2014 18:48:54 +0000 (11:48 -0700)]
Merge branch 'fc/rerere-conflict-style' into maint
"git rerere forget" did not work well when merge.conflictstyle
was set to a non-default value.
* fc/rerere-conflict-style:
rerere: fix for merge.conflictstyle