]> Pileus Git - ~andy/git/log
~andy/git
10 years agoMerge branch 'fc/styles'
Junio C Hamano [Wed, 30 Oct 2013 19:10:06 +0000 (12:10 -0700)]
Merge branch 'fc/styles'

C coding style fixes.

* fc/styles:
  block-sha1/sha1.c: have SP around arithmetic operators
  base85.c: have SP around arithmetic operators
  archive.c: have SP around arithmetic operators
  alloc.c: have SP around arithmetic operators
  abspath.c: have SP around arithmetic operators
  alias: have SP around arithmetic operators
  C: have space around && and || operators

10 years agoMerge branch 'jc/upload-pack-send-symref'
Junio C Hamano [Wed, 30 Oct 2013 19:10:00 +0000 (12:10 -0700)]
Merge branch 'jc/upload-pack-send-symref'

One long-standing flaw in the pack transfer protocol used by "git
clone" was that there was no way to tell the other end which branch
"HEAD" points at, and the receiving end needed to guess.  A new
capability has been defined in the pack protocol to convey this
information so that cloning from a repository with more than one
branches pointing at the same commit where the HEAD is at now
reliably sets the initial branch in the resulting repository.

* jc/upload-pack-send-symref:
  t5570: Update for clone-progress-to-stderr branch
  t5570: Update for symref capability
  clone: test the new HEAD detection logic
  connect: annotate refs with their symref information in get_remote_head()
  connect.c: make parse_feature_value() static
  upload-pack: send non-HEAD symbolic refs
  upload-pack: send symbolic ref information as capability
  upload-pack.c: do not pass confusing cb_data to mark_our_ref()
  t5505: fix "set-head --auto with ambiguous HEAD" test

10 years agoMerge branch 'jk/http-auth-redirects'
Junio C Hamano [Wed, 30 Oct 2013 19:09:53 +0000 (12:09 -0700)]
Merge branch 'jk/http-auth-redirects'

Handle the case where http transport gets redirected during the
authorization request better.

* jk/http-auth-redirects:
  http.c: Spell the null pointer as NULL
  remote-curl: rewrite base url from info/refs redirects
  remote-curl: store url as a strbuf
  remote-curl: make refs_url a strbuf
  http: update base URLs when we see redirects
  http: provide effective url to callers
  http: hoist credential request out of handle_curl_result
  http: refactor options to http_get_*
  http_request: factor out curlinfo_strbuf
  http_get_file: style fixes

10 years agoAlmost -rc0 for 1.8.5
Junio C Hamano [Mon, 28 Oct 2013 17:52:07 +0000 (10:52 -0700)]
Almost -rc0 for 1.8.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with v1.8.4.2
Junio C Hamano [Mon, 28 Oct 2013 17:51:53 +0000 (10:51 -0700)]
Sync with v1.8.4.2

10 years agoMerge branch 'sb/repack-in-c'
Junio C Hamano [Mon, 28 Oct 2013 17:43:41 +0000 (10:43 -0700)]
Merge branch 'sb/repack-in-c'

Finishing touches to update documentation.

* sb/repack-in-c:
  Reword repack documentation to no longer state it's a script

10 years agoMerge branch 'sg/prompt-svn-remote-fix'
Junio C Hamano [Mon, 28 Oct 2013 17:43:38 +0000 (10:43 -0700)]
Merge branch 'sg/prompt-svn-remote-fix'

Bash portability fix.

* sg/prompt-svn-remote-fix:
  bash prompt: don't use '+=' operator in show upstream code path

10 years agoMerge branch 'jk/split-broken-ident'
Junio C Hamano [Mon, 28 Oct 2013 17:43:32 +0000 (10:43 -0700)]
Merge branch 'jk/split-broken-ident'

Make the fall-back parsing of commit objects with broken author or
committer lines more robust to pick up the timestamps.

* jk/split-broken-ident:
  split_ident: parse timestamp from end of line

10 years agoMerge branch 'jk/remote-literal-string-leakfix'
Junio C Hamano [Mon, 28 Oct 2013 17:43:28 +0000 (10:43 -0700)]
Merge branch 'jk/remote-literal-string-leakfix'

* jk/remote-literal-string-leakfix:
  remote: do not copy "origin" string literal

10 years agoMerge branch 'ew/keepalive'
Junio C Hamano [Mon, 28 Oct 2013 17:43:24 +0000 (10:43 -0700)]
Merge branch 'ew/keepalive'

* ew/keepalive:
  http: use curl's tcp keepalive if available
  http: enable keepalive on TCP sockets

10 years agoMerge branch 'jc/revision-range-unpeel'
Junio C Hamano [Mon, 28 Oct 2013 17:43:16 +0000 (10:43 -0700)]
Merge branch 'jc/revision-range-unpeel'

"git rev-list --objects ^v1.0^ v1.0" gave v1.0 tag itself in the
output, but "git rev-list --objects v1.0^..v1.0" did not.

* jc/revision-range-unpeel:
  revision: do not peel tags used in range notation

10 years agoMerge branch 'jx/relative-path-regression-fix'
Junio C Hamano [Mon, 28 Oct 2013 17:42:29 +0000 (10:42 -0700)]
Merge branch 'jx/relative-path-regression-fix'

* jx/relative-path-regression-fix:
  Use simpler relative_path when set_git_dir
  relative_path should honor dos-drive-prefix
  test: use unambigous leading path (/foo) for MSYS

