gitweb.git
Merge branch 'sg/t3020-typofix'Junio C Hamano Wed, 26 Aug 2015 22:45:35 +0000 (15:45 -0700)

Merge branch 'sg/t3020-typofix'

* sg/t3020-typofix:
t3020: fix typo in test description

Merge branch 'jc/calloc-pathspec'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'jc/calloc-pathspec'

* jc/calloc-pathspec:
ps_matched: xcalloc() takes nmemb and then element size

Merge branch 'dt/untracked-sparse'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'dt/untracked-sparse'

Test update.

* dt/untracked-sparse:
t7063: use --force-untracked-cache to speed up a bit

Merge branch 'pt/am-builtin'Junio C Hamano Wed, 26 Aug 2015 22:45:33 +0000 (15:45 -0700)

Merge branch 'pt/am-builtin'

Rewrite "am" in "C".

* pt/am-builtin:
i18n: am: fix typo in description of -b option

Merge branch 'pt/am-builtin-abort-fix'Junio C Hamano Wed, 26 Aug 2015 22:45:32 +0000 (15:45 -0700)

Merge branch 'pt/am-builtin-abort-fix'

"git am" that was recently reimplemented in C had a performance
regression in "git am --abort" that goes back to the version before
an attempted (and failed) patch application.

* pt/am-builtin-abort-fix:
am --skip/--abort: merge HEAD/ORIG_HEAD tree into index

Merge branch 'po/po-readme'Junio C Hamano Wed, 26 Aug 2015 22:45:32 +0000 (15:45 -0700)

Merge branch 'po/po-readme'

* po/po-readme:
po/README: Update directions for l10n contributors

Merge branch 'jv/send-email-selective-smtp-auth'Junio C Hamano Wed, 26 Aug 2015 22:45:31 +0000 (15:45 -0700)

Merge branch 'jv/send-email-selective-smtp-auth'

"git send-email" learned a new option --smtp-auth to limit the SMTP
AUTH mechanisms to be used to a subset of what the system library
supports.

* jv/send-email-selective-smtp-auth:
send-email: provide whitelist of SMTP AUTH mechanisms

Merge branch 'ep/http-configure-ssl-version'Junio C Hamano Wed, 26 Aug 2015 22:45:31 +0000 (15:45 -0700)

Merge branch 'ep/http-configure-ssl-version'

A new configuration variable http.sslVersion can be used to specify
what specific version of SSL/TLS to use to make a connection.

* ep/http-configure-ssl-version:
http: add support for specifying the SSL version

Merge branch 'ss/fix-config-fd-leak'Junio C Hamano Wed, 26 Aug 2015 22:45:30 +0000 (15:45 -0700)

Merge branch 'ss/fix-config-fd-leak'

* ss/fix-config-fd-leak:
config: close config file handle in case of error

i18n: am: fix typo in description of -b optionJiang Xin Wed, 26 Aug 2015 15:51:19 +0000 (23:51 +0800)

i18n: am: fix typo in description of -b option

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Tue, 25 Aug 2015 23:09:30 +0000 (16:09 -0700)

Sync with maint

* maint:
pull: pass upload_pack only when it was given

Merge branch 'jk/guess-repo-name-regression-fix' into... Junio C Hamano Tue, 25 Aug 2015 23:09:17 +0000 (16:09 -0700)

Merge branch 'jk/guess-repo-name-regression-fix' into maint

"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL. This has been corrected.

* jk/guess-repo-name-regression-fix:
clone: use computed length in guess_dir_name
clone: add tests for output directory

Merge branch 'jk/test-with-x' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)

Merge branch 'jk/test-with-x' into maint

Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
test-lib: disable trace when test is not verbose
test-lib: turn off "-x" tracing during chain-lint check

Merge branch 'sb/check-return-from-read-ref' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)

Merge branch 'sb/check-return-from-read-ref' into maint

* sb/check-return-from-read-ref:
transport-helper: die on errors reading refs.

Merge branch 'mm/pull-upload-pack' into maintJunio C Hamano Tue, 25 Aug 2015 23:09:15 +0000 (16:09 -0700)

Merge branch 'mm/pull-upload-pack' into maint

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>. This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
pull: pass upload_pack only when it was given
pull.sh: quote $upload_pack when passing it to git-fetch

pull: pass upload_pack only when it was givenJunio C Hamano Tue, 25 Aug 2015 23:06:53 +0000 (16:06 -0700)

pull: pass upload_pack only when it was given

The upload_pack shell variable is initialized to an empty string, so
conditional expansion with ${upload_pack+"$upload_pack"} would not
work very well. You need a colon there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fifth batch for 2.6Junio C Hamano Tue, 25 Aug 2015 22:00:15 +0000 (15:00 -0700)

Fifth batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'cb/open-noatime-clear-errno'Junio C Hamano Tue, 25 Aug 2015 21:57:10 +0000 (14:57 -0700)

Merge branch 'cb/open-noatime-clear-errno'

When trying to see that an object does not exist, a state errno
leaked from our "first try to open a packfile with O_NOATIME and
then if it fails retry without it" logic on a system that refuses
O_NOATIME. This confused us and caused us to die, saying that the
packfile is unreadable, when we should have just reported that the
object does not exist in that packfile to the caller.

* cb/open-noatime-clear-errno:
git_open_noatime: return with errno=0 on success

Merge branch 'mh/tempfile'Junio C Hamano Tue, 25 Aug 2015 21:57:09 +0000 (14:57 -0700)

Merge branch 'mh/tempfile'

The "lockfile" API has been rebuilt on top of a new "tempfile" API.

