Code

git.git
12 years agoMerge branch 'mh/ref-api'
Junio C Hamano [Tue, 20 Dec 2011 21:25:53 +0000 (13:25 -0800)]
Merge branch 'mh/ref-api'

* mh/ref-api:
  add_ref(): take a (struct ref_entry *) parameter
  create_ref_entry(): extract function from add_ref()
  repack_without_ref(): remove temporary
  resolve_gitlink_ref_recursive(): change to work with struct ref_cache
  Pass a (ref_cache *) to the resolve_gitlink_*() helper functions
  resolve_gitlink_ref(): improve docstring
  get_ref_dir(): change signature
  refs: change signatures of get_packed_refs() and get_loose_refs()
  is_dup_ref(): extract function from sort_ref_array()
  add_ref(): add docstring
  parse_ref_line(): add docstring
  is_refname_available(): remove the "quiet" argument
  clear_ref_array(): rename from free_ref_array()
  refs: rename parameters result -> sha1
  refs: rename "refname" variables
  struct ref_entry: document name member

Conflicts:
cache.h
refs.c

12 years agoMerge branch 'jc/advice-doc'
Junio C Hamano [Tue, 20 Dec 2011 21:25:29 +0000 (13:25 -0800)]
Merge branch 'jc/advice-doc'

* jc/advice-doc:
  advice: Document that they all default to true

12 years agoMerge branch 'jc/request-pull-show-head-4'
Junio C Hamano [Tue, 20 Dec 2011 21:25:27 +0000 (13:25 -0800)]
Merge branch 'jc/request-pull-show-head-4'

* jc/request-pull-show-head-4:
  request-pull: do not emit "tag" before the tagname
  request-pull: update the "pull" command generation logic

12 years agoMerge branch 'jc/pull-signed-tag'
Junio C Hamano [Tue, 20 Dec 2011 21:24:12 +0000 (13:24 -0800)]
Merge branch 'jc/pull-signed-tag'

* jc/pull-signed-tag:
  commit: do not lose mergetag header when not amending

12 years agoMerge branch 'jc/checkout-m-twoway'
Junio C Hamano [Tue, 20 Dec 2011 21:24:08 +0000 (13:24 -0800)]
Merge branch 'jc/checkout-m-twoway'

* jc/checkout-m-twoway:
  t/t2023-checkout-m.sh: fix use of test_must_fail

12 years agot/t2023-checkout-m.sh: fix use of test_must_fail
Ævar Arnfjörð Bjarmason [Tue, 20 Dec 2011 20:37:45 +0000 (20:37 +0000)]
t/t2023-checkout-m.sh: fix use of test_must_fail

Change an invocation of test_must_fail() to be inside a
test_expect_success() as is our usual pattern. Having it outside
caused our tests to fail under prove(1) since we wouldn't print a
newline before TAP output:

    CONFLICT (content): Merge conflict in both.txt
    # GETTEXT POISON #ok 2 - -m restores 2-way conflicted+resolved file

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocommit: do not lose mergetag header when not amending
Junio C Hamano [Tue, 20 Dec 2011 21:20:56 +0000 (13:20 -0800)]
commit: do not lose mergetag header when not amending

The earlier ed7a42a (commit: teach --amend to carry forward extra headers,
2011-11-08) broke "git merge/pull; edit to fix conflict; git commit"
workflow by forgetting that commit_tree_extended() takes the whole extra
header list.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'tr/cache-tree'
Junio C Hamano [Tue, 20 Dec 2011 20:16:04 +0000 (12:16 -0800)]
Merge branch 'tr/cache-tree'

* tr/cache-tree:
  t0090: be prepared that 'wc -l' writes leading blanks

12 years agot0090: be prepared that 'wc -l' writes leading blanks
Johannes Sixt [Tue, 20 Dec 2011 08:24:21 +0000 (09:24 +0100)]
t0090: be prepared that 'wc -l' writes leading blanks

Use 'printf %d $(whatever|wc -l)' so that the shell removes the blanks
for us.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9
Junio C Hamano [Tue, 20 Dec 2011 00:39:54 +0000 (16:39 -0800)]
Update draft release notes to 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ab/enable-i18n'
Junio C Hamano [Tue, 20 Dec 2011 00:06:41 +0000 (16:06 -0800)]
Merge branch 'ab/enable-i18n'

* ab/enable-i18n:
  i18n: add infrastructure for translating Git with gettext

Conflicts:
Makefile

12 years agoMerge branch 'ew/keepalive'
Junio C Hamano [Tue, 20 Dec 2011 00:06:32 +0000 (16:06 -0800)]
Merge branch 'ew/keepalive'

* ew/keepalive:
  enable SO_KEEPALIVE for connected TCP sockets

12 years agoMerge branch 'jc/checkout-m-twoway'
Junio C Hamano [Tue, 20 Dec 2011 00:06:22 +0000 (16:06 -0800)]
Merge branch 'jc/checkout-m-twoway'

* jc/checkout-m-twoway:
  checkout_merged(): squelch false warning from some gcc
  Test 'checkout -m -- path'
  checkout -m: no need to insist on having all 3 stages

12 years agoMerge branch 'jk/maint-push-over-dav'
Junio C Hamano [Tue, 20 Dec 2011 00:05:59 +0000 (16:05 -0800)]
Merge branch 'jk/maint-push-over-dav'

* jk/maint-push-over-dav:
  http-push: enable "proactive auth"
  t5540: test DAV push with authentication

Conflicts:
http.c

12 years agoMerge branch 'jk/fetch-no-tail-match-refs'
Junio C Hamano [Tue, 20 Dec 2011 00:05:55 +0000 (16:05 -0800)]
Merge branch 'jk/fetch-no-tail-match-refs'

* jk/fetch-no-tail-match-refs:
  connect.c: drop path_match function
  fetch-pack: match refs exactly
  t5500: give fully-qualified refs to fetch-pack
  drop "match" parameter from get_remote_heads

12 years agoMerge branch 'nd/resolve-ref'
Junio C Hamano [Tue, 20 Dec 2011 00:05:50 +0000 (16:05 -0800)]
Merge branch 'nd/resolve-ref'

* nd/resolve-ref:
  Rename resolve_ref() to resolve_ref_unsafe()
  Convert resolve_ref+xstrdup to new resolve_refdup function
  revert: convert resolve_ref() to read_ref_full()

12 years agoMerge branch 'jn/maint-sequencer-fixes'
Junio C Hamano [Tue, 20 Dec 2011 00:05:45 +0000 (16:05 -0800)]
Merge branch 'jn/maint-sequencer-fixes'

* jn/maint-sequencer-fixes:
  revert: stop creating and removing sequencer-old directory
  Revert "reset: Make reset remove the sequencer state"
  revert: do not remove state until sequence is finished
  revert: allow single-pick in the middle of cherry-pick sequence
  revert: pass around rev-list args in already-parsed form
  revert: allow cherry-pick --continue to commit before resuming
  revert: give --continue handling its own function

12 years agoMerge branch 'jk/maint-snprintf-va-copy'
Junio C Hamano [Tue, 20 Dec 2011 00:05:38 +0000 (16:05 -0800)]
Merge branch 'jk/maint-snprintf-va-copy'

* jk/maint-snprintf-va-copy:
  compat/snprintf: don't look at va_list twice

12 years agoMerge branch 'jk/maint-mv'
Junio C Hamano [Tue, 20 Dec 2011 00:05:34 +0000 (16:05 -0800)]
Merge branch 'jk/maint-mv'

* jk/maint-mv:
  mv: be quiet about overwriting
  mv: improve overwrite warning
  mv: make non-directory destination error more clear
  mv: honor --verbose flag
  docs: mention "-k" for both forms of "git mv"

12 years agoMerge branch 'ci/stripspace-docs'
Junio C Hamano [Tue, 20 Dec 2011 00:05:31 +0000 (16:05 -0800)]
Merge branch 'ci/stripspace-docs'

* ci/stripspace-docs:
  Update documentation for stripspace

12 years agoMerge branch 'rr/test-chaining'
Junio C Hamano [Tue, 20 Dec 2011 00:05:25 +0000 (16:05 -0800)]
Merge branch 'rr/test-chaining'

* rr/test-chaining:
  t3401: use test_commit in setup
  t3401: modernize style
  t3040 (subprojects-basic): fix '&&' chaining, modernize style
  t1510 (worktree): fix '&&' chaining
  t3030 (merge-recursive): use test_expect_code
  test: fix '&&' chaining
  t3200 (branch): fix '&&' chaining

12 years agoMerge branch 'tr/cache-tree'
Junio C Hamano [Tue, 20 Dec 2011 00:05:20 +0000 (16:05 -0800)]
Merge branch 'tr/cache-tree'

* tr/cache-tree:
  reset: update cache-tree data when appropriate
  commit: write cache-tree data when writing index anyway
  Refactor cache_tree_update idiom from commit
  Test the current state of the cache-tree optimization
  Add test-scrap-cache-tree

12 years agoMerge branch 'jk/credentials'
Junio C Hamano [Tue, 20 Dec 2011 00:05:16 +0000 (16:05 -0800)]
Merge branch 'jk/credentials'

* jk/credentials:
  t: add test harness for external credential helpers
  credentials: add "store" helper
  strbuf: add strbuf_add*_urlencode
  Makefile: unix sockets may not available on some platforms
  credentials: add "cache" helper
  docs: end-user documentation for the credential subsystem
  credential: make relevance of http path configurable
  credential: add credential.*.username
  credential: apply helper config
  http: use credential API to get passwords
  credential: add function for parsing url components
  introduce credentials API
  t5550: fix typo
  test-lib: add test_config_global variant

Conflicts:
strbuf.c

12 years agorequest-pull: do not emit "tag" before the tagname
Junio C Hamano [Mon, 19 Dec 2011 19:59:57 +0000 (11:59 -0800)]
request-pull: do not emit "tag" before the tagname

The whole point of the recent update to allow "git pull $url $tagname" is
so that the integrator does not have to store the (signed) tag that is
used to convey authenticity to be recorded in the resulting merge in the
local repository's tag namespace.  Asking for a merge be made with "git
pull $url tag $tagname" defeats it.

Note that the request can become ambiguous if the requestor has a branch
with the same name as the tag, but that is not a new problem limited to
pulling. I wouldn't mind if somebody wants to add disambiguation to the
find_matching_ref logic in the script as a separate patch, though.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoadvice: Document that they all default to true
Junio C Hamano [Mon, 19 Dec 2011 05:35:01 +0000 (21:35 -0800)]
advice: Document that they all default to true

By definition, the default value of "advice.*" variables must be true and
they all control various additional help messages that are designed to aid
new users. Setting one to false is to tell Git that the user understands
the nature of the error and does not need the additional verbose help
message.

Also fix the asciidoc markup for linkgit:git-checkout[1] in the
description of the detachedHead advice by removing an excess colon.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-p4: fix skipSubmitEdit regression
Pete Wyckoff [Sat, 17 Dec 2011 17:39:03 +0000 (12:39 -0500)]
git-p4: fix skipSubmitEdit regression

Commit 7c766e5 (git-p4: introduce skipSubmitEdit, 2011-12-04)
made it easier to automate submission to p4, but broke the most
common case.

Add a test for when the user really does edit and save the change
template, and fix the bug that causes the test to fail.

Also add a confirmation message when submission is cancelled.

Reported-by: Michael Horowitz <michael.horowitz@ieee.org>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9
Junio C Hamano [Sat, 17 Dec 2011 06:45:03 +0000 (22:45 -0800)]
Update draft release notes to 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/commit-amend-no-edit'
Junio C Hamano [Sat, 17 Dec 2011 06:33:56 +0000 (22:33 -0800)]
Merge branch 'jc/commit-amend-no-edit'