10 years agoGit 1.8.4.2
Junio C Hamano [Mon, 28 Oct 2013 17:21:29 +0000 (10:21 -0700)]
Git 1.8.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jk/clone-progress-to-stderr' into maint
Junio C Hamano [Mon, 28 Oct 2013 17:19:24 +0000 (10:19 -0700)]
Merge branch 'jk/clone-progress-to-stderr' into maint

"git clone" gave some progress messages to the standard output, not to
the standard error, and did not allow suppressing them with the
"--no-progress" option.

* jk/clone-progress-to-stderr:
  clone: always set transport options
  clone: treat "checking connectivity" like other progress
  clone: send diagnostic messages to stderr

10 years agoMerge branch 'jk/format-patch-from' into maint
Junio C Hamano [Mon, 28 Oct 2013 17:18:43 +0000 (10:18 -0700)]
Merge branch 'jk/format-patch-from' into maint

"format-patch --from=<whom>" forgot to omit unnecessary in-body from
line, i.e. when <whom> is the same as the real author.

* jk/format-patch-from:
  format-patch: print in-body "From" only when needed

10 years agoMerge branch 'jk/shortlog-tolerate-broken-commit' into maint
Junio C Hamano [Mon, 28 Oct 2013 17:17:31 +0000 (10:17 -0700)]
Merge branch 'jk/shortlog-tolerate-broken-commit' into maint

"git shortlog" used to choke and die when there is a malformed commit
(e.g. missing authors); it now simply ignore such a commit and keeps
going.

* jk/shortlog-tolerate-broken-commit:
  shortlog: ignore commits with missing authors

10 years agoMerge branch 'jk/diff-algo' into maint
Junio C Hamano [Mon, 28 Oct 2013 17:16:11 +0000 (10:16 -0700)]
Merge branch 'jk/diff-algo' into maint

"git merge-recursive" did not parse its "--diff-algorithm=" command
line option correctly.

* jk/diff-algo:
  merge-recursive: fix parsing of "diff-algorithm" option

10 years agotest-lib: fix typo in comment
Torstein Hegge [Sun, 27 Oct 2013 09:56:33 +0000 (10:56 +0100)]
test-lib: fix typo in comment

Point test writers to the test_expect_* functions properly.

Signed-off-by: Torstein Hegge <hegge@resisty.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosha1_file: move comment about return value where it belongs
Christian Couder [Sat, 26 Oct 2013 22:34:30 +0000 (00:34 +0200)]
sha1_file: move comment about return value where it belongs

Commit 5b0864070 (sha1_object_info_extended: make type calculation
optional, Jul 12 2013) changed the return value of the
sha1_object_info_extended function to 0/-1 for success/error.

Previously this function returned the object type for success or
-1 for error. But unfortunately the above commit forgot to change
or move the comment above this function that says "returns enum
object_type or negative".

To fix this inconsistency, let's move the comment above the
sha1_object_info function where it is still true.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohttp.c: Spell the null pointer as NULL
Ramsay Jones [Thu, 24 Oct 2013 20:17:19 +0000 (21:17 +0100)]
http.c: Spell the null pointer as NULL

Commit 1bbcc224 ("http: refactor options to http_get_*", 28-09-2013)
changed the type of final 'options' argument of the http_get_file()
function from an int to an 'struct http_get_options' pointer.
However, it neglected to update the (single) call site. Since this
call was passing '0' to that argument, it was (correctly) being
interpreted as a null pointer. Change to argument to NULL.

Noticed by sparse. ("Using plain integer as NULL pointer")

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Acked-by: Jeff King <peff@peff.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoUpdate draft release notes to 1.8.5
Junio C Hamano [Wed, 23 Oct 2013 20:37:27 +0000 (13:37 -0700)]
Update draft release notes to 1.8.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with 'maint'
Junio C Hamano [Wed, 23 Oct 2013 20:36:57 +0000 (13:36 -0700)]
Sync with 'maint'

10 years agoAlmost 1.8.4.2 ;-)
Junio C Hamano [Wed, 23 Oct 2013 20:34:39 +0000 (13:34 -0700)]
Almost 1.8.4.2 ;-)

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/ls-files-killed-optim' into maint
Junio C Hamano [Wed, 23 Oct 2013 20:33:08 +0000 (13:33 -0700)]
Merge branch 'jc/ls-files-killed-optim' into maint

"git ls-files -k" needs to crawl only the part of the working tree
that may overlap the paths in the index to find killed files, but
shared code with the logic to find all the untracked files, which
made it unnecessarily inefficient.

* jc/ls-files-killed-optim:
  dir.c::test_one_path(): work around directory_exists_in_index_icase() breakage
  t3010: update to demonstrate "ls-files -k" optimization pitfalls
  ls-files -k: a directory only can be killed if the index has a non-directory
  dir.c: use the cache_* macro to access the current index

10 years agoMerge branch 'jh/checkout-auto-tracking' into maint
Junio C Hamano [Wed, 23 Oct 2013 20:32:50 +0000 (13:32 -0700)]
Merge branch 'jh/checkout-auto-tracking' into maint

"git branch --track" had a minor regression in v1.8.3.2 and later
that made it impossible to base your local work on anything but a
local branch of the upstream repository you are tracking from.

* jh/checkout-auto-tracking:
  t3200: fix failure on case-insensitive filesystems
  branch.c: Relax unnecessary requirement on upstream's remote ref name
  t3200: Add test demonstrating minor regression in 41c21f2
  Refer to branch.<name>.remote/merge when documenting --track
  t3200: Minor fix when preparing for tracking failure
  t2024: Fix &&-chaining and a couple of typos