* mh/tempfile:
credential-cache--daemon: use tempfile module
credential-cache--daemon: delete socket from main()
gc: use tempfile module to handle gc.pid file
lock_repo_for_gc(): compute the path to "gc.pid" only once
diff: use tempfile module
setup_temporary_shallow(): use tempfile module
write_shared_index(): use tempfile module
register_tempfile(): new function to handle an existing temporary file
tempfile: add several functions for creating temporary files
prepare_tempfile_object(): new function, extracted from create_tempfile()
tempfile: a new module for handling temporary files
commit_lock_file(): use get_locked_file_path()
lockfile: add accessor get_lock_file_path()
lockfile: add accessors get_lock_file_fd() and get_lock_file_fp()
create_bundle(): duplicate file descriptor to avoid closing it twice
lockfile: move documentation to lockfile.h and lockfile.c

Merge branch 'pt/am-builtin-options'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'pt/am-builtin-options'

After "git am --opt1" stops, running "git am --opt2" pays attention
to "--opt2" only for the patch that caused the original invocation
to stop.

* pt/am-builtin-options:
am: let --signoff override --no-signoff
am: let command-line options override saved options
test_terminal: redirect child process' stdin to a pty

Merge branch 'dt/refs-pseudo'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'dt/refs-pseudo'

To prepare for allowing a different "ref" backend to be plugged in
to the system, update_ref()/delete_ref() have been taught about
ref-like things like MERGE_HEAD that are per-worktree (they will
always be written to the filesystem inside $GIT_DIR).

* dt/refs-pseudo:
pseudoref: check return values from read_ref()
sequencer: replace write_cherry_pick_head with update_ref
bisect: use update_ref
pseudorefs: create and use pseudoref update and delete functions
refs: add ref_type function
refs: introduce pseudoref and per-worktree ref concepts

Merge branch 'dt/notes-multiple'Junio C Hamano Tue, 25 Aug 2015 21:57:08 +0000 (14:57 -0700)

Merge branch 'dt/notes-multiple'