* jc/commit-amend-no-edit:
  test: commit --amend should honor --no-edit
  commit: honour --no-edit
  t7501 (commit): modernize style
  test: remove a porcelain test that hard-codes commit names
  test: add missing "&&" after echo command

12 years agoMerge branch 'jc/stream-to-pack'
Junio C Hamano [Sat, 17 Dec 2011 06:33:40 +0000 (22:33 -0800)]
Merge branch 'jc/stream-to-pack'

* jc/stream-to-pack:
  bulk-checkin: replace fast-import based implementation
  csum-file: introduce sha1file_checkpoint
  finish_tmp_packfile(): a helper function
  create_tmp_packfile(): a helper function
  write_pack_header(): a helper function

Conflicts:
pack.h

12 years agoMerge branch 'aw/rebase-i-stop-on-failure-to-amend'
Junio C Hamano [Sat, 17 Dec 2011 06:33:37 +0000 (22:33 -0800)]
Merge branch 'aw/rebase-i-stop-on-failure-to-amend'

* aw/rebase-i-stop-on-failure-to-amend:
  rebase -i: interrupt rebase when "commit --amend" failed during "reword"

12 years agoMerge branch 'jh/fast-import-notes'
Junio C Hamano [Sat, 17 Dec 2011 06:33:34 +0000 (22:33 -0800)]
Merge branch 'jh/fast-import-notes'

* jh/fast-import-notes:
  fast-import: Fix incorrect fanout level when modifying existing notes refs
  t9301: Add 2nd testcase exposing bugs in fast-import's notes fanout handling
  t9301: Fix testcase covering up a bug in fast-import's notes fanout handling

12 years agoMerge branch 'jk/upload-archive-use-start-command'
Junio C Hamano [Sat, 17 Dec 2011 06:33:30 +0000 (22:33 -0800)]
Merge branch 'jk/upload-archive-use-start-command'

* jk/upload-archive-use-start-command:
  upload-archive: use start_command instead of fork

12 years agoMerge git://ozlabs.org/~paulus/gitk
Junio C Hamano [Sat, 17 Dec 2011 06:18:42 +0000 (22:18 -0800)]
Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
  gitk: Make vi-style keybindings more vi-like
  gitk: Make "touching paths" search support backslashes
  gitk: Show modified files with separate work tree
  gitk: Simplify calculation of gitdir
  gitk: Run 'git rev-parse --git-dir' only once
  gitk: Put temporary directory inside .git
  gitk: Fix "External diff" with separate work tree
  gitk: Fix "blame parent commit" with separate work tree
  gitk: Fix "show origin of this line" with separate work tree
  gitk: Fix file highlight when run in subdirectory
  gitk: Update copyright
  gitk: When a commit contains a note, mark it with a yellow box
  gitk: Remember time zones from author and commit timestamps
  gitk: Remove unused $cdate array

12 years agorequest-pull: update the "pull" command generation logic
Junio C Hamano [Fri, 16 Dec 2011 17:00:11 +0000 (09:00 -0800)]
request-pull: update the "pull" command generation logic

The old code that insisted on asking for the tip of a branch to be pulled
were not updated when we started allowing for a tag to be pulled. When a
tag points at an older part of the history and there is no branch that
points at the tagged commit, the script failed to say which ref is to be
pulled.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocheckout_merged(): squelch false warning from some gcc
Junio C Hamano [Thu, 15 Dec 2011 18:10:11 +0000 (10:10 -0800)]
checkout_merged(): squelch false warning from some gcc

gcc 4.6.2 (there may be others) does not realize that the variable "mode"
can never be used uninitialized in this function and issues a false warning
under -Wuninitialized option.

Squelch it with an unnecessary initialization; it is not like a single
assignment matters to the performance in this codepath that writes out
to the filesystem with checkout_entry() anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate draft release notes to 1.7.9
Junio C Hamano [Wed, 14 Dec 2011 07:09:27 +0000 (23:09 -0800)]
Update draft release notes to 1.7.9

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ks/tag-cleanup'
Junio C Hamano [Wed, 14 Dec 2011 07:03:00 +0000 (23:03 -0800)]
Merge branch 'ks/tag-cleanup'

* ks/tag-cleanup:
  git-tag: introduce --cleanup option

Conflicts:
builtin/tag.c

12 years agoMerge branch 'jl/submodule-status-failure-report'
Junio C Hamano [Wed, 14 Dec 2011 07:00:52 +0000 (23:00 -0800)]
Merge branch 'jl/submodule-status-failure-report'

* jl/submodule-status-failure-report:
  diff/status: print submodule path when looking for changes fails

12 years agoMerge branch 'tr/userdiff-c-returns-pointer'
Junio C Hamano [Wed, 14 Dec 2011 06:57:19 +0000 (22:57 -0800)]
Merge branch 'tr/userdiff-c-returns-pointer'

* tr/userdiff-c-returns-pointer:
  userdiff: allow * between cpp funcname words

12 years agoMerge branch 'bc/maint-apply-check-no-patch'
Junio C Hamano [Wed, 14 Dec 2011 06:56:22 +0000 (22:56 -0800)]
Merge branch 'bc/maint-apply-check-no-patch'

* bc/maint-apply-check-no-patch:
  builtin/apply.c: report error on failure to recognize input
  t/t4131-apply-fake-ancestor.sh: fix broken test

12 years agoMerge branch 'nd/ignore-might-be-precious'
Junio C Hamano [Wed, 14 Dec 2011 06:55:07 +0000 (22:55 -0800)]
Merge branch 'nd/ignore-might-be-precious'

* nd/ignore-might-be-precious:
  checkout,merge: disallow overwriting ignored files with --no-overwrite-ignore

12 years agoMerge branch 'jn/branch-move-to-self'
Junio C Hamano [Wed, 14 Dec 2011 06:53:08 +0000 (22:53 -0800)]
Merge branch 'jn/branch-move-to-self'

* jn/branch-move-to-self:
  Allow checkout -B <current-branch> to update the current branch
  branch: allow a no-op "branch -M <current-branch> HEAD"

12 years agoMerge branch 'cn/maint-lf-to-crlf-filter'
Junio C Hamano [Wed, 14 Dec 2011 06:49:45 +0000 (22:49 -0800)]
Merge branch 'cn/maint-lf-to-crlf-filter'

* cn/maint-lf-to-crlf-filter:
  convert: track state in LF-to-CRLF filter

12 years agoMerge branch 'tj/maint-imap-send-remove-unused'
Junio C Hamano [Wed, 14 Dec 2011 06:49:19 +0000 (22:49 -0800)]
Merge branch 'tj/maint-imap-send-remove-unused'

* tj/maint-imap-send-remove-unused:
  imap-send: Remove unused 'use_namespace' variable

12 years agoMerge branch 'jk/maint-upload-archive'
Junio C Hamano [Wed, 14 Dec 2011 06:47:38 +0000 (22:47 -0800)]
Merge branch 'jk/maint-upload-archive'

* jk/maint-upload-archive:
  archive: don't let remote clients get unreachable commits

12 years agoMerge branch 'jn/gitweb-side-by-side-diff'
Junio C Hamano [Wed, 14 Dec 2011 06:46:57 +0000 (22:46 -0800)]
Merge branch 'jn/gitweb-side-by-side-diff'

* jn/gitweb-side-by-side-diff:
  gitweb: Add navigation to select side-by-side diff
  gitweb: Use href(-replay=>1,...) for formats links in "commitdiff"
  t9500: Add basic sanity tests for side-by-side diff in gitweb
  t9500: Add test for handling incomplete lines in diff by gitweb
  gitweb: Give side-by-side diff extra CSS styling
  gitweb: Add a feature to show side-by-side diff
  gitweb: Extract formatting of diff chunk header
  gitweb: Refactor diff body line classification

12 years agoMerge branch 'maint'
Junio C Hamano [Wed, 14 Dec 2011 06:18:00 +0000 (22:18 -0800)]
Merge branch 'maint'

* maint:
  Update draft release notes for 1.7.8.1
  Git 1.7.7.5
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf

Conflicts:
RelNotes

12 years agoUpdate draft release notes for 1.7.8.1
Junio C Hamano [Wed, 14 Dec 2011 06:08:52 +0000 (22:08 -0800)]
Update draft release notes for 1.7.8.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jc/maint-pack-object-cycle' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:04:50 +0000 (22:04 -0800)]
Merge branch 'jc/maint-pack-object-cycle' into maint

* jc/maint-pack-object-cycle:
  pack-object: tolerate broken packs that have duplicated objects

Conflicts:
builtin/pack-objects.c

12 years agoMerge branch 'jc/index-pack-reject-dups' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:03:36 +0000 (22:03 -0800)]
Merge branch 'jc/index-pack-reject-dups' into maint

* jc/index-pack-reject-dups:
  receive-pack, fetch-pack: reject bogus pack that records objects twice

12 years agoMerge branch 'mf/curl-select-fdset' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:03:17 +0000 (22:03 -0800)]
Merge branch 'mf/curl-select-fdset' into maint

* mf/curl-select-fdset:
  http: drop "local" member from request struct
  http.c: Rely on select instead of tracking whether data was received
  http.c: Use timeout suggested by curl instead of fixed 50ms timeout
  http.c: Use curl_multi_fdset to select on curl fds instead of just sleeping

12 years agoMerge branch 'nd/misc-cleanups' into maint
Junio C Hamano [Wed, 14 Dec 2011 06:02:51 +0000 (22:02 -0800)]
Merge branch 'nd/misc-cleanups' into maint

* nd/misc-cleanups:
  unpack_object_header_buffer(): clear the size field upon error
  tree_entry_interesting: make use of local pointer "item"
  tree_entry_interesting(): give meaningful names to return values
  read_directory_recursive: reduce one indentation level
  get_tree_entry(): do not call find_tree_entry() on an empty tree
  tree-walk.c: do not leak internal structure in tree_entry_len()

12 years agoMerge branch 'maint-1.7.7' into maint
Junio C Hamano [Wed, 14 Dec 2011 05:58:51 +0000 (21:58 -0800)]
Merge branch 'maint-1.7.7' into maint

* maint-1.7.7:
  Git 1.7.7.5
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf
  checkout,merge: loosen overwriting untracked file check based on info/exclude
  cast variable in call to free() in builtin/diff.c and submodule.c
  apply: get rid of useless x < 0 comparison on a size_t type

Conflicts:
Documentation/git.txt
GIT-VERSION-GEN
RelNotes
builtin/fetch.c

12 years agoGit 1.7.7.5 v1.7.7.5
Junio C Hamano [Wed, 14 Dec 2011 05:55:31 +0000 (21:55 -0800)]
Git 1.7.7.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'ab/clang-lints' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:47:51 +0000 (21:47 -0800)]
Merge branch 'ab/clang-lints' into maint-1.7.7

* ab/clang-lints:
  cast variable in call to free() in builtin/diff.c and submodule.c
  apply: get rid of useless x < 0 comparison on a size_t type

12 years agoMerge branch 'nd/maint-ignore-exclude' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:47:08 +0000 (21:47 -0800)]
Merge branch 'nd/maint-ignore-exclude' into maint-1.7.7

* nd/maint-ignore-exclude:
  checkout,merge: loosen overwriting untracked file check based on info/exclude

12 years agoMerge branch 'maint-1.7.6' into maint-1.7.7
Junio C Hamano [Wed, 14 Dec 2011 05:44:56 +0000 (21:44 -0800)]
Merge branch 'maint-1.7.6' into maint-1.7.7

* maint-1.7.6:
  Git 1.7.6.5
  blame: don't overflow time buffer
  fetch: create status table using strbuf