10 years agoMerge branch 'nd/fetch-into-shallow' into maint
Junio C Hamano [Wed, 23 Oct 2013 20:32:17 +0000 (13:32 -0700)]
Merge branch 'nd/fetch-into-shallow' into maint

When there is no sufficient overlap between old and new history
during a "git fetch" into a shallow repository, objects that the
sending side knows the receiving end has were unnecessarily sent.

* nd/fetch-into-shallow:
  Add testcase for needless objects during a shallow fetch
  list-objects: mark more commits as edges in mark_edges_uninteresting
  list-objects: reduce one argument in mark_edges_uninteresting
  upload-pack: delegate rev walking in shallow fetch to pack-objects
  shallow: add setup_temporary_shallow()
  shallow: only add shallow graft points to new shallow file
  move setup_alternate_shallow and write_shallow_commits to shallow.c

10 years agoMerge branch 'bc/gnome-keyring'
Junio C Hamano [Wed, 23 Oct 2013 20:21:50 +0000 (13:21 -0700)]
Merge branch 'bc/gnome-keyring'

Cleanups and tweaks for credential handling to work with ancient versions
of the gnome-keyring library that are still in use.

* bc/gnome-keyring:
  contrib/git-credential-gnome-keyring.c: support really ancient gnome-keyring
  contrib/git-credential-gnome-keyring.c: support ancient gnome-keyring
  contrib/git-credential-gnome-keyring.c: report failure to store password
  contrib/git-credential-gnome-keyring.c: use glib messaging functions
  contrib/git-credential-gnome-keyring.c: use glib memory allocation functions
  contrib/git-credential-gnome-keyring.c: use secure memory for reading passwords
  contrib/git-credential-gnome-keyring.c: use secure memory functions for passwds
  contrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object()
  contrib/git-credential-gnome-keyring.c: set Gnome application name
  contrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing
  contrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t
  contrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly
  contrib/git-credential-gnome-keyring.c: add static where applicable
  contrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc.
  contrib/git-credential-gnome-keyring.c: remove unused die() function
  contrib/git-credential-gnome-keyring.c: remove unnecessary pre-declarations

10 years agoMerge branch 'po/dot-url'
Junio C Hamano [Wed, 23 Oct 2013 20:21:48 +0000 (13:21 -0700)]
Merge branch 'po/dot-url'

Explain how '.' can be used to refer to the "current repository"
in the documentation.

* po/dot-url:
  doc/cli: make "dot repository" an independent bullet point
  config doc: update dot-repository notes
  doc: command line interface (cli) dot-repository dwimmery

10 years agoMerge branch 'jc/prompt-upstream'
Junio C Hamano [Wed, 23 Oct 2013 20:21:45 +0000 (13:21 -0700)]
Merge branch 'jc/prompt-upstream'

An enhancement to the GIT_PS1_SHOWUPSTREAM facility.

* jc/prompt-upstream:
  git-prompt.sh: optionally show upstream branch name

10 years agoMerge branch 'hu/cherry-pick-previous-branch'
Junio C Hamano [Wed, 23 Oct 2013 20:21:35 +0000 (13:21 -0700)]
Merge branch 'hu/cherry-pick-previous-branch'

"git cherry-pick" without further options would segfault.

Could use a follow-up to handle '-' after argv[1] better.

* hu/cherry-pick-previous-branch:
  cherry-pick: handle "-" after parsing options

10 years agoMerge branch 'mg/more-textconv'
Junio C Hamano [Wed, 23 Oct 2013 20:21:30 +0000 (13:21 -0700)]
Merge branch 'mg/more-textconv'

Make "git grep" and "git show" pay attention to --textconv when
dealing with blob objects.

* mg/more-textconv:
  grep: honor --textconv for the case rev:path
  grep: allow to use textconv filters
  t7008: demonstrate behavior of grep with textconv
  cat-file: do not die on --textconv without textconv filters
  show: honor --textconv for blobs
  diff_opt: track whether flags have been set explicitly
  t4030: demonstrate behavior of show with textconv

10 years agoMerge branch 'jc/pack-objects'
Junio C Hamano [Wed, 23 Oct 2013 20:21:26 +0000 (13:21 -0700)]
Merge branch 'jc/pack-objects'

* jc/pack-objects:
  pack-objects: shrink struct object_entry

10 years agot5570: Update for clone-progress-to-stderr branch
Brian Gernhardt [Mon, 21 Oct 2013 17:54:12 +0000 (13:54 -0400)]
t5570: Update for clone-progress-to-stderr branch

git clone now reports its progress to standard error, which throws off
t5570.  Using test_i18ngrep instead of test_cmp allows the test to be
more flexible by only looking for the expected error and ignoring any
other output from the program.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jk/clone-progress-to-stderr' into jc/upload-pack-send-symref
Junio C Hamano [Tue, 22 Oct 2013 18:38:42 +0000 (11:38 -0700)]
Merge branch 'jk/clone-progress-to-stderr' into jc/upload-pack-send-symref

* jk/clone-progress-to-stderr:
  clone: always set transport options
  clone: treat "checking connectivity" like other progress
  clone: send diagnostic messages to stderr

10 years agot5570: Update for symref capability
Brian Gernhardt [Mon, 21 Oct 2013 17:54:11 +0000 (13:54 -0400)]
t5570: Update for symref capability

