Revision 2501aff8b7516115c409cb34cc50305cdde40a47 authored by Jeff King on 28 September 2013, 08:31:45 UTC, committed by Jonathan Nieder on 14 October 2013, 23:55:13 UTC
When we are handling a curl response code in http_request or
in the remote-curl RPC code, we use the handle_curl_result
helper to translate curl's response into an easy-to-use
code. When we see an HTTP 401, we do one of two things:

  1. If we already had a filled-in credential, we mark it as
     rejected, and then return HTTP_NOAUTH to indicate to
     the caller that we failed.

  2. If we didn't, then we ask for a new credential and tell
     the caller HTTP_REAUTH to indicate that they may want
     to try again.

Rejecting in the first case makes sense; it is the natural
result of the request we just made. However, prompting for
more credentials in the second step does not always make
sense. We do not know for sure that the caller is going to
make a second request, and nor are we sure that it will be
to the same URL. Logically, the prompt belongs not to the
request we just finished, but to the request we are (maybe)
about to make.

In practice, it is very hard to trigger any bad behavior.
Currently, if we make a second request, it will always be to
the same URL (even in the face of redirects, because curl
handles the redirects internally). And we almost always
retry on HTTP_REAUTH these days. The one exception is if we
are streaming a large RPC request to the server (e.g., a
pushed packfile), in which case we cannot restart. It's
extremely unlikely to see a 401 response at this stage,
though, as we would typically have seen it when we sent a
probe request, before streaming the data.

This patch drops the automatic prompt out of case 2, and
instead requires the caller to do it. This is a few extra
lines of code, and the bug it fixes is unlikely to come up
in practice. But it is conceptually cleaner, and paves the
way for better handling of credentials across redirects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
1 parent 1bbcc22
Raw File
merge-config.txt
merge.conflictstyle::
	Specify the style in which conflicted hunks are written out to
	working tree files upon merge.  The default is "merge", which
	shows a `<<<<<<<` conflict marker, changes made by one side,
	a `=======` marker, changes made by the other side, and then
	a `>>>>>>>` marker.  An alternate style, "diff3", adds a `|||||||`
	marker and the original text before the `=======` marker.

merge.defaultToUpstream::
	If merge is called without any commit argument, merge the upstream
	branches configured for the current branch by using their last
	observed values stored in their remote-tracking branches.
	The values of the `branch.<current branch>.merge` that name the
	branches at the remote named by `branch.<current branch>.remote`
	are consulted, and then they are mapped via `remote.<remote>.fetch`
	to their corresponding remote-tracking branches, and the tips of
	these tracking branches are merged.

merge.ff::
	By default, Git does not create an extra merge commit when merging
	a commit that is a descendant of the current commit. Instead, the
	tip of the current branch is fast-forwarded. When set to `false`,
	this variable tells Git to create an extra merge commit in such
	a case (equivalent to giving the `--no-ff` option from the command
	line). When set to `only`, only such fast-forward merges are
	allowed (equivalent to giving the `--ff-only` option from the
	command line).

merge.log::
	In addition to branch names, populate the log message with at
	most the specified number of one-line descriptions from the
	actual commits that are being merged.  Defaults to false, and
	true is a synonym for 20.

merge.renameLimit::
	The number of files to consider when performing rename detection
	during a merge; if not specified, defaults to the value of
	diff.renameLimit.

merge.renormalize::
	Tell Git that canonical representation of files in the
	repository has changed over time (e.g. earlier commits record
	text files with CRLF line endings, but recent ones use LF line
	endings).  In such a repository, Git can convert the data
	recorded in commits to a canonical form before performing a
	merge to reduce unnecessary conflicts.  For more information,
	see section "Merging branches with differing checkin/checkout
	attributes" in linkgit:gitattributes[5].

merge.stat::
	Whether to print the diffstat between ORIG_HEAD and the merge result
	at the end of the merge.  True by default.

merge.tool::
	Controls which merge tool is used by linkgit:git-mergetool[1].
	The list below shows the valid built-in values.
	Any other value is treated as a custom merge tool and requires
	that a corresponding mergetool.<tool>.cmd variable is defined.

include::mergetools-merge.txt[]

merge.verbosity::
	Controls the amount of output shown by the recursive merge
	strategy.  Level 0 outputs nothing except a final error
	message if conflicts were detected. Level 1 outputs only
	conflicts, 2 outputs conflicts and file changes.  Level 5 and
	above outputs debugging information.  The default is level 2.
	Can be overridden by the 'GIT_MERGE_VERBOSITY' environment variable.

merge.<driver>.name::
	Defines a human-readable name for a custom low-level
	merge driver.  See linkgit:gitattributes[5] for details.

merge.<driver>.driver::
	Defines the command that implements a custom low-level
	merge driver.  See linkgit:gitattributes[5] for details.

merge.<driver>.recursive::
	Names a low-level merge driver to be used when
	performing an internal merge between common ancestors.
	See linkgit:gitattributes[5] for details.
back to top