Skip to content

Commit d423119

Browse files
committed
Revert "Merge branch 'mc/credential-helper-auth-headers' into next"
This reverts commit cb95006, reversing changes made to aaa3c88; its tests should be redone without adding a custom http-server lookalike.
1 parent b5b5020 commit d423119

File tree

13 files changed

+302
-1936
lines changed

13 files changed

+302
-1936
lines changed

Documentation/git-credential.txt

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,7 @@ separated by an `=` (equals) sign, followed by a newline.
113113
The key may contain any bytes except `=`, newline, or NUL. The value may
114114
contain any bytes except newline or NUL.
115115

116-
Attributes with keys that end with C-style array brackets `[]` can have
117-
multiple values. Each instance of a multi-valued attribute forms an
118-
ordered list of values - the order of the repeated attributes defines
119-
the order of the values. An empty multi-valued attribute (`key[]=\n`)
120-
acts to clear any previous entries and reset the list.
121-
122-
In all cases, all bytes are treated as-is (i.e., there is no quoting,
116+
In both cases, all bytes are treated as-is (i.e., there is no quoting,
123117
and one cannot transmit a value with newline or NUL in it). The list of
124118
attributes is terminated by a blank line or end-of-file.
125119

@@ -166,17 +160,6 @@ empty string.
166160
Components which are missing from the URL (e.g., there is no
167161
username in the example above) will be left unset.
168162

169-
`wwwauth[]`::
170-
171-
When an HTTP response is received by Git that includes one or more
172-
'WWW-Authenticate' authentication headers, these will be passed by Git
173-
to credential helpers.
174-
+
175-
Each 'WWW-Authenticate' header value is passed as a multi-valued
176-
attribute 'wwwauth[]', where the order of the attributes is the same as
177-
they appear in the HTTP response. This attribute is 'one-way' from Git
178-
to pass additional information to credential helpers.
179-
180163
Unrecognised attributes are silently discarded.
181164

182165
GIT

Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,6 @@ TEST_BUILTINS_OBJS += test-xml-encode.o
867867
# Do not add more tests here unless they have extra dependencies. Add
868868
# them in TEST_BUILTINS_OBJS above.
869869
TEST_PROGRAMS_NEED_X += test-fake-ssh
870-
TEST_PROGRAMS_NEED_X += test-http-server
871870
TEST_PROGRAMS_NEED_X += test-tool
872871

873872
TEST_PROGRAMS = $(patsubst %,t/helper/%$X,$(TEST_PROGRAMS_NEED_X))
@@ -1006,7 +1005,6 @@ LIB_OBJS += credential.o
10061005
LIB_OBJS += csum-file.o
10071006
LIB_OBJS += ctype.o
10081007
LIB_OBJS += date.o
1009-
LIB_OBJS += daemon-utils.o
10101008
LIB_OBJS += decorate.o
10111009
LIB_OBJS += delta-islands.o
10121010
LIB_OBJS += diagnose.o

contrib/buildsystems/CMakeLists.txt

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,6 @@ if(BUILD_TESTING)
961961
add_executable(test-fake-ssh ${CMAKE_SOURCE_DIR}/t/helper/test-fake-ssh.c)
962962
target_link_libraries(test-fake-ssh common-main)
963963

964-
add_executable(test-http-server ${CMAKE_SOURCE_DIR}/t/helper/test-http-server.c)
965-
target_link_libraries(test-http-server common-main)
966-
967964
#reftable-tests
968965
parse_makefile_for_sources(test-reftable_SOURCES "REFTABLE_TEST_OBJS")
969966
list(TRANSFORM test-reftable_SOURCES PREPEND "${CMAKE_SOURCE_DIR}/")
@@ -983,19 +980,15 @@ if(MSVC)
983980
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/helper)
984981
set_target_properties(test-fake-ssh test-tool
985982
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/helper)
986-
987-
set_target_properties(test-http-server
988-
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/t/helper)
989-
set_target_properties(test-http-server
990-
PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/t/helper)
991983
endif()
992984

993985
#wrapper scripts
994986
set(wrapper_scripts
995987
git git-upload-pack git-receive-pack git-upload-archive git-shell git-remote-ext scalar)
996988

997989
set(wrapper_test_scripts
998-
test-http-server test-fake-ssh test-tool)
990+
test-fake-ssh test-tool)
991+
999992

1000993
foreach(script ${wrapper_scripts})
1001994
file(STRINGS ${CMAKE_SOURCE_DIR}/wrap-for-bin.sh content NEWLINE_CONSUME)

credential.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ void credential_clear(struct credential *c)
2222
free(c->username);
2323
free(c->password);
2424
string_list_clear(&c->helpers, 0);
25-
strvec_clear(&c->wwwauth_headers);
2625

2726
credential_init(c);
2827
}
@@ -263,24 +262,13 @@ static void credential_write_item(FILE *fp, const char *key, const char *value,
263262
fprintf(fp, "%s=%s\n", key, value);
264263
}
265264

266-
static void credential_write_strvec(FILE *fp, const char *key,
267-
const struct strvec *vec)
268-
{
269-
char *full_key = xstrfmt("%s[]", key);
270-
for (size_t i = 0; i < vec->nr; i++) {
271-
credential_write_item(fp, full_key, vec->v[i], 0);
272-
}
273-
free(full_key);
274-
}
275-
276265
void credential_write(const struct credential *c, FILE *fp)
277266
{
278267
credential_write_item(fp, "protocol", c->protocol, 1);
279268
credential_write_item(fp, "host", c->host, 1);
280269
credential_write_item(fp, "path", c->path, 0);
281270
credential_write_item(fp, "username", c->username, 0);
282271
credential_write_item(fp, "password", c->password, 0);
283-
credential_write_strvec(fp, "wwwauth", &c->wwwauth_headers);
284272
}
285273

286274
static int run_credential_helper(struct credential *c,

credential.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define CREDENTIAL_H
33

44
#include "string-list.h"
5-
#include "strvec.h"
65

76
/**
87
* The credentials API provides an abstracted way of gathering username and
@@ -116,19 +115,6 @@ struct credential {
116115
*/
117116
struct string_list helpers;
118117

119-
/**
120-
* A `strvec` of WWW-Authenticate header values. Each string
121-
* is the value of a WWW-Authenticate header in an HTTP response,
122-
* in the order they were received in the response.
123-
*/
124-
struct strvec wwwauth_headers;
125-
126-
/**
127-
* Internal use only. Used to keep track of split header fields
128-
* in order to fold multiple lines into one value.
129-
*/
130-
unsigned header_is_last_match:1;
131-
132118
unsigned approved:1,
133119
configured:1,
134120
quit:1,
@@ -144,7 +130,6 @@ struct credential {
144130

145131
#define CREDENTIAL_INIT { \
146132
.helpers = STRING_LIST_INIT_DUP, \
147-
.wwwauth_headers = STRVEC_INIT, \
148133
}
149134

150135
/* Initialize a credential structure, setting all fields to empty. */

0 commit comments

Comments
 (0)