git-daemon now uses the symref capability to send the correct HEAD
reference, so the test for that in t5570 now passes.

Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoReword repack documentation to no longer state it's a script
Stefan Beller [Fri, 18 Oct 2013 23:25:22 +0000 (01:25 +0200)]
Reword repack documentation to no longer state it's a script

This updates the documentation regarding the changes introduced
by a1bbc6c01 (2013-09-15, repack: rewrite the shell script in C).

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoUpdate draft release notes to 1.8.5
Junio C Hamano [Fri, 18 Oct 2013 20:53:05 +0000 (13:53 -0700)]
Update draft release notes to 1.8.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'maint'
Junio C Hamano [Fri, 18 Oct 2013 20:53:48 +0000 (13:53 -0700)]
Merge branch 'maint'

* maint:
  git-merge: document the -S option

10 years agoMerge branch 'jc/reflog-doc'
Junio C Hamano [Fri, 18 Oct 2013 20:50:12 +0000 (13:50 -0700)]
Merge branch 'jc/reflog-doc'

Document rules to use GIT_REFLOG_ACTION variable in the scripted
Porcelain.  git-rebase--interactive locally violates them, but it
is a leaf user that does not call out to or dot-source other
scripts, so it does not urgently need to be fixed.

* jc/reflog-doc:
  setup_reflog_action: document the rules for using GIT_REFLOG_ACTION

10 years agoMerge branch 'sb/repack-in-c'
Junio C Hamano [Fri, 18 Oct 2013 20:49:56 +0000 (13:49 -0700)]
Merge branch 'sb/repack-in-c'

Rewrite "git repack" in C.

* sb/repack-in-c:
  repack: improve warnings about failure of renaming and removing files
  repack: retain the return value of pack-objects
  repack: rewrite the shell script in C

10 years agoMerge branch 'jk/clone-progress-to-stderr'
Junio C Hamano [Fri, 18 Oct 2013 20:49:51 +0000 (13:49 -0700)]
Merge branch 'jk/clone-progress-to-stderr'

Some progress and diagnostic messages from "git clone" were
incorrectly sent to the standard output stream, not to the standard
error stream.

* jk/clone-progress-to-stderr:
  clone: always set transport options
  clone: treat "checking connectivity" like other progress
  clone: send diagnostic messages to stderr

10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Fri, 18 Oct 2013 20:49:00 +0000 (13:49 -0700)]
Merge git://github.com/git-l10n/git-po

* git://github.com/git-l10n/git-po:
  l10n: fr.po: 2135/2135 messages translated

10 years agogit-merge: document the -S option
Nicolas Vigier [Mon, 14 Oct 2013 23:41:05 +0000 (01:41 +0200)]
git-merge: document the -S option

The option to gpg sign a merge commit is available but was not
documented. Use wording from the git-commit(1) manpage.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: fr.po: 2135/2135 messages translated
Jean-Noel Avila [Wed, 21 Aug 2013 19:49:43 +0000 (21:49 +0200)]
l10n: fr.po: 2135/2135 messages translated

Signed-off-by: Sebastien Helleu <flashcode@flashtux.org>
Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
10 years agoUpdate draft release notes to 1.8.5
Junio C Hamano [Thu, 17 Oct 2013 22:57:12 +0000 (15:57 -0700)]
Update draft release notes to 1.8.5

10 years agoMerge branch 'jk/format-patch-from'
Junio C Hamano [Thu, 17 Oct 2013 22:55:18 +0000 (15:55 -0700)]
Merge branch 'jk/format-patch-from'

"format-patch --from=<whom>" forgot to omit unnecessary in-body
from line, i.e. when <whom> is the same as the real author.

* jk/format-patch-from:
  format-patch: print in-body "From" only when needed

10 years agoMerge branch 'es/name-hash-no-trailing-slash-in-dirs'
Junio C Hamano [Thu, 17 Oct 2013 22:55:15 +0000 (15:55 -0700)]
Merge branch 'es/name-hash-no-trailing-slash-in-dirs'

Clean up the internal of the name-hash mechanism used to work
around case insensitivity on some filesystems to cleanly fix a
long-standing API glitch where the caller of cache_name_exists()
that ask about a directory with a counted string was required to
have '/' at one location past the end of the string.

* es/name-hash-no-trailing-slash-in-dirs:
  dir: revert work-around for retired dangerous behavior
  name-hash: stop storing trailing '/' on paths in index_state.dir_hash
  employ new explicit "exists in index?" API
  name-hash: refactor polymorphic index_name_exists()

10 years agoMerge branch 'jk/trailing-slash-in-pathspec'
Junio C Hamano [Thu, 17 Oct 2013 22:55:13 +0000 (15:55 -0700)]
Merge branch 'jk/trailing-slash-in-pathspec'

Code refactoring.

* jk/trailing-slash-in-pathspec:
  reset: handle submodule with trailing slash
  rm: re-use parse_pathspec's trailing-slash removal

10 years agoMerge branch 'lc/filter-branch-too-many-refs'
Junio C Hamano [Thu, 17 Oct 2013 22:55:12 +0000 (15:55 -0700)]
Merge branch 'lc/filter-branch-too-many-refs'

"git filter-branch" in a repository with many refs blew limit of
command line length.

* lc/filter-branch-too-many-refs:
  Allow git-filter-branch to process large repositories with lots of branches.

10 years agoMerge branch 'jc/checkout-detach-doc'
Junio C Hamano [Thu, 17 Oct 2013 22:55:08 +0000 (15:55 -0700)]
Merge branch 'jc/checkout-detach-doc'

