Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1de44c24
Commit
1de44c24
authored
Jun 28, 2012
by
Vicent Martí
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #791 from carlosmn/index-path
indexer: don't use '/objects/pack/' unconditionally
parents
ed754a75
37159957
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
18 additions
and
8 deletions
+18
-8
examples/network/Makefile
+1
-1
examples/network/index-pack.c
+1
-1
include/git2/indexer.h
+2
-2
src/fetch.c
+7
-2
src/indexer.c
+1
-1
src/transports/http.c
+6
-1
No files found.
examples/network/Makefile
View file @
1de44c24
...
@@ -2,7 +2,7 @@ default: all
...
@@ -2,7 +2,7 @@ default: all
CC
=
gcc
CC
=
gcc
CFLAGS
+=
-g
CFLAGS
+=
-g
CFLAGS
+=
-I
../../include
-L
../../build
-lgit2
-lpthread
CFLAGS
+=
-I
../../include
-L
../../build
-
L
../..
-
lgit2
-lpthread
OBJECTS
=
\
OBJECTS
=
\
git2.o
\
git2.o
\
...
...
examples/network/index-pack.c
View file @
1de44c24
...
@@ -25,7 +25,7 @@ int index_pack(git_repository *repo, int argc, char **argv)
...
@@ -25,7 +25,7 @@ int index_pack(git_repository *repo, int argc, char **argv)
return
EXIT_FAILURE
;
return
EXIT_FAILURE
;
}
}
if
(
git_indexer_stream_new
(
&
idx
,
".
git
"
)
<
0
)
{
if
(
git_indexer_stream_new
(
&
idx
,
"."
)
<
0
)
{
puts
(
"bad idx"
);
puts
(
"bad idx"
);
return
-
1
;
return
-
1
;
}
}
...
...
include/git2/indexer.h
View file @
1de44c24
...
@@ -29,9 +29,9 @@ typedef struct git_indexer_stream git_indexer_stream;
...
@@ -29,9 +29,9 @@ typedef struct git_indexer_stream git_indexer_stream;
* Create a new streaming indexer instance
* Create a new streaming indexer instance
*
*
* @param out where to store the indexer instance
* @param out where to store the indexer instance
* @param path to the
gitdir (metadata directory)
* @param path to the
directory where the packfile should be stored
*/
*/
GIT_EXTERN
(
int
)
git_indexer_stream_new
(
git_indexer_stream
**
out
,
const
char
*
gitdir
);
GIT_EXTERN
(
int
)
git_indexer_stream_new
(
git_indexer_stream
**
out
,
const
char
*
path
);
/**
/**
* Add data to the indexer
* Add data to the indexer
...
...
src/fetch.c
View file @
1de44c24
...
@@ -118,7 +118,8 @@ int git_fetch__download_pack(
...
@@ -118,7 +118,8 @@ int git_fetch__download_pack(
int
recvd
;
int
recvd
;
char
buff
[
1024
];
char
buff
[
1024
];
gitno_buffer
buf
;
gitno_buffer
buf
;
git_indexer_stream
*
idx
;
git_buf
path
=
GIT_BUF_INIT
;
git_indexer_stream
*
idx
=
NULL
;
gitno_buffer_setup
(
t
,
&
buf
,
buff
,
sizeof
(
buff
));
gitno_buffer_setup
(
t
,
&
buf
,
buff
,
sizeof
(
buff
));
...
@@ -127,9 +128,12 @@ int git_fetch__download_pack(
...
@@ -127,9 +128,12 @@ int git_fetch__download_pack(
return
-
1
;
return
-
1
;
}
}
if
(
git_
indexer_stream_new
(
&
idx
,
git_repository_path
(
repo
)
)
<
0
)
if
(
git_
buf_joinpath
(
&
path
,
git_repository_path
(
repo
),
"objects/pack"
)
<
0
)
return
-
1
;
return
-
1
;
if
(
git_indexer_stream_new
(
&
idx
,
git_buf_cstr
(
&
path
))
<
0
)
goto
on_error
;
memset
(
stats
,
0
,
sizeof
(
git_indexer_stats
));
memset
(
stats
,
0
,
sizeof
(
git_indexer_stats
));
if
(
git_indexer_stream_add
(
idx
,
buffered
,
buffered_size
,
stats
)
<
0
)
if
(
git_indexer_stream_add
(
idx
,
buffered
,
buffered_size
,
stats
)
<
0
)
goto
on_error
;
goto
on_error
;
...
@@ -154,6 +158,7 @@ int git_fetch__download_pack(
...
@@ -154,6 +158,7 @@ int git_fetch__download_pack(
return
0
;
return
0
;
on_error:
on_error:
git_buf_free
(
&
path
);
git_indexer_stream_free
(
idx
);
git_indexer_stream_free
(
idx
);
return
-
1
;
return
-
1
;
}
}
...
...
src/indexer.c
View file @
1de44c24
...
@@ -142,7 +142,7 @@ int git_indexer_stream_new(git_indexer_stream **out, const char *prefix)
...
@@ -142,7 +142,7 @@ int git_indexer_stream_new(git_indexer_stream **out, const char *prefix)
{
{
git_indexer_stream
*
idx
;
git_indexer_stream
*
idx
;
git_buf
path
=
GIT_BUF_INIT
;
git_buf
path
=
GIT_BUF_INIT
;
static
const
char
suff
[]
=
"/
objects/pack/pack-received
"
;
static
const
char
suff
[]
=
"/
pack
"
;
int
error
;
int
error
;
idx
=
git__calloc
(
1
,
sizeof
(
git_indexer_stream
));
idx
=
git__calloc
(
1
,
sizeof
(
git_indexer_stream
));
...
...
src/transports/http.c
View file @
1de44c24
...
@@ -545,6 +545,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
...
@@ -545,6 +545,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
http_parser_settings
settings
;
http_parser_settings
settings
;
char
buffer
[
1024
];
char
buffer
[
1024
];
gitno_buffer
buf
;
gitno_buffer
buf
;
git_buf
path
=
GIT_BUF_INIT
;
git_indexer_stream
*
idx
=
NULL
;
git_indexer_stream
*
idx
=
NULL
;
download_pack_cbdata
data
;
download_pack_cbdata
data
;
...
@@ -555,7 +556,10 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
...
@@ -555,7 +556,10 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
return
-
1
;
return
-
1
;
}
}
if
(
git_indexer_stream_new
(
&
idx
,
git_repository_path
(
repo
))
<
0
)
if
(
git_buf_joinpath
(
&
path
,
git_repository_path
(
repo
),
"objects/pack"
)
<
0
)
return
-
1
;
if
(
git_indexer_stream_new
(
&
idx
,
git_buf_cstr
(
&
path
))
<
0
)
return
-
1
;
return
-
1
;
/*
/*
...
@@ -600,6 +604,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
...
@@ -600,6 +604,7 @@ static int http_download_pack(git_transport *transport, git_repository *repo, gi
on_error:
on_error:
git_indexer_stream_free
(
idx
);
git_indexer_stream_free
(
idx
);
git_buf_free
(
&
path
);
return
-
1
;
return
-
1
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment