Skip to content

http*: refactor fetching code

Tay Ray Chuan git 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest11 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/11t5550-http-fetch: test fetching of packed objectst/t5550-http-fetch.sh+8 -00 replies
2/11http-push, http-walker: style fixeshttp-push.c http-walker.c+79 -520 replies
3/11http-walker: verify remote packshttp-walker.c+30 -30 replies
4/11http*: copy string returned by sha1_to_hexhttp-push.c http-walker.c+47 -410 replies
5/11http-push: do not SEGV after fetching a bad pack idx filehttp-push.c+2 -00 replies
6/11http*: move common variables and macros to http.[ch]http-push.c http-walker.c http.c +1 more+20 -200 replies
7/11http: create function end_url_with_slashhttp.c+9 -30 replies
8/11http*: add fetch_http_pack_indexhttp-push.c http-walker.c http.c +1 more+128 -2340 replies
9/11http*: add helper methods for fetching packshttp-push.c http-walker.c http.c +1 more+161 -1450 replies
10/11http*: add helper methods for fetching objects/info/packshttp-push.c http-walker.c http.c +1 more+114 -810 replies
11/11http*: add helper methods for fetching objects (loose)http-push.c http-walker.c http.c +1 more+336 -4290 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/11] http*: refactor fetching code

This patch series moves out fetching code from http-push.c and http-walker.c into http.c to reduce code duplicity, and does not attempt to change git's behaviour.

Patch #1 adds rigour to http fetch tests by testing fetching of packed objects, in an effort to ensure that this patch series does not break functionality or change behaviour.

Patch #2 introduces some style fixes, to reduce the number of trivial differences between http-push.c and http-walker.c.

Patch #3 and #5 add features and fixes that were applied on to fetching code in http-push.c or http-walker.c, but not the other. Patch #4, like patch #3, applies onto the code for fetching pack indices (pack-*.idx), and fixes the issue of "mutating" value of the hex variable in fetch_index (especially likely to be encountered when using http-walker.c).

Patch #6 does some simple refactoring of variables and macros.

Patch #7 refactors the logic for appending slashes in quote_ref_url, creating a new method, end_url_with_slash. The latter method will be used in the following patches, since the base urls in http-walker.c and http-push.c are handled differently (ie. the former doesn't include a trailing slash, while the latter does). By using this method throughout, fetching code need not use different printf formatters or differentiate between invocations from http-push.c and http-walker.c.

Patch #8 to #11 refactors code that handles fetching of:
*pack indices (pack-*.idx)
*packs
*pack index (objects/info/packs)
*loose objects

Tay Ray Chuan (11):
t5550-http-fetch: test fetching of packed objects http-push, http-walker: style fixes
http-walker: verify remote packs
http*: copy string returned by sha1_to_hex
http-push: do not SEGV after fetching a bad pack idx file http*: move common variables and macros to http.[ch]
http: create function end_url_with_slash
http*: add fetch_http_pack_index
http*: add helper methods for fetching packs http*: add helper methods for fetching objects/info/packs http*: add helper methods for fetching objects (loose)

 http-push.c           |  472 +++++-------------------------------------
 http-walker.c         |  525 +++++++++-------------------------------------
 http.c                |  554 ++++++++++++++++++++++++++++++++++++++++++++++++-
 http.h                |   73 +++++++
 t/t5550-http-fetch.sh |    8 +
 5 files changed, 779 insertions(+), 853 deletions(-)