"git checkout [--detach] <commit>" was listed poorly in the
synopsis section of its documentation.

* jc/checkout-detach-doc:
  checkout: update synopsys and documentation on detaching HEAD

10 years agoSync with maint
Junio C Hamano [Thu, 17 Oct 2013 22:54:28 +0000 (15:54 -0700)]
Sync with maint

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoStart preparing for 1.8.4.2
Junio C Hamano [Thu, 17 Oct 2013 22:50:45 +0000 (15:50 -0700)]
Start preparing for 1.8.4.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jk/upload-pack-keepalive' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:46:01 +0000 (15:46 -0700)]
Merge branch 'jk/upload-pack-keepalive' into maint

* jk/upload-pack-keepalive:
  upload-pack: bump keepalive default to 5 seconds
  upload-pack: send keepalive packets during pack computation

10 years agoMerge branch 'bc/http-backend-allow-405' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:46:00 +0000 (15:46 -0700)]
Merge branch 'bc/http-backend-allow-405' into maint

* bc/http-backend-allow-405:
  http-backend: provide Allow header for 405

10 years agoMerge branch 'jc/cvsserver-perm-bit-fix' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:57 +0000 (15:45 -0700)]
Merge branch 'jc/cvsserver-perm-bit-fix' into maint

* jc/cvsserver-perm-bit-fix:
  cvsserver: pick up the right mode bits

10 years agoMerge branch 'js/add-i-mingw' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:56 +0000 (15:45 -0700)]
Merge branch 'js/add-i-mingw' into maint

* js/add-i-mingw:
  add--interactive: fix external command invocation on Windows

10 years agoMerge branch 'nd/git-dir-pointing-at-gitfile' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:55 +0000 (15:45 -0700)]
Merge branch 'nd/git-dir-pointing-at-gitfile' into maint

* nd/git-dir-pointing-at-gitfile:
  Make setup_git_env() resolve .git file when $GIT_DIR is not specified

10 years agoMerge branch 'jk/has-sha1-file-retry-packed' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:54 +0000 (15:45 -0700)]
Merge branch 'jk/has-sha1-file-retry-packed' into maint

* jk/has-sha1-file-retry-packed:
  has_sha1_file: re-check pack directory before giving up

10 years agoMerge branch 'ap/commit-author-mailmap' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:51 +0000 (15:45 -0700)]
Merge branch 'ap/commit-author-mailmap' into maint

* ap/commit-author-mailmap:
  commit: search author pattern against mailmap

10 years agoMerge branch 'es/rebase-i-no-abbrev' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:50 +0000 (15:45 -0700)]
Merge branch 'es/rebase-i-no-abbrev' into maint

* es/rebase-i-no-abbrev:
  rebase -i: fix short SHA-1 collision
  t3404: rebase -i: demonstrate short SHA-1 collision
  t3404: make tests more self-contained

Conflicts:
t/t3404-rebase-interactive.sh

10 years agoMerge branch 'rt/rebase-p-no-merge-summary' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:45 +0000 (15:45 -0700)]
Merge branch 'rt/rebase-p-no-merge-summary' into maint

* rt/rebase-p-no-merge-summary:
  rebase --preserve-merges: ignore "merge.log" config

10 years agoMerge branch 'es/rebase-i-respect-core-commentchar' into maint
Junio C Hamano [Thu, 17 Oct 2013 22:45:24 +0000 (15:45 -0700)]
Merge branch 'es/rebase-i-respect-core-commentchar' into maint

* es/rebase-i-respect-core-commentchar:
  rebase -i: fix cases ignoring core.commentchar

10 years agot4254: modernize tests
SZEDER Gábor [Wed, 16 Oct 2013 12:27:16 +0000 (14:27 +0200)]
t4254: modernize tests

- Don't start tests with 'test $? = 0' to catch preparation done
  outside the test_expect_success block.

- Move writing the bogus patch and the expected output into the
  appropriate test_expect_success blocks.

- Use the test_must_fail helper instead of manually checking for
  non-zero exit code.

- Use the debug-friendly test_path_is_file helper instead of 'test -f'.

- No space after '>'.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoUpdate draft release notes to 1.8.5
Junio C Hamano [Wed, 16 Oct 2013 19:27:45 +0000 (12:27 -0700)]
Update draft release notes to 1.8.5

List notable topics that graduated during Jonathan's interim
maintainership.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohttp: use curl's tcp keepalive if available
Jeff King [Tue, 15 Oct 2013 00:06:14 +0000 (20:06 -0400)]
http: use curl's tcp keepalive if available

Commit a15d069 taught git to use curl's SOCKOPTFUNCTION hook
to turn on TCP keepalives. However, modern versions of curl
have a TCP_KEEPALIVE option, which can do this for us. As an
added bonus, the curl code knows how to turn on keepalive
for a much wider variety of platforms. The only downside to
using this option is that not everybody has a new enough curl.
Let's split our keepalive options into three conditionals:

  1. With curl 7.25.0 and newer, we rely on curl to do it
     right.

  2. With older curl that still knows SOCKOPTFUNCTION, we
     use the code from a15d069.

  3. Otherwise, we are out of luck, and the call is a no-op.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://git.bogomips.org/git-svn