Conflicts:
Documentation/git.txt
GIT-VERSION-GEN
RelNotes

12 years agoGit 1.7.6.5 v1.7.6.5
Junio C Hamano [Wed, 14 Dec 2011 05:30:40 +0000 (21:30 -0800)]
Git 1.7.6.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jk/maint-fetch-status-table' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:21:30 +0000 (21:21 -0800)]
Merge branch 'jk/maint-fetch-status-table' into maint-1.7.6

* jk/maint-fetch-status-table:
  fetch: create status table using strbuf

12 years agoMerge branch 'jc/maint-name-rev-all' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:12:34 +0000 (21:12 -0800)]
Merge branch 'jc/maint-name-rev-all' into maint-1.7.6

* jc/maint-name-rev-all:
  name-rev --all: do not even attempt to describe non-commit object

12 years agoMerge branch 'ml/mailmap' into maint-1.7.6
Junio C Hamano [Wed, 14 Dec 2011 05:12:14 +0000 (21:12 -0800)]
Merge branch 'ml/mailmap' into maint-1.7.6

* ml/mailmap:
  mailmap: xcalloc mailmap_info

Conflicts:
mailmap.c

12 years agoblame: don't overflow time buffer
Jeff King [Thu, 8 Dec 2011 10:25:54 +0000 (05:25 -0500)]
blame: don't overflow time buffer

When showing the raw timestamp, we format the numeric
seconds-since-epoch into a buffer, followed by the timezone
string. This string has come straight from the commit
object. A well-formed object should have a timezone string
of only a few bytes, but we could be operating on data
pushed by a malicious user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'master' of git://repo.or.cz/git-gui
Junio C Hamano [Wed, 14 Dec 2011 00:48:24 +0000 (16:48 -0800)]
Merge branch 'master' of git://repo.or.cz/git-gui

* 'master' of git://repo.or.cz/git-gui: (28 commits)
  git-gui 0.16
  git-gui: handle shell script text filters when loading for blame.
  git-gui: Set both 16x16 and 32x32 icons on X to pacify Xming.
  git-gui: added config gui.gcwarning to disable the gc hint message
  git-gui: set whitespace warnings appropriate to this project
  git-gui: don't warn for detached head when rebasing
  git-gui: make config gui.warndetachedcommit a boolean
  git-gui: add config value gui.diffopts for passing additional diff options
  git-gui: sort the numeric ansi codes
  git-gui: support underline style when parsing diff output
  git-gui: fix spelling error in sshkey.tcl
  git-gui: include the file path in guitools confirmation dialog
  git-gui: span widgets over the full file output area in the blame view
  git-gui: use a tristate to control the case mode in the searchbar
  git-gui: set suitable extended window manager hints.
  git-gui: fix display of path in browser title
  git-gui: enable the smart case sensitive search only if gui.search.smartcase is true
  git-gui: catch invalid or complete regular expressions and treat as no match.
  git-gui: theme the search and line-number entry fields on blame screen
  git-gui: include the number of untracked files to stage when asking the user
  ...

12 years agohttp-push: enable "proactive auth"
Jeff King [Wed, 14 Dec 2011 00:11:56 +0000 (19:11 -0500)]
http-push: enable "proactive auth"

Before commit 986bbc08, git was proactive about asking for
http passwords. It assumed that if you had a username in
your URL, you would also want a password, and asked for it
before making any http requests.

However, this could interfere with the use of .netrc (see
986bbc08 for details). And it was also unnecessary, since
the http fetching code had learned to recognize an HTTP 401
and prompt the user then. Furthermore, the proactive prompt
could interfere with the usage of .netrc (see 986bbc08 for
details).

Unfortunately, the http push-over-DAV code never learned to
recognize HTTP 401, and so was broken by this change. This
patch does a quick fix of re-enabling the "proactive auth"
strategy only for http-push, leaving the dumb http fetch and
smart-http as-is.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-gui 0.16 gitgui-0.16.0
Pat Thoyts [Tue, 13 Dec 2011 23:44:30 +0000 (23:44 +0000)]
git-gui 0.16

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
12 years agot5540: test DAV push with authentication
Jeff King [Tue, 13 Dec 2011 20:17:04 +0000 (15:17 -0500)]
t5540: test DAV push with authentication

We don't currently test this case at all, and instead just
test the DAV mechanism over an unauthenticated push. That
isn't very realistic, as most people will want to
authenticate pushes.

Two of the tests expect_failure as they reveal bugs:

  1. Pushing without a username in the URL fails to ask for
     credentials when we get an HTTP 401. This has always
     been the case, but it would be nice if it worked like
     smart-http.

  2. Pushing with a username fails to ask for the password
     since 986bbc0 (http: don't always prompt for password,
     2011-11-04). This is a severe regression in v1.7.8, as
     authenticated push-over-DAV is now totally unusable
     unless you have credentials in your .netrc.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoconnect.c: drop path_match function
Jeff King [Tue, 13 Dec 2011 00:49:59 +0000 (19:49 -0500)]
connect.c: drop path_match function