When linked worktree is used, simultaneous "notes merge" instances
for the same ref in refs/notes/* are prevented from stomping on
each other.

* dt/notes-multiple:
notes: handle multiple worktrees
worktrees: add find_shared_symref

Merge branch 'nd/dwim-wildcards-as-pathspecs'Junio C Hamano Tue, 25 Aug 2015 21:57:07 +0000 (14:57 -0700)

Merge branch 'nd/dwim-wildcards-as-pathspecs'

Test updates for Windows.

* nd/dwim-wildcards-as-pathspecs:
t2019: skip test requiring '*' in a file name non Windows

Merge branch 'jk/long-error-messages'Junio C Hamano Tue, 25 Aug 2015 21:57:06 +0000 (14:57 -0700)

Merge branch 'jk/long-error-messages'

The codepath to produce error messages had a hard-coded limit to
the size of the message, primarily to avoid memory allocation while
calling die().

* jk/long-error-messages:
vreportf: avoid intermediate buffer
vreportf: report to arbitrary filehandles

Merge branch 'ee/clean-remove-dirs'Junio C Hamano Tue, 25 Aug 2015 21:57:06 +0000 (14:57 -0700)

Merge branch 'ee/clean-remove-dirs'

Test updates for Windows.

* ee/clean-remove-dirs:
t7300-clean: require POSIXPERM for chmod 0 test

Merge branch 'jh/strbuf-read-use-read-in-full'Junio C Hamano Tue, 25 Aug 2015 21:57:05 +0000 (14:57 -0700)

Merge branch 'jh/strbuf-read-use-read-in-full'

strbuf_read() used to have one extra iteration (and an unnecessary
strbuf_grow() of 8kB), which was eliminated.

* jh/strbuf-read-use-read-in-full:
strbuf_read(): skip unnecessary strbuf_grow() at eof

t3020: fix typo in test descriptionSZEDER Gábor Thu, 20 Aug 2015 13:58:55 +0000 (15:58 +0200)

t3020: fix typo in test description

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ps_matched: xcalloc() takes nmemb and then element... Junio C Hamano Thu, 20 Aug 2015 16:57:32 +0000 (09:57 -0700)

ps_matched: xcalloc() takes nmemb and then element size

Even though multiplication is commutative, the order of arguments
should be xcalloc(nmemb, size). ps_matched is an array of 1-byte
element whose size is the same as the number of pathspec elements.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Wed, 19 Aug 2015 21:49:37 +0000 (14:49 -0700)

Sync with maint

* maint:
Start preparing for 2.5.1

Fourth batch for 2.6Junio C Hamano Wed, 19 Aug 2015 21:46:09 +0000 (14:46 -0700)

Fourth batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'tb/complete-rebase-i-edit-todo'Junio C Hamano Wed, 19 Aug 2015 21:48:56 +0000 (14:48 -0700)

Merge branch 'tb/complete-rebase-i-edit-todo'

The command-line completion script (in contrib/) has been updated.

* tb/complete-rebase-i-edit-todo:
completion: offer '--edit-todo' during interactive rebase

Merge branch 'jk/git-path'Junio C Hamano Wed, 19 Aug 2015 21:48:56 +0000 (14:48 -0700)

Merge branch 'jk/git-path'

git_path() and mkpath() are handy helper functions but it is easy
to misuse, as the callers need to be careful to keep the number of
active results below 4. Their uses have been reduced.

* jk/git-path:
memoize common git-path "constant" files
get_repo_path: refactor path-allocation
find_hook: keep our own static buffer
refs.c: remove_empty_directories can take a strbuf
refs.c: avoid git_path assignment in lock_ref_sha1_basic
refs.c: avoid repeated git_path calls in rename_tmp_log
refs.c: simplify strbufs in reflog setup and writing
path.c: drop git_path_submodule
refs.c: remove extra git_path calls from read_loose_refs
remote.c: drop extraneous local variable from migrate_file
prefer mkpathdup to mkpath in assignments
prefer git_pathdup to git_path in some possibly-dangerous cases
add_to_alternates_file: don't add duplicate entries
t5700: modernize style
cache.h: complete set of git_path_submodule helpers
cache.h: clarify documentation for git_path, et al

Merge branch 'jc/finalize-temp-file'Junio C Hamano Wed, 19 Aug 2015 21:48:55 +0000 (14:48 -0700)

Merge branch 'jc/finalize-temp-file'

Long overdue micro clean-up.

* jc/finalize-temp-file:
sha1_file.c: rename move_temp_to_file() to finalize_object_file()

Merge branch 'ps/guess-repo-name-at-root'Junio C Hamano Wed, 19 Aug 2015 21:48:54 +0000 (14:48 -0700)

Merge branch 'ps/guess-repo-name-at-root'

"git clone $URL", when cloning from a site whose sole purpose is to
host a single repository (hence, no path after <scheme>://<site>/),
tried to use the site name as the new repository name, but did not
remove username or password when <site> part was of the form
<user>@<pass>:<host>. The code is taught to redact these.

* ps/guess-repo-name-at-root:
clone: abort if no dir name could be guessed
clone: do not use port number as dir name
clone: do not include authentication data in guessed dir

Merge branch 'jk/guess-repo-name-regression-fix'Junio C Hamano Wed, 19 Aug 2015 21:48:54 +0000 (14:48 -0700)

Merge branch 'jk/guess-repo-name-regression-fix'

"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL. This has been corrected.

* jk/guess-repo-name-regression-fix:
clone: use computed length in guess_dir_name
clone: add tests for output directory

Merge branch 'jk/negative-hiderefs'Junio C Hamano Wed, 19 Aug 2015 21:48:53 +0000 (14:48 -0700)

Merge branch 'jk/negative-hiderefs'

A negative !ref entry in multi-value transfer.hideRefs
configuration can be used to say "don't hide this one".

* jk/negative-hiderefs:
refs: support negative transfer.hideRefs
docs/config.txt: reorder hideRefs config

Merge branch 'jk/test-with-x'Junio C Hamano Wed, 19 Aug 2015 21:48:53 +0000 (14:48 -0700)

Merge branch 'jk/test-with-x'

Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
test-lib: disable trace when test is not verbose
test-lib: turn off "-x" tracing during chain-lint check

Merge branch 'ps/t1509-chroot-test-fixup'Junio C Hamano Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)

Merge branch 'ps/t1509-chroot-test-fixup'

t1509 test that requires a dedicated VM environment had some
bitrot, which has been corrected.

* ps/t1509-chroot-test-fixup:
tests: fix cleanup after tests in t1509-root-worktree
tests: fix broken && chains in t1509-root-worktree

Merge branch 'sb/check-return-from-read-ref'Junio C Hamano Wed, 19 Aug 2015 21:48:52 +0000 (14:48 -0700)

Merge branch 'sb/check-return-from-read-ref'

* sb/check-return-from-read-ref:
transport-helper: die on errors reading refs.

Merge branch 'mm/pull-upload-pack'Junio C Hamano Wed, 19 Aug 2015 21:48:51 +0000 (14:48 -0700)

Merge branch 'mm/pull-upload-pack'

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>. This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
pull.sh: quote $upload_pack when passing it to git-fetch

Start preparing for 2.5.1Junio C Hamano Wed, 19 Aug 2015 21:26:31 +0000 (14:26 -0700)

Start preparing for 2.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ta/docfix-index-format-tech' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:34 +0000 (14:41 -0700)

Merge branch 'ta/docfix-index-format-tech' into maint

* ta/docfix-index-format-tech:
typofix for index-format.txt

Merge branch 'sb/parse-options-codeformat' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)

Merge branch 'sb/parse-options-codeformat' into maint

* sb/parse-options-codeformat:
parse-options: align curly braces for all options

Merge branch 'sb/remove-unused-var-from-builtin-add... Junio C Hamano Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)

Merge branch 'sb/remove-unused-var-from-builtin-add' into maint

* sb/remove-unused-var-from-builtin-add:
add: remove dead code

Merge branch 'kn/tag-doc-fix' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:32 +0000 (14:41 -0700)

Merge branch 'kn/tag-doc-fix' into maint

* kn/tag-doc-fix:
Documentation/tag: remove double occurance of "<pattern>"

Merge branch 'es/doc-clean-outdated-tools' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:31 +0000 (14:41 -0700)

Merge branch 'es/doc-clean-outdated-tools' into maint

* es/doc-clean-outdated-tools:
Documentation/git-tools: retire manually-maintained list
Documentation/git-tools: drop references to defunct tools
Documentation/git-tools: fix item text formatting
Documentation/git-tools: improve discoverability of Git wiki
Documentation/git: drop outdated Cogito reference

Merge branch 'nd/export-worktree' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:30 +0000 (14:41 -0700)

Merge branch 'nd/export-worktree' into maint

Running an aliased command from a subdirectory when the .git thing
in the working tree is a gitfile pointing elsewhere did not work.

* nd/export-worktree:
setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR

Merge branch 'mh/fast-import-optimize-current-from... Junio C Hamano Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)

Merge branch 'mh/fast-import-optimize-current-from' into maint

Often a fast-import stream builds a new commit on top of the
previous commit it built, and it often unconditionally emits a
"from" command to specify the first parent, which can be omitted in
such a case. This caused fast-import to forget the tree of the
previous commit and then re-read it from scratch, which was
inefficient. Optimize for this common case.

* mh/fast-import-optimize-current-from:
fast-import: do less work when given "from" matches current branch head

Merge branch 'ib/scripted-parse-opt-better-hint-string... Junio C Hamano Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)

Merge branch 'ib/scripted-parse-opt-better-hint-string' into maint

The "rev-parse --parseopt" mode parsed the option specification
and the argument hint in a strange way to allow '=' and other
special characters in the option name while forbidding them from
the argument hint. This made it impossible to define an option
like "--pair <key>=<value>" with "pair=key=value" specification,
which instead would have defined a "--pair=key <value>" option.

* ib/scripted-parse-opt-better-hint-string:
rev-parse --parseopt: allow [*=?!] in argument hints

Merge branch 'se/doc-checkout-ours-theirs' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:28 +0000 (14:41 -0700)

Merge branch 'se/doc-checkout-ours-theirs' into maint

A "rebase" replays changes of the local branch on top of something
else, as such they are placed in stage #3 and referred to as
"theirs", while the changes in the new base, typically a foreign
work, are placed in stage #2 and referred to as "ours". Clarify
the "checkout --ours/--theirs".

* se/doc-checkout-ours-theirs:
checkout: document subtlety around --ours/--theirs

Merge branch 'cb/uname-in-untracked' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)

Merge branch 'cb/uname-in-untracked' into maint

An experimental "untracked cache" feature used uname(2) in a
slightly unportable way.

* cb/uname-in-untracked:
untracked: fix detection of uname(2) failure

Merge branch 'as/sparse-checkout-removal' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)

Merge branch 'as/sparse-checkout-removal' into maint

"sparse checkout" misbehaved for a path that is excluded from the
checkout when switching between branches that differ at the path.

* as/sparse-checkout-removal:
unpack-trees: don't update files with CE_WT_REMOVE set

Merge branch 'db/send-pack-user-signingkey' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)

Merge branch 'db/send-pack-user-signingkey' into maint

The low-level "git send-pack" did not honor 'user.signingkey'
configuration variable when sending a signed-push.

* db/send-pack-user-signingkey:
builtin/send-pack.c: respect user.signingkey

Merge branch 'jx/do-not-crash-receive-pack-wo-head... Junio C Hamano Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)

Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint

An attempt to delete a ref by pushing into a repositorywhose HEAD
symbolic reference points at an unborn branch that cannot be
created due to ref D/F conflict (e.g. refs/heads/a/b exists, HEAD
points at refs/heads/a) failed.

* jx/do-not-crash-receive-pack-wo-head:
receive-pack: crash when checking with non-exist HEAD

Merge branch 'da/subtree-date-confusion' into maintJunio C Hamano Wed, 19 Aug 2015 21:41:24 +0000 (14:41 -0700)

Merge branch 'da/subtree-date-confusion' into maint

"git subtree" (in contrib/) depended on "git log" output to be
stable, which was a no-no. Apply a workaround to force a
particular date format.

* da/subtree-date-confusion:
contrib/subtree: ignore log.date configuration

am --skip/--abort: merge HEAD/ORIG_HEAD tree into indexPaul Tan Wed, 19 Aug 2015 08:22:22 +0000 (16:22 +0800)

am --skip/--abort: merge HEAD/ORIG_HEAD tree into index

After running "git am --abort", and then running "git reset --hard",
files that were not modified would still be re-checked out.

This is because clean_index() in builtin/am.c mistakenly called the
read_tree() function, which overwrites all entries in the index,
including the stat info.

"git am --skip" did not seem to have this issue because am_skip() called
am_run(), which called refresh_cache() to update the stat info. However,
there's still a performance penalty as the lack of stat info meant that
refresh_cache() would have to scan all files for changes.

Fix this by using unpack_trees() instead to merge the tree into the
index, so that the stat info from the index is kept.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7063: use --force-untracked-cache to speed up a bitNguyễn Thái Ngọc Duy Wed, 19 Aug 2015 13:01:24 +0000 (20:01 +0700)

t7063: use --force-untracked-cache to speed up a bit

When in the middle of t7063, we are sure untracked cache is supported,
so we can use --force-untracked-cache to skip the support detection
phase and save a few seconds. It's also good that --force-untracked-cache
is exercised in the test suite.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Third batch for 2.6Junio C Hamano Mon, 17 Aug 2015 22:09:25 +0000 (15:09 -0700)

Third batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'dt/untracked-sparse'Junio C Hamano Mon, 17 Aug 2015 22:07:52 +0000 (15:07 -0700)

Merge branch 'dt/untracked-sparse'

Allow untracked cache (experimental) to be used when sparse
checkout (experimental) is also in use.

* dt/untracked-sparse:
untracked-cache: support sparse checkout

Merge branch 'ta/docfix-index-format-tech'Junio C Hamano Mon, 17 Aug 2015 22:07:52 +0000 (15:07 -0700)

Merge branch 'ta/docfix-index-format-tech'

* ta/docfix-index-format-tech:
typofix for index-format.txt

Merge branch 'mh/get-remote-group-fix'Junio C Hamano Mon, 17 Aug 2015 22:07:51 +0000 (15:07 -0700)

Merge branch 'mh/get-remote-group-fix'

An off-by-one error made "git remote" to mishandle a remote with a
single letter nickname.

* mh/get-remote-group-fix:
get_remote_group(): use skip_prefix()
get_remote_group(): eliminate superfluous call to strcspn()
get_remote_group(): rename local variable "space" to "wordlen"
get_remote_group(): handle remotes with single-character names

Merge branch 'kd/pull-rebase-autostash'Junio C Hamano Mon, 17 Aug 2015 22:07:50 +0000 (15:07 -0700)

Merge branch 'kd/pull-rebase-autostash'

"git pull --rebase" has been taught to pay attention to
rebase.autostash configuration.

* kd/pull-rebase-autostash:
pull: allow dirty tree when rebase.autostash enabled

send-email: provide whitelist of SMTP AUTH mechanismsJan Viktorin Tue, 11 Aug 2015 23:39:44 +0000 (01:39 +0200)

send-email: provide whitelist of SMTP AUTH mechanisms

When sending an e-mail, the client and server must agree on an
authentication mechanism. Some servers (due to misconfiguration
or a bug) deny valid credentials for certain mechanisms. In this
patch, a new option --smtp-auth and configuration entry smtpAuth
are introduced. If smtp_auth is defined, it works as a whitelist
of allowed mechanisms for authentication selected from the ones
supported by the installed SASL perl library.

Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

po/README: Update directions for l10n contributorsPhilip Oakley Sun, 16 Aug 2015 07:56:56 +0000 (15:56 +0800)

po/README: Update directions for l10n contributors

Some Linux distributions (such as Ubuntu) have their own l10n workflows,
and their translations may be different. Add notes for this case for
l10n translators.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: add support for specifying the SSL versionElia Pinto Fri, 14 Aug 2015 19:37:43 +0000 (21:37 +0200)

http: add support for specifying the SSL version

Teach git about a new option, "http.sslVersion", which permits one
to specify the SSL version to use when negotiating SSL connections.
The setting can be overridden by the GIT_SSL_VERSION environment
variable.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: close config file handle in case of errorSven Strickroth Fri, 14 Aug 2015 20:21:17 +0000 (22:21 +0200)

config: close config file handle in case of error

When updating an existing configuration file, we did not always
close the filehandle that is reading from the current configuration
file when we encountered an error (e.g. when unsetting a variable
that does not exist).

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-cache--daemon: use tempfile moduleMichael Haggerty Mon, 10 Aug 2015 09:47:51 +0000 (11:47 +0200)

credential-cache--daemon: use tempfile module

Use the tempfile module to ensure that the socket file gets deleted on
program exit.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-cache--daemon: delete socket from main()Michael Haggerty Mon, 10 Aug 2015 09:47:50 +0000 (11:47 +0200)

credential-cache--daemon: delete socket from main()

main() is responsible for cleaning up the socket in the case of
errors, so it is reasonable to also make it responsible for cleaning
it up when there are no errors. This change also makes the next step
easier.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gc: use tempfile module to handle gc.pid fileMichael Haggerty Mon, 10 Aug 2015 09:47:49 +0000 (11:47 +0200)

gc: use tempfile module to handle gc.pid file

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lock_repo_for_gc(): compute the path to "gc.pid" only... Michael Haggerty Mon, 10 Aug 2015 09:47:48 +0000 (11:47 +0200)

lock_repo_for_gc(): compute the path to "gc.pid" only once

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: use tempfile moduleMichael Haggerty Wed, 12 Aug 2015 17:12:01 +0000 (19:12 +0200)

diff: use tempfile module

Also add some code comments explaining how the fields in "struct
diff_tempfile" are used.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Second batch for 2.6Junio C Hamano Wed, 12 Aug 2015 21:16:31 +0000 (14:16 -0700)

Second batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'sb/remove-unused-var-from-builtin-add'Junio C Hamano Wed, 12 Aug 2015 21:09:58 +0000 (14:09 -0700)

Merge branch 'sb/remove-unused-var-from-builtin-add'

* sb/remove-unused-var-from-builtin-add:
add: remove dead code

Merge branch 'sb/parse-options-codeformat'Junio C Hamano Wed, 12 Aug 2015 21:09:57 +0000 (14:09 -0700)

Merge branch 'sb/parse-options-codeformat'

* sb/parse-options-codeformat:
parse-options: align curly braces for all options

Merge branch 'dt/unpack-trees-cache-tree-revalidate'Junio C Hamano Wed, 12 Aug 2015 21:09:57 +0000 (14:09 -0700)

Merge branch 'dt/unpack-trees-cache-tree-revalidate'

The code to perform multi-tree merges has been taught to repopulate
the cache-tree upon a successful merge into the index, so that
subsequent "diff-index --cached" (hence "status") and "write-tree"
(hence "commit") will go faster.

The same logic in "git checkout" may now be removed, but that is a
separate issue.

* dt/unpack-trees-cache-tree-revalidate:
unpack-trees: populate cache-tree on successful merge

Merge branch 'dt/reflog-tests'Junio C Hamano Wed, 12 Aug 2015 21:09:56 +0000 (14:09 -0700)

Merge branch 'dt/reflog-tests'

Tests that assume how reflogs are represented on the filesystem too
much have been corrected.

* dt/reflog-tests:
tests: remove some direct access to .git/logs
t/t7509: remove unnecessary manipulation of reflog

Merge branch 'es/worktree-add-cleanup'Junio C Hamano Wed, 12 Aug 2015 21:09:56 +0000 (14:09 -0700)

Merge branch 'es/worktree-add-cleanup'

The "new-worktree-mode" hack in "checkout" that was added in
nd/multiple-work-trees topic has been removed by updating the
implementation of new "worktree add".

* es/worktree-add-cleanup: (25 commits)
Documentation/git-worktree: fix duplicated 'from'
Documentation/config: mention "now" and "never" for 'expire' settings
Documentation/git-worktree: fix broken 'linkgit' invocation
checkout: drop intimate knowledge of newly created worktree
worktree: populate via "git reset --hard" rather than "git checkout"
worktree: avoid resolving HEAD unnecessarily
worktree: make setup of new HEAD distinct from worktree population
worktree: detect branch-name/detached and error conditions locally
worktree: add_worktree: construct worktree-population command locally
worktree: elucidate environment variables intended for child processes
worktree: make branch creation distinct from worktree population
worktree: add: suppress auto-vivication with --detach and no <branch>
worktree: make --detach mutually exclusive with -b/-B
worktree: introduce options container
worktree: simplify new branch (-b/-B) option checking
worktree: improve worktree setup message
branch: publish die_if_checked_out()
checkout: teach check_linked_checkout() about symbolic link HEAD
checkout: check_linked_checkout: simplify symref parsing
checkout: check_linked_checkout: improve "already checked out" aesthetic
...

Merge branch 'pt/am-builtin'Junio C Hamano Wed, 12 Aug 2015 21:09:55 +0000 (14:09 -0700)

Merge branch 'pt/am-builtin'

Rewrite "am" in "C".

* pt/am-builtin: (46 commits)
git-am: add am.threeWay config variable
builtin-am: remove redirection to git-am.sh
builtin-am: check for valid committer ident
builtin-am: implement legacy -b/--binary option
builtin-am: implement -i/--interactive
builtin-am: support and auto-detect mercurial patches
builtin-am: support and auto-detect StGit series files
builtin-am: support and auto-detect StGit patches
builtin-am: rerere support
builtin-am: invoke post-applypatch hook
builtin-am: invoke pre-applypatch hook
builtin-am: invoke applypatch-msg hook
builtin-am: support automatic notes copying
builtin-am: invoke post-rewrite hook
builtin-am: implement -S/--gpg-sign, commit.gpgsign
builtin-am: implement --committer-date-is-author-date
builtin-am: implement --ignore-date
builtin-am: pass git-apply's options to git-apply
builtin-am: implement --[no-]scissors
builtin-am: support --keep-cr, am.keepcr
...

Merge branch 'es/worktree-add'Junio C Hamano Wed, 12 Aug 2015 21:09:54 +0000 (14:09 -0700)

Merge branch 'es/worktree-add'

Remove remaining cruft from "git checkout --to", which
transitioned to "git worktree add".

* es/worktree-add:
config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"
Documentation/git-worktree: wordsmith worktree-related manpages
Documentation/config: fix stale "git prune --worktree" reference
Documentation/git-worktree: fix incorrect reference to file "locked"
Documentation/git-worktree: consistently use term "linked working tree"

Merge branch 'ad/bisect-cleanup'Junio C Hamano Wed, 12 Aug 2015 21:09:53 +0000 (14:09 -0700)

Merge branch 'ad/bisect-cleanup'

Code and documentation clean-up to "git bisect".

* ad/bisect-cleanup:
bisect: don't mix option parsing and non-trivial code
bisect: simplify the addition of new bisect terms
bisect: replace hardcoded "bad|good" by variables
Documentation/bisect: revise overall content
Documentation/bisect: move getting help section to the end
bisect: correction of typo

git_open_noatime: return with errno=0 on successClemens Buchacher Tue, 4 Aug 2015 08:24:29 +0000 (10:24 +0200)

git_open_noatime: return with errno=0 on success

In read_sha1_file_extended we die if read_object fails with a fatal
error. We detect a fatal error if errno is non-zero and is not
ENOENT. If the object could not be read because it does not exist,
this is not considered a fatal error and we want to return NULL.

Somewhere down the line, read_object calls git_open_noatime to open
a pack index file, for example. We first try open with O_NOATIME.
If O_NOATIME fails with EPERM, we retry without O_NOATIME. When the
second open succeeds, errno is however still set to EPERM from the
first attempt. When we finally determine that the object does not
exist, read_object returns NULL and read_sha1_file_extended dies
with a fatal error:

fatal: failed to read object <sha1>: Operation not permitted

Fix this by resetting errno to zero before we call open again.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: let --signoff override --no-signoffPaul Tan Tue, 4 Aug 2015 14:08:51 +0000 (22:08 +0800)

am: let --signoff override --no-signoff

After resolving a conflicting patch, a user may wish to sign off the
patch to declare that the patch has been modified. As such, the user
will expect that running "git am --signoff --continue" will append the
signoff to the commit message.

However, the --signoff option is only taken into account during the
mail-parsing stage. If the --signoff option is set, then the signoff
will be appended to the commit message. Since the mail-parsing stage
comes before the patch application stage, the --signoff option, if
provided on the command-line when resuming, will have no effect at all.

We cannot move the append_signoff() call to the patch application stage
as the applypatch-msg hook and interactive mode, which run before patch
application, may expect the signoff to be there.

Fix this by taking note if the user explictly set the --signoff option
on the command-line, and append the signoff to the commit message when
resuming if so.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: let command-line options override saved optionsPaul Tan Tue, 4 Aug 2015 14:08:50 +0000 (22:08 +0800)

am: let command-line options override saved options

When resuming, git-am mistakenly ignores command-line options.

For instance, when a patch fails to apply with "git am patch",
subsequently running "git am --3way" would not cause git-am to fall
back on attempting a threeway merge. This occurs because by default
the --3way option is saved as "false", and the saved am options are
loaded after the command-line options are parsed, thus overwriting
the command-line options when resuming.

Fix this by moving the am_load() function call before parse_options(),
so that command-line options will override the saved am options.

The purpose of supporting this use case is to enable users to "wiggle"
that one conflicting patch. As such, it is expected that the
command-line options do not affect subsequent applied patches. Implement
this by calling am_load() once we apply the conflicting patch
successfully.

Noticed-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test_terminal: redirect child process' stdin to a ptyPaul Tan Tue, 4 Aug 2015 14:08:49 +0000 (22:08 +0800)

test_terminal: redirect child process' stdin to a pty

When resuming, git-am detects if we are trying to feed it patches or not
by checking if stdin is a TTY.

However, the test library redirects stdin to /dev/null. This makes it
difficult, for instance, to test the behavior of "git am -3" when
resuming, as git-am will think we are trying to feed it patches and
error out.

Support this use case by extending test-terminal.perl to create a
pseudo-tty for the child process' standard input as well.

Note that due to the way the code is structured, the child's stdin
pseudo-tty will be closed when we finish reading from our stdin. This
means that in the common case, where our stdin is attached to /dev/null,
the child's stdin pseudo-tty will be closed immediately. Some operations
like isatty(), which git-am uses, require the file descriptor to be
open, and hence if the success of the command depends on such functions,
test_terminal's stdin should be redirected to a source with large amount
of data to ensure that the child's stdin is not closed, e.g.

test_terminal git am --3way </dev/zero

Cc: Jonathan Nieder <jrnieder@gmail.com>
Cc: Jeff King <peff@peff.net>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pseudoref: check return values from read_ref()David Turner Wed, 15 Jul 2015 22:05:28 +0000 (18:05 -0400)

pseudoref: check return values from read_ref()

These codepaths attempt to compare the "expected" current value with
the actual current value, but did not check if we successfully read
the current value before comparison.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t2019: skip test requiring '*' in a file name non WindowsJohannes Sixt Tue, 11 Aug 2015 20:38:46 +0000 (22:38 +0200)

t2019: skip test requiring '*' in a file name non Windows

A test case introduced by ae454f61 (Add tests for wildcard "path vs ref"
disambiguation) allocates a file named '*.c'. This does not work on
Windows, because the OS forbids file names containing wildcard
characters. The test case fails where the shell attempts to allocate the
file. Skip the test on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7300-clean: require POSIXPERM for chmod 0 testJohannes Sixt Tue, 11 Aug 2015 20:29:48 +0000 (22:29 +0200)

t7300-clean: require POSIXPERM for chmod 0 test

A test case introduced by 91479b9c (t7300: add tests to document
behavior of clean and nested git) uses 'chmod 0' to verify that a
subdirectory that has an unreadable .git file is not removed. This can
work only when the system pays attention to the permissions set with
'chmod'. Therefore, set the POSIXPERM prerequisite on the test case.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

vreportf: avoid intermediate bufferJeff King Tue, 11 Aug 2015 18:13:59 +0000 (14:13 -0400)

vreportf: avoid intermediate buffer

When we call "die(fmt, args...)", we end up in vreportf with
two pieces of information:

1. The prefix "fatal: "

2. The original fmt and va_list of args.

We format item (2) into a temporary buffer, and then fprintf
the prefix and the temporary buffer, along with a newline.
This has the unfortunate side effect of truncating any error
messages that are longer than 4096 bytes.

Instead, let's use separate calls for the prefix and
newline, letting us hand the item (2) directly to vfprintf.
This is essentially undoing d048a96 (print
warning/error/fatal messages in one shot, 2007-11-09), which
tried to have the whole output end up in a single `write`
call.

But we can address this instead by explicitly requesting
line-buffering for the output handle, and by making sure
that the buffer is empty before we start (so that outputting
the prefix does not cause a flush due to hitting the buffer
limit).

We may still break the output into two writes if the content
is larger than our buffer, but there's not much we can do
there; depending on the stdio implementation, that might
have happened even with a single fprintf call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

vreportf: report to arbitrary filehandlesJeff King Tue, 11 Aug 2015 18:06:15 +0000 (14:06 -0400)

vreportf: report to arbitrary filehandles

The vreportf function always goes to stderr, but run-command
wants child errors to go to the parent's original stderr. To
solve this, commit a5487dd duplicates the stderr fd and
installs die and error handlers to direct the output
appropriately (which later turned into the vwritef
function). This has two downsides, though:

- we make multiple calls to write(), which contradicts the
"write at once" logic from d048a96 (print
warning/error/fatal messages in one shot, 2007-11-09).

- the custom handlers basically duplicate the normal
handlers. They're only a few lines of code, but we
should not have to repeat the magic "exit(128)", for
example.

We can solve the first by using fdopen() on the duplicated
descriptor. We can't pass this to vreportf, but we could
introduce a new vreportf_to to handle it.

However, to fix the second problem, we instead introduce a
new "set_error_handle" function, which lets the normal
vreportf calls output to a handle besides stderr. Thus we
can get rid of our custom handlers entirely, and just ask
the regular handlers to output to our new descriptor.

And as vwritef has no more callers, it can just go away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: handle multiple worktreesDavid Turner Mon, 10 Aug 2015 17:52:45 +0000 (13:52 -0400)

notes: handle multiple worktrees

Before creating NOTES_MERGE_REF, check NOTES_MERGE_REF using
find_shared_symref and die if we find one. This prevents simultaneous
merges to the same notes branch from different worktrees.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktrees: add find_shared_symrefDavid Turner Mon, 10 Aug 2015 17:52:44 +0000 (13:52 -0400)

worktrees: add find_shared_symref

Add a new function, find_shared_symref, which contains the heart of
die_if_checked_out, but works for any symref, not just HEAD. Refactor
die_if_checked_out to use the same infrastructure as
find_shared_symref.

Soon, we will use find_shared_symref to protect notes merges in
worktrees.

Signed-off-by: David Turner <dturner@twopensource.com>
Reviewed-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

memoize common git-path "constant" filesJeff King Mon, 10 Aug 2015 09:38:57 +0000 (05:38 -0400)

memoize common git-path "constant" files

One of the most common uses of git_path() is to pass a
constant, like git_path("MERGE_MSG"). This has two
drawbacks:

1. The return value is a static buffer, and the lifetime
is dependent on other calls to git_path, etc.

2. There's no compile-time checking of the pathname. This
is OK for a one-off (after all, we have to spell it
correctly at least once), but many of these constant
strings appear throughout the code.

This patch introduces a series of functions to "memoize"
these strings, which are essentially globals for the
lifetime of the program. We compute the value once, take
ownership of the buffer, and return the cached value for
subsequent calls. cache.h provides a helper macro for
defining these functions as one-liners, and defines a few
common ones for global use.

Using a macro is a little bit gross, but it does nicely
document the purpose of the functions. If we need to touch
them all later (e.g., because we learned how to change the
git_dir variable at runtime, and need to invalidate all of
the stored values), it will be much easier to have the
complete list.

Note that the shared-global functions have separate, manual
declarations. We could do something clever with the macros
(e.g., expand it to a declaration in some places, and a
declaration _and_ a definition in path.c). But there aren't
that many, and it's probably better to stay away from
too-magical macros.

Likewise, if we abandon the C preprocessor in favor of
generating these with a script, we could get much fancier.
E.g., normalizing "FOO/BAR-BAZ" into "git_path_foo_bar_baz".
But the small amount of saved typing is probably not worth
the resulting confusion to readers who want to grep for the
function's definition.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

get_repo_path: refactor path-allocationJeff King Mon, 10 Aug 2015 09:37:55 +0000 (05:37 -0400)

get_repo_path: refactor path-allocation

The get_repo_path function calls mkpath() and then does some
non-trivial operations on it, like calling
is_git_directory() and read_gitfile(). These are actually
OK (they do not use more pathname static buffers
themselves), but it takes a fair bit of work to verify.

Let's use our own strbuf to store the path, and we can
simply reuse it for each iteration of the loop (we can even
avoid rewriting the beginning part, since we are trying a
series of suffixes).

To make the strbuf cleanup easier, we split out a thin
wrapper. As a bonus, this wrapper can factor out the
canonicalization that happens in all of the early-return
code paths.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

find_hook: keep our own static bufferJeff King Mon, 10 Aug 2015 09:37:45 +0000 (05:37 -0400)

find_hook: keep our own static buffer

The find_hook function returns the results of git_path,
which is a static buffer shared by other path-related calls.
Returning such a buffer is slightly dangerous, because it
can be overwritten by seemingly unrelated functions.

Let's at least keep our _own_ static buffer, so you can
only get in trouble by calling find_hook in quick
succession, which is less likely to happen and more obvious
to notice.

While we're at it, let's add some documentation of the
function's limitations.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: remove_empty_directories can take a strbufJeff King Mon, 10 Aug 2015 09:37:27 +0000 (05:37 -0400)

refs.c: remove_empty_directories can take a strbuf

The first thing we do in this function is copy the input
into a strbuf. Of the 4 callers, 3 of them already have a
strbuf we could use. Let's just take the strbuf, and convert
the remaining caller to use a strbuf, rather than a raw
git_path. This is safer, anyway, as remove_dir_recursively
is a non-trivial function that might use the pathname
buffers itself (this is _probably_ OK, as the likely culprit
would be calling resolve_gitlink_ref, but we do not pass the
proper flags to ask it to avoid blowing away gitlinks).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: avoid git_path assignment in lock_ref_sha1_basicJeff King Mon, 10 Aug 2015 09:37:12 +0000 (05:37 -0400)

refs.c: avoid git_path assignment in lock_ref_sha1_basic

Assigning the result of git_path is a bad pattern, because
it's not immediately obvious how long you expect the content
to stay valid (and it may be overwritten by subsequent
calls). Let's use a function-local strbuf here instead,
which we know is safe (we just have to remember to free it
in all code paths).

As a bonus, we get rid of a confusing variable-reuse
("ref_file" is used for two distinct purposes).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: avoid repeated git_path calls in rename_tmp_logJeff King Mon, 10 Aug 2015 09:36:53 +0000 (05:36 -0400)

refs.c: avoid repeated git_path calls in rename_tmp_log

Because it's not safe to store the static-buffer results of
git_path for a long time, we end up formatting the same
filename over and over. We can fix this by using a
function-local strbuf to store the formatted pathname and
avoid repeating ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: simplify strbufs in reflog setup and writingJeff King Mon, 10 Aug 2015 12:26:38 +0000 (08:26 -0400)

refs.c: simplify strbufs in reflog setup and writing

Commit 1a83c24 (git_snpath(): retire and replace with
strbuf_git_path(), 2014-11-30) taught log_ref_setup and
log_ref_write_1 to take a strbuf parameter, rather than a
bare string. It then makes an alias to the strbuf's "buf"
field under the original name.

This made the original diff much shorter, but the resulting
code is more complicated that it needs to be. Since we've
aliased the pointer, we drop our reference to the strbuf to
ensure we don't accidentally change it. But if we simply
drop our alias and use "logfile.buf" directly, we do not
have to worry about this aliasing. It's a larger diff, but
the resulting code is simpler.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: drop git_path_submoduleJeff King Mon, 10 Aug 2015 09:36:27 +0000 (05:36 -0400)

path.c: drop git_path_submodule

There are no callers of the slightly-dangerous static-buffer
git_path_submodule left. Let's drop it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: remove extra git_path calls from read_loose_refsJeff King Mon, 10 Aug 2015 09:36:19 +0000 (05:36 -0400)

refs.c: remove extra git_path calls from read_loose_refs

In iterating over the loose refs in "refs/foo/", we keep a
running strbuf with "refs/foo/one", "refs/foo/two", etc. But
we also need to access these files in the filesystem, as
".git/refs/foo/one", etc. For this latter purpose, we make a
series of independent calls to git_path(). These are safe
(we only use the result to call stat()), but assigning the
result of git_path is a suspicious pattern that we'd rather
avoid.

This patch keeps a running buffer with ".git/refs/foo/", and
we can just append/reset each directory element as we loop.
This matches how we handle the refnames. It should also be
more efficient, as we do not keep formatting the same
".git/refs/foo" prefix (which can be arbitrarily deep).

Technically we are dropping a call to strbuf_cleanup() on
each generated filename, but that's OK; it wasn't doing
anything, as we are putting in single-level names we read
from the filesystem (so it could not possibly be cleaning up
cruft like "./" in this instance).

A clever reader may also note that the running refname
buffer ("refs/foo/") is actually a subset of the filesystem
path buffer (".git/refs/foo/"). We could get by with one
buffer, indexing the length of $GIT_DIR when we want the
refname. However, having tried this, the resulting code
actually ends up a little more confusing, and the efficiency
improvement is tiny (and almost certainly dwarfed by the
system calls we are making).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>