Junio C Hamano [Wed, 16 Oct 2013 17:45:58 +0000 (10:45 -0700)]
Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
  git-svn: Warn about changing default for --prefix in Git v2.0
  Documentation/git-svn: Promote the use of --prefix in docs + examples
  git-svn.txt: elaborate on rev_map files
  git-svn.txt: replace .git with $GIT_DIR
  git-svn.txt: reword description of gc command
  git-svn.txt: fix AsciiDoc formatting error
  git-svn: fix signed commit parsing

10 years agoblock-sha1/sha1.c: have SP around arithmetic operators
Junio C Hamano [Tue, 15 Oct 2013 22:27:51 +0000 (15:27 -0700)]
block-sha1/sha1.c: have SP around arithmetic operators

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agobase85.c: have SP around arithmetic operators
Junio C Hamano [Tue, 15 Oct 2013 22:27:34 +0000 (15:27 -0700)]
base85.c: have SP around arithmetic operators

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoarchive.c: have SP around arithmetic operators
Junio C Hamano [Tue, 15 Oct 2013 22:27:17 +0000 (15:27 -0700)]
archive.c: have SP around arithmetic operators

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoalloc.c: have SP around arithmetic operators
Junio C Hamano [Tue, 15 Oct 2013 22:25:53 +0000 (15:25 -0700)]
alloc.c: have SP around arithmetic operators

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoabspath.c: have SP around arithmetic operators
Junio C Hamano [Tue, 15 Oct 2013 22:25:45 +0000 (15:25 -0700)]
abspath.c: have SP around arithmetic operators

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoalias: have SP around arithmetic operators
Felipe Contreras [Sat, 21 Sep 2013 19:15:44 +0000 (14:15 -0500)]
alias: have SP around arithmetic operators

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoC: have space around && and || operators
Junio C Hamano [Wed, 16 Oct 2013 17:26:39 +0000 (10:26 -0700)]
C: have space around && and || operators

Correct all hits from

    git grep -e '\(&&\|||\)[^ ]' -e '[^  ]\(&&\|||\)' -- '*.c'

i.e. && or || operators that are followed by anything but a SP,
or that follow something other than a SP or a HT, so that these
operators have a SP around it when necessary.

We usually refrain from making this kind of a tree-wide change in
order to avoid unnecessary conflicts with other "real work" patches,
but in this case, the end result does not have a potentially
cumbersome tree-wide impact, while this is a tree-wide cleanup.

Fixes to compat/regex/regcomp.c and xdiff/xemit.c are to replace a
HT immediately after && with a SP.