This function was used for comparing local and remote ref
names during fetch (which makes it a candidate for "most
confusingly named function of the year").

It no longer has any callers, so let's get rid of it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofetch-pack: match refs exactly
Jeff King [Tue, 13 Dec 2011 00:48:08 +0000 (19:48 -0500)]
fetch-pack: match refs exactly

When we are determining the list of refs to fetch via
fetch-pack, we have two sets of refs to compare: those on
the remote side, and a "match" list of things we want to
fetch. We iterate through the remote refs alphabetically,
seeing if each one is wanted by the "match" list.

Since def88e9 (Commit first cut at "git-fetch-pack",
2005-07-04), we have used the "path_match" function to do a
suffix match, where a remote ref is considered wanted if
any of the "match" elements is a suffix of the remote
refname.

This enables callers of fetch-pack to specify unqualified
refs and have them matched up with remote refs (e.g., ask
for "A" and get remote's "refs/heads/A"). However, if you
provide a fully qualified ref, then there are corner cases
where we provide the wrong answer. For example, given a
remote with two refs:

   refs/foo/refs/heads/master
   refs/heads/master

asking for "refs/heads/master" will first match
"refs/foo/refs/heads/master" by the suffix rule, and we will
erroneously fetch it instead of refs/heads/master.

As it turns out, all callers of fetch_pack do provide
fully-qualified refs for the match list. There are two ways
fetch_pack can get match lists:

  1. Through the transport code (i.e., via git-fetch)

  2. On the command-line of git-fetch-pack

In the first case, we will always be providing the names of
fully-qualified refs from "struct ref" objects. We will have
pre-matched those ref objects already (since we have to
handle more advanced matching, like wildcard refspecs), and
are just providing a list of the refs whose objects we need.

In the second case, users could in theory be providing
non-qualified refs on the command-line. However, the
fetch-pack documentation claims that refs should be fully
qualified (and has always done so since it was written in
2005).

Let's change this path_match call to simply check for string
equality, matching what the callers of fetch_pack are
expecting.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot5500: give fully-qualified refs to fetch-pack
Jeff King [Tue, 13 Dec 2011 00:44:40 +0000 (19:44 -0500)]
t5500: give fully-qualified refs to fetch-pack

The fetch-pack documentation is very clear that refs given
on the command line are to be full refs:

  <refs>...::
          The remote heads to update from. This is relative to
          $GIT_DIR (e.g. "HEAD", "refs/heads/master").  When
          unspecified, update from all heads the remote side has.

and this has been the case since fetch-pack was originally documented in
8b3d9dc ([PATCH] Documentation: clone/fetch/upload., 2005-07-14).

Let's follow our own documentation to set a good example,
and to avoid breaking when this restriction is enforced in
the next patch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodrop "match" parameter from get_remote_heads
Jeff King [Tue, 13 Dec 2011 00:41:37 +0000 (19:41 -0500)]
drop "match" parameter from get_remote_heads

The get_remote_heads function reads the list of remote refs
during git protocol session. It dates all the way back to
def88e9 (Commit first cut at "git-fetch-pack", 2005-07-04).
At that time, the idea was to come up with a list of refs we
were interested in, and then filter the list as we got it
from the remote side.

Later, 1baaae5 (Make maximal use of the remote refs,
2005-10-28) stopped filtering at the get_remote_heads layer,
letting us use the non-matching refs to find common history.

As a result, all callers now simply pass an empty match
list (and any future callers will want to do the same). So
let's drop these now-useless parameters.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoRename resolve_ref() to resolve_ref_unsafe()
Nguyễn Thái Ngọc Duy [Mon, 12 Dec 2011 11:20:32 +0000 (18:20 +0700)]
Rename resolve_ref() to resolve_ref_unsafe()

resolve_ref() may return a pointer to a shared buffer and can be
overwritten by the next resolve_ref() calls. Callers need to
pay attention, not to keep the pointer when the next call happens.

Rename with "_unsafe" suffix to warn developers (or reviewers) before
introducing new call sites.

This patch is generated using the following command

git grep -l 'resolve_ref(' -- '*.[ch]'|xargs sed -i 's/resolve_ref(/resolve_ref_unsafe(/g'

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoConvert resolve_ref+xstrdup to new resolve_refdup function
Nguyễn Thái Ngọc Duy [Tue, 13 Dec 2011 14:17:48 +0000 (21:17 +0700)]
Convert resolve_ref+xstrdup to new resolve_refdup function

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoUpdate documentation for stripspace
Conrad Irwin [Mon, 12 Dec 2011 23:52:51 +0000 (15:52 -0800)]
Update documentation for stripspace

Tell the user what this command is intended for, and expand the
description of what it does.

Signed-off-by: Conrad Irwin <conrad.irwin@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot: add test harness for external credential helpers
Jeff King [Sat, 10 Dec 2011 10:35:55 +0000 (05:35 -0500)]
t: add test harness for external credential helpers

We already have tests for the internal helpers, but it's
nice to give authors of external tools an easy way to
sanity-check their helpers.

If you have written the "git-credential-foo" helper, you can
do so with:

  GIT_TEST_CREDENTIAL_HELPER=foo \
  make t0303-credential-external.sh

This assumes that your helper is capable of both storing and
retrieving credentials (some helpers may be read-only, and
they will fail these tests).

If your helper supports time-based expiration with a
configurable timeout, you can test that feature like this:

  GIT_TEST_CREDENTIAL_HELPER_TIMEOUT="foo --timeout=1" \
  make t0303-credential-external.sh

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocredentials: add "store" helper
Jeff King [Sat, 10 Dec 2011 10:34:44 +0000 (05:34 -0500)]
credentials: add "store" helper

This is like "cache", except that we actually put the
credentials on disk. This can be terribly insecure, of
course, but we do what we can to protect them by filesystem
permissions, and we warn the user in the documentation.

This is not unlike using .netrc to store entries, but it's a
little more user-friendly. Instead of putting credentials in
place ahead of time, we transparently store them after
prompting the user for them once.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agostrbuf: add strbuf_add*_urlencode
Jeff King [Sat, 10 Dec 2011 10:34:20 +0000 (05:34 -0500)]
strbuf: add strbuf_add*_urlencode

This just follows the rfc3986 rules for percent-encoding
url data into a strbuf.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMakefile: unix sockets may not available on some platforms
Johannes Sixt [Mon, 12 Dec 2011 21:12:56 +0000 (22:12 +0100)]
Makefile: unix sockets may not available on some platforms

Introduce a configuration option NO_UNIX_SOCKETS to exclude code that
depends on Unix sockets and use it in MSVC and MinGW builds.

Notice that unix-socket.h was missing from LIB_H before; fix that, too.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: be quiet about overwriting
Jeff King [Mon, 12 Dec 2011 21:54:42 +0000 (16:54 -0500)]
mv: be quiet about overwriting

When a user asks us to force a mv and overwrite the
destination, we print a warning. However, since a typical
use would be:

  $ git mv one two
  fatal: destination exists, source=one, destination=two
  $ git mv -f one two
  warning: overwriting 'two'

this warning is just noise. We already know we're
overwriting; that's why we gave -f!

This patch silences the warning unless "--verbose" is given.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: improve overwrite warning
Jeff King [Mon, 12 Dec 2011 21:54:17 +0000 (16:54 -0500)]
mv: improve overwrite warning

When we try to "git mv" over an existing file, the error
message is fairly informative:

  $ git mv one two
  fatal: destination exists, source=one, destination=two

When the user forces the overwrite, we give a warning:

  $ git mv -f one two
  warning: destination exists; will overwrite!

This is less informative, but still sufficient in the simple
rename case, as there is only one rename happening.

But when moving files from one directory to another, it
becomes useless:

  $ mkdir three
  $ touch one two three/one
  $ git add .
  $ git mv one two three
  fatal: destination exists, source=one, destination=three/one
  $ git mv -f one two three
  warning: destination exists; will overwrite!

The first message is helpful, but the second one gives us no
clue about what was overwritten. Let's mention the name of
the destination file:

  $ git mv -f one two three
  warning: overwriting 'three/one'

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: stop creating and removing sequencer-old directory
Jonathan Nieder [Sat, 10 Dec 2011 13:06:12 +0000 (07:06 -0600)]
revert: stop creating and removing sequencer-old directory

Now that "git reset" no longer implicitly removes .git/sequencer that
the operator may or may not have wanted to keep, the logic to write a
backup copy of .git/sequencer and remove it when stale is not needed
any more.  Simplify the sequencer API and repository layout by
dropping it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoRevert "reset: Make reset remove the sequencer state"
Jonathan Nieder [Sat, 10 Dec 2011 13:03:48 +0000 (07:03 -0600)]
Revert "reset: Make reset remove the sequencer state"

This reverts commit 95eb88d8ee588d89b4f06d2753ed4d16ab13b39f, which
was a UI experiment that did not reflect how "git reset" actually gets
used.  The reversion also fixes a test, indicated in the patch.

Encouraged-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: do not remove state until sequence is finished
Jonathan Nieder [Sat, 10 Dec 2011 13:02:12 +0000 (07:02 -0600)]
revert: do not remove state until sequence is finished

As v1.7.8-rc0~141^2~4 (2011-08-04) explains, git cherry-pick removes
the sequencer state just before applying the final patch.  In the
single-pick case, that was a good thing, since --abort and --continue
work fine without access to such state and removing it provides a
signal that git should not complain about the need to clobber it ("a
cherry-pick or revert is already in progress") in sequences like the
following:

git cherry-pick foo
git read-tree -m -u HEAD; # forget that; let's try a different one
git cherry-pick bar

After the recent patch "allow single-pick in the middle of cherry-pick
sequence" we don't need that hack any more.  In the new regime, a
traditional "git cherry-pick <commit>" command never looks at
.git/sequencer, so we do not need to cripple "git cherry-pick
<commit>..<commit>" for it any more.

So now you can run "git cherry-pick --abort" near the end of a
multi-pick sequence and it will abort the entire sequence, instead of
misbehaving and aborting just the final commit.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: allow single-pick in the middle of cherry-pick sequence
Jonathan Nieder [Sat, 10 Dec 2011 12:59:48 +0000 (06:59 -0600)]
revert: allow single-pick in the middle of cherry-pick sequence

After messing up a difficult conflict resolution in the middle of a
cherry-pick sequence, it can be useful to be able to

git checkout HEAD . && git cherry-pick that-one-commit

to restart the conflict resolution. The current code however errors out
saying that another cherry-pick is already in progress.

Suggested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: pass around rev-list args in already-parsed form
Jonathan Nieder [Sat, 13 Aug 2011 17:06:23 +0000 (12:06 -0500)]
revert: pass around rev-list args in already-parsed form

Since 7e2bfd3f (revert: allow cherry-picking more than one commit,
2010-07-02), the pick/revert machinery has kept track of the set of
commits to be cherry-picked or reverted using commit_argc and
commit_argv variables, storing the corresponding command-line
parameters.

Future callers as other commands are built in (am, rebase, sequencer)
may find it easier to pass rev-list options to this machinery in
already-parsed form.  Teach cmd_cherry_pick and cmd_revert to parse
the rev-list arguments in advance and pass the commit set to
pick_revisions() as a rev_info structure.

Original patch by Jonathan, tweaks and test from Ram.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: allow cherry-pick --continue to commit before resuming
Jonathan Nieder [Sat, 10 Dec 2011 12:49:25 +0000 (06:49 -0600)]
revert: allow cherry-pick --continue to commit before resuming

When "git cherry-pick ..bar" encounters conflicts, permit the operator
to use cherry-pick --continue after resolving them as a shortcut for
"git commit && git cherry-pick --continue" to record the resolution
and carry on with the rest of the sequence.

This improves the analogy with "git rebase" (in olden days --continue
was the way to preserve authorship when a rebase encountered
conflicts) and fits well with a general UI goal of making "git cmd
--continue" save humans the trouble of deciding what to do next.

Example: after encountering a conflict from running "git cherry-pick
foo bar baz":

CONFLICT (content): Merge conflict in main.c
error: could not apply f78a8d98c... bar!
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

We edit main.c to resolve the conflict, mark it acceptable with "git
add main.c", and can run "cherry-pick --continue" to resume the
sequence.

$ git cherry-pick --continue
[editor opens to confirm commit message]
[master 78c8a8c98] bar!
 1 files changed, 1 insertions(+), 1 deletions(-)
[master 87ca8798c] baz!
 1 files changed, 1 insertions(+), 1 deletions(-)

This is done for both codepaths to pick multiple commits and a single
commit.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: give --continue handling its own function
Jonathan Nieder [Sat, 10 Dec 2011 12:47:36 +0000 (06:47 -0600)]
revert: give --continue handling its own function

This makes pick_revisions() a little shorter and easier to read
straight through.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: make non-directory destination error more clear
Jeff King [Mon, 12 Dec 2011 07:51:36 +0000 (02:51 -0500)]
mv: make non-directory destination error more clear

If you try to "git mv" multiple files onto another
non-directory file, you confusingly get the "usage" message:

  $ touch one two three
  $ git add .
  $ git mv one two three
  usage: git mv [options] <source>... <destination>
  [...]

From the user's perspective, that makes no sense. They just
gave parameters that exactly match that usage!

This behavior dates back to the original C version of "git
mv", which had a usage message like:

  usage: git mv (<source> <destination> | <source>...  <destination>)

This was slightly less confusing, because it at least
mentions that there are two ways to invoke (but it still
isn't clear why what the user provided doesn't work).

Instead, let's show an error message like:

  $ git mv one two three
  fatal: destination 'three' is not a directory

We could leave the usage message in place, too, but it
doesn't actually help here. It contains no hints that there
are two forms, nor that multi-file form requires that the
endpoint be a directory. So it just becomes useless noise
that distracts from the real error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomv: honor --verbose flag
Jeff King [Mon, 12 Dec 2011 07:51:24 +0000 (02:51 -0500)]
mv: honor --verbose flag

The code for a verbose flag has been here since "git mv" was
converted to C many years ago, but actually getting the "-v"
flag from the command line was accidentally lost in the
transition.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocs: mention "-k" for both forms of "git mv"
Jeff King [Mon, 12 Dec 2011 07:50:31 +0000 (02:50 -0500)]
docs: mention "-k" for both forms of "git mv"

The "git mv" synopsis shows two forms: renaming a file, and
moving files into a directory. They can both make use of the
"-k" flag to ignore errors, so mention it in both places.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevert: convert resolve_ref() to read_ref_full()
Nguyễn Thái Ngọc Duy [Mon, 12 Dec 2011 11:20:29 +0000 (18:20 +0700)]
revert: convert resolve_ref() to read_ref_full()

This is the follow up of c689332 (Convert many resolve_ref() calls to
read_ref*() and ref_exists() - 2011-11-13). See the said commit for
rationale.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocompat/snprintf: don't look at va_list twice
Jeff King [Mon, 12 Dec 2011 14:25:51 +0000 (09:25 -0500)]
compat/snprintf: don't look at va_list twice

If you define SNPRINTF_RETURNS_BOGUS, we use a special
git_vsnprintf wrapper assumes that vsnprintf returns "-1"
instead of the number of characters that you would need to
store the result.

To do this, it invokes vsnprintf multiple times, growing a
heap buffer until we have enough space to hold the result.
However, this means we evaluate the va_list parameter
multiple times, which is generally a bad thing (it may be
modified by calls to vsnprintf, yielding undefined
behavior).

Instead, we must va_copy it and hand the copy to vsnprintf,
so we always have a pristine va_list.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoadd_ref(): take a (struct ref_entry *) parameter
Michael Haggerty [Mon, 12 Dec 2011 05:38:23 +0000 (06:38 +0100)]
add_ref(): take a (struct ref_entry *) parameter

Take a pointer to the ref_entry to add to the array, rather than
creating the ref_entry within the function.  This opens the way to
having multiple kinds of ref_entries.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocreate_ref_entry(): extract function from add_ref()
Michael Haggerty [Mon, 12 Dec 2011 05:38:22 +0000 (06:38 +0100)]
create_ref_entry(): extract function from add_ref()

Separate the creation of the ref_entry from its addition to a ref_array.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorepack_without_ref(): remove temporary
Michael Haggerty [Mon, 12 Dec 2011 05:38:21 +0000 (06:38 +0100)]
repack_without_ref(): remove temporary

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoresolve_gitlink_ref_recursive(): change to work with struct ref_cache
Michael Haggerty [Mon, 12 Dec 2011 05:38:20 +0000 (06:38 +0100)]
resolve_gitlink_ref_recursive(): change to work with struct ref_cache

resolve_gitlink_ref() and resolve_gitlink_ref_recursive(), together,
basically duplicated the code in git_path_submodule().  So use that
function instead.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoPass a (ref_cache *) to the resolve_gitlink_*() helper functions
Michael Haggerty [Mon, 12 Dec 2011 05:38:19 +0000 (06:38 +0100)]
Pass a (ref_cache *) to the resolve_gitlink_*() helper functions

And remove some redundant arguments from resolve_gitlink_packed_ref().

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoresolve_gitlink_ref(): improve docstring
Michael Haggerty [Mon, 12 Dec 2011 05:38:18 +0000 (06:38 +0100)]
resolve_gitlink_ref(): improve docstring

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoget_ref_dir(): change signature
Michael Haggerty [Mon, 12 Dec 2011 05:38:17 +0000 (06:38 +0100)]
get_ref_dir(): change signature

Change get_ref_dir() to take a (struct ref_cache *) in place of the
submodule name.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorefs: change signatures of get_packed_refs() and get_loose_refs()
Michael Haggerty [Mon, 12 Dec 2011 05:38:16 +0000 (06:38 +0100)]
refs: change signatures of get_packed_refs() and get_loose_refs()

Change get_packed_refs() and get_loose_refs() to take a (struct
ref_cache *) instead of the name of the submodule.

Change get_ref_dir() to take a submodule name (i.e., "" for the main
module) rather than a submodule pointer (i.e., NULL for the main
module) so that refs->name can be used as its argument.  (In a moment
this function will also be changed to take a (struct ref_cache *),
too.)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agois_dup_ref(): extract function from sort_ref_array()
Michael Haggerty [Mon, 12 Dec 2011 05:38:15 +0000 (06:38 +0100)]
is_dup_ref(): extract function from sort_ref_array()

Giving the function a name makes the code easier to understand.

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