This is based on Felipe's patch to bultin/symbolic-ref.c; I did all
the finding out what other files in the whole tree need to be fixed
and did the fix and also the log message while reviewing that single
liner, so any screw-ups in this version are mine.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: support really ancient gnome-keyring
Brandon Casey [Mon, 23 Sep 2013 18:49:17 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: support really ancient gnome-keyring

The gnome-keyring lib (0.4) distributed with RHEL 4.X is really ancient
and does not provide most of the synchronous functions that even ancient
releases do.  Thankfully, we're only using one function that is missing.
Let's emulate gnome_keyring_item_delete_sync() by calling the asynchronous
function and then triggering the event loop processing until our
callback is called.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: support ancient gnome-keyring
Brandon Casey [Mon, 23 Sep 2013 18:49:16 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: support ancient gnome-keyring

The gnome-keyring lib distributed with RHEL 5.X is ancient and does
not provide a few of the functions/defines that more recent versions
do, but mostly the API is the same.  Let's provide the missing bits
via macro definitions and function implementation.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: report failure to store password
Brandon Casey [Mon, 23 Sep 2013 18:49:15 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: report failure to store password

Produce an error message when we fail to store a password to the keyring.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: use glib messaging functions
Brandon Casey [Mon, 23 Sep 2013 18:49:14 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use glib messaging functions

Rather than roll our own, let's use the messaging functions provided
by glib.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: use glib memory allocation functions
Brandon Casey [Mon, 23 Sep 2013 18:49:13 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use glib memory allocation functions

Rather than roll our own, let's use the memory allocation/free routines
provided by glib.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: use secure memory for reading passwords
Brandon Casey [Mon, 23 Sep 2013 18:49:12 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use secure memory for reading passwords

gnome-keyring provides functions to allocate non-pageable memory (if
possible).  Let's use them to allocate memory that may be used to hold
secure data read from the keyring.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: use secure memory functions for passwds
Brandon Casey [Mon, 23 Sep 2013 18:49:11 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use secure memory functions for passwds

gnome-keyring provides functions for allocating non-pageable memory (if
possible) intended to be used for storing passwords.  Let's use them.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object()
Brandon Casey [Mon, 23 Sep 2013 18:49:10 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object()

Rather than carefully allocating memory for sprintf() to write into,
let's make use of the glib helper function g_strdup_printf(), which
makes things a lot easier and less error-prone.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: set Gnome application name
Brandon Casey [Mon, 23 Sep 2013 18:49:09 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: set Gnome application name

Since this is a Gnome application, let's set the application name to
something reasonable.  This will be displayed in Gnome dialog boxes
e.g. the one that prompts for the user's keyring password.

We add an include statement for glib.h and add the glib-2.0 cflags and
libs to the compilation arguments, but both of these are really noops
since glib is already a dependency of gnome-keyring.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing
Brandon Casey [Mon, 23 Sep 2013 18:49:08 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing

Ensure buffer length is non-zero before attempting to access the last
element.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t
Brandon Casey [Mon, 23 Sep 2013 18:49:07 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t

Also, initialization is not necessary since it is assigned before it is
used.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly
Brandon Casey [Mon, 23 Sep 2013 18:49:06 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly

If the correct arguments were not specified, this program should exit
non-zero.  Let's do so.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: add static where applicable
Brandon Casey [Mon, 23 Sep 2013 18:49:05 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: add static where applicable

Mark global variable and functions as static.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocontrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc.
Brandon Casey [Mon, 23 Sep 2013 18:49:04 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorevision: do not peel tags used in range notation
Junio C Hamano [Thu, 19 Sep 2013 21:20:34 +0000 (14:20 -0700)]
revision: do not peel tags used in range notation

A range notation "A..B" means exactly the same thing as what "^A B"
means, i.e. the set of commits that are reachable from B but not
from A.  But the internal representation after the revision parser
parsed these two notations are subtly different.

 - "rev-list ^A B" leaves A and B in the revs->pending.objects[]
   array, with the former marked as UNINTERESTING and the revision
   traversal machinery propagates the mark to underlying commit
   objects A^0 and B^0.

 - "rev-list A..B" peels tags and leaves A^0 (marked as
   UNINTERESTING) and B^0 in revs->pending.objects[] array before
   the traversal machinery kicks in.

This difference usually does not matter, but starts to matter when
the --objects option is used.  For example, we see this:

    $ git rev-list --objects v1.8.4^1..v1.8.4 | grep $(git rev-parse v1.8.4)
    $ git rev-list --objects v1.8.4 ^v1.8.4^1 | grep $(git rev-parse v1.8.4)
    04f013dc38d7512eadb915eba22efc414f18b869 v1.8.4

With the former invocation, the revision traversal machinery never
hears about the tag v1.8.4 (it only sees the result of peeling it,
i.e. the commit v1.8.4^0), and the tag itself does not appear in the
output.  The latter does send the tag object itself to the output.

Make the range notation keep the unpeeled objects and feed them to
the traversal machinery to fix this inconsistency.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'maint'
Junio C Hamano [Tue, 15 Oct 2013 23:15:00 +0000 (16:15 -0700)]
Merge branch 'maint'

* maint:
  git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY
  clone --branch: refuse to clone if upstream repo is empty

10 years agogit-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY
Steffen Prohaska [Mon, 23 Sep 2013 19:19:19 +0000 (21:19 +0200)]
git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY

git-prune-packed operates on GIT_OBJECT_DIRECTORY, not
GIT_OBJECT_DIR.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit.txt: fix asciidoc syntax of --*-pathspecs
Steffen Prohaska [Mon, 23 Sep 2013 18:54:35 +0000 (20:54 +0200)]
git.txt: fix asciidoc syntax of --*-pathspecs

Labeled lists require a double colon.

[jc] I eyeballed the output from

        git grep '[^:]:$' Documentation/\*.txt

     and the patch fixes all breakages of this kind.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodoc/cli: make "dot repository" an independent bullet point
Philip Oakley [Tue, 15 Oct 2013 21:57:42 +0000 (14:57 -0700)]
doc/cli: make "dot repository" an independent bullet point

The way to spell the current repository with a '.' dot is
independent from how the pathspec allows globs expanded by Git.

Make them two separate bullet items in the enumeration.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote: do not copy "origin" string literal
Jeff King [Tue, 24 Sep 2013 05:19:08 +0000 (01:19 -0400)]
remote: do not copy "origin" string literal

Our default_remote_name starts at "origin", but may be
overridden by the config file. In the former case, we
allocate a new string, but in the latter case, we point to
the remote name in an existing "struct branch".

This gives the variable inconsistent free() semantics (we
are sometimes responsible for freeing the string and
sometimes pointing to somebody else's storage), and causes a
small leak when the allocated string is overridden by
config.

We can fix both by simply dropping the extra copy and
pointing to the string literal.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agobash prompt: don't use '+=' operator in show upstream code path
SZEDER Gábor [Tue, 15 Oct 2013 12:21:11 +0000 (14:21 +0200)]
bash prompt: don't use '+=' operator in show upstream code path

The '+=' operator is not supported by old Bash versions (3.0) we still
care about.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosplit_ident: parse timestamp from end of line
Jeff King [Mon, 14 Oct 2013 22:45:00 +0000 (18:45 -0400)]
split_ident: parse timestamp from end of line

Split_ident currently parses left to right. Given this
input:

  Your Name <email@example.com> 123456789 -0500\n

We assume the name starts the line and runs until the first
"<".  That starts the email address, which runs until the
first ">".  Everything after that is assumed to be the
timestamp.

This works fine in the normal case, but is easily broken by
corrupted ident lines that contain an extra ">". Some
examples seen in the wild are:

  1. Name <email>-<> 123456789 -0500\n

  2. Name <email> <Name<email>> 123456789 -0500\n

  3. Name1 <email1>, Name2 <email2> 123456789 -0500\n

Currently each of these produces some email address (which
is not necessarily the one the user intended) and end up
with a NULL date (which is generally interpreted as the
epoch by "git log" and friends).

But in each case we could get the correct timestamp simply
by parsing from the right-hand side, looking backwards for
the final ">", and then reading the timestamp from there.

In general, it's a losing battle to try to automatically
guess what the user meant with their broken crud. But this
particular workaround is probably worth doing.  One, it's
dirt simple, and can't impact non-broken cases. Two, it
doesn't catch a single breakage we've seen, but rather a
large class of errors (i.e., any breakage inside the email
angle brackets may affect the email, but won't spill over
into the timestamp parsing). And three, the timestamp is
arguably more valuable to get right, because it can affect
correctness (e.g., in --until cutoffs).

This patch implements the right-to-left scheme described
above. We adjust the tests in t4212, which generate a commit
with such a broken ident, and now gets the timestamp right.
We also add a test that fsck continues to detect the
breakage.

For reference, here are pointers to the breakages seen (as
numbered above):

[1] http://article.gmane.org/gmane.comp.version-control.git/221441

[2] http://article.gmane.org/gmane.comp.version-control.git/222362

[3] http://perl5.git.perl.org/perl.git/commit/13b79730adea97e660de84bbe67f9d7cbe344302

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoremote-curl: rewrite base url from info/refs redirects
Jeff King [Sat, 28 Sep 2013 08:35:35 +0000 (04:35 -0400)]
remote-curl: rewrite base url from info/refs redirects

For efficiency and security reasons, an earlier commit in
this series taught http_get_* to re-write the base url based
on redirections we saw while making a specific request.

This commit wires that option into the info/refs request,
meaning that a redirect from

    http://example.com/foo.git/info/refs

to

    https://example.com/bar.git/info/refs

will behave as if "https://example.com/bar.git" had been
provided to git in the first place.

The tests bear some explanation. We introduce two new
hierearchies into the httpd test config:

  1. Requests to /smart-redir-limited will work only for the
     initial info/refs request, but not any subsequent
     requests. As a result, we can confirm whether the
     client is re-rooting its requests after the initial
     contact, since otherwise it will fail (it will ask for
     "repo.git/git-upload-pack", which is not redirected).

  2. Requests to smart-redir-auth will redirect, and require
     auth after the redirection. Since we are using the
     redirected base for further requests, we also update
     the credential struct, in order not to mislead the user
     (or credential helpers) about which credential is
     needed. We can therefore check the GIT_ASKPASS prompts
     to make sure we are prompting for the new location.
     Because we have neither multiple servers nor https
     support in our test setup, we can only redirect between
     paths, meaning we need to turn on
     credential.useHttpPath to see the difference.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
10 years agoremote-curl: store url as a strbuf
Jeff King [Sat, 28 Sep 2013 08:35:25 +0000 (04:35 -0400)]
remote-curl: store url as a strbuf

We use a strbuf to generate the string containing the remote
URL, but then detach it to a bare pointer. This makes it
harder to later manipulate the URL, as we have forgotten the
length (and the allocation semantics are not as clear).

Let's instead keep the strbuf around. As a bonus, this
eliminates a confusing double-use of the "buf" strbuf in
main(). Prior to this, it was used both for constructing the
url, and for reading commands from stdin.

The downside is that we have to update each call site to
refer to "url.buf" rather than just "url" when they want the
C string.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
10 years agoremote-curl: make refs_url a strbuf
Jeff King [Sat, 28 Sep 2013 08:35:10 +0000 (04:35 -0400)]
remote-curl: make refs_url a strbuf

In the discover_refs function, we use a strbuf named
"buffer" for multiple purposes. First we build the info/refs
URL in it, and then detach that to a bare pointer. Then, we
use the same strbuf to store the result of fetching the
refs.

Let's instead keep a separate refs_url strbuf. This is less
confusing, as the "buffer" strbuf is now used for only one
thing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
10 years agohttp: update base URLs when we see redirects
Jeff King [Sat, 28 Sep 2013 08:34:05 +0000 (04:34 -0400)]
http: update base URLs when we see redirects

If a caller asks the http_get_* functions to go to a
particular URL and we end up elsewhere due to a redirect,
the effective_url field can tell us where we went.

It would be nice to remember this redirect and short-cut
further requests for two reasons:

  1. It's more efficient. Otherwise we spend an extra http
     round-trip to the server for each subsequent request,
     just to get redirected.

  2. If we end up with an http 401 and are going to ask for
     credentials, it is to feed them to the redirect target.
     If the redirect is an http->https upgrade, this means
     our credentials may be provided on the http leg, just
     to end up redirected to https. And if the redirect
     crosses server boundaries, then curl will drop the
     credentials entirely as it follows the redirect.

However, it, it is not enough to simply record the effective
URL we saw and use that for subsequent requests. We were
originally fed a "base" url like:

   http://example.com/foo.git

and we want to figure out what the new base is, even though
the URLs we see may be:

     original: http://example.com/foo.git/info/refs
    effective: http://example.com/bar.git/info/refs

Subsequent requests will not be for "info/refs", but for
other paths relative to the base. We must ask the caller to
pass in the original base, and we must pass the redirected
base back to the caller (so that it can generate more URLs
from it). Furthermore, we need to feed the new base to the
credential code, so that requests to credential helpers (or
to the user) match the URL we will be requesting.

This patch teaches http_request_reauth to do this munging.
Since it is the caller who cares about making more URLs, it
seems at first glance that callers could simply check
effective_url themselves and handle it. However, since we
need to update the credential struct before the second
re-auth request, we have to do it inside http_request_reauth.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
10 years agohttp: provide effective url to callers
Jeff King [Sat, 28 Sep 2013 08:32:02 +0000 (04:32 -0400)]
http: provide effective url to callers

When we ask curl to access a URL, it may follow one or more
redirects to reach the final location. We have no idea
this has happened, as curl takes care of the details and
simply returns the final content to us.

The final URL that we ended up with can be accessed via
CURLINFO_EFFECTIVE_URL. Let's make that optionally available
to callers of http_get_*, so that they can make further
decisions based on the redirection.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>