mirror of
https://github.com/git/git.git
synced 2026-03-15 03:00:07 +01:00
Merge branch 'master' into next
* master:
pull: Document the "--[no-]recurse-submodules" options
quote.h: simplify the inclusion
sha1_object_info: examine cached_object store too
sha1_file.c: move find_cached_object up so sha1_object_info can use it
Add const to parse_{commit,tag}_buffer()
diff: support --cached on unborn branches
gitweb: Mention optional Perl modules in INSTALL
post-receive-email: suppress error if description file missing
t7407: fix line endings for mingw build
t4120-apply-popt: help systems with core.filemode=false
t3509: use unconstrained initial test to setup repository.
start_command: flush buffers in the WIN32 code path as well
bundle: Use OFS_DELTA in bundle files
This commit is contained in:
@@ -64,13 +64,11 @@ ifndef::git-pull[]
|
||||
downloaded. The default behavior for a remote may be
|
||||
specified with the remote.<name>.tagopt setting. See
|
||||
linkgit:git-config[1].
|
||||
endif::git-pull[]
|
||||
|
||||
--[no-]recurse-submodules::
|
||||
This option controls if new commits of all populated submodules should
|
||||
be fetched too (see linkgit:git-config[1] and linkgit:gitmodules[5]).
|
||||
|
||||
ifndef::git-pull[]
|
||||
--submodule-prefix=<path>::
|
||||
Prepend <path> to paths printed in informative messages
|
||||
such as "Fetching submodule foo". This option is used
|
||||
|
||||
@@ -38,6 +38,8 @@ directories. This behavior can be forced by --no-index.
|
||||
commit relative to the named <commit>. Typically you
|
||||
would want comparison with the latest commit, so if you
|
||||
do not give <commit>, it defaults to HEAD.
|
||||
If HEAD does not exist (e.g. unborned branches) and
|
||||
<commit> is not given, it shows all staged changes.
|
||||
--staged is a synonym of --cached.
|
||||
|
||||
'git diff' [--options] <commit> [--] [<path>...]::
|
||||
|
||||
@@ -84,6 +84,15 @@ must be given before the options meant for 'git fetch'.
|
||||
--verbose::
|
||||
Pass --verbose to git-fetch and git-merge.
|
||||
|
||||
--[no-]recurse-submodules::
|
||||
This option controls if new commits of all populated submodules should
|
||||
be fetched too (see linkgit:git-config[1] and linkgit:gitmodules[5]).
|
||||
That might be necessary to get the data needed for merging submodule
|
||||
commits, a feature git learned in 1.7.3. Notice that the result of a
|
||||
merge will not be checked out in the submodule, "git submodule update"
|
||||
has to be called afterwards to bring the work tree up to date with the
|
||||
merge result.
|
||||
|
||||
Options related to merging
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
@@ -330,8 +330,11 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
|
||||
else if (!strcmp(arg, "--cached") ||
|
||||
!strcmp(arg, "--staged")) {
|
||||
add_head_to_pending(&rev);
|
||||
if (!rev.pending.nr)
|
||||
die("No HEAD commit to compare with (yet)");
|
||||
if (!rev.pending.nr) {
|
||||
struct tree *tree;
|
||||
tree = lookup_tree((const unsigned char*)EMPTY_TREE_SHA1_BIN);
|
||||
add_pending_object(&rev, &tree->object, "HEAD");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
5
bundle.c
5
bundle.c
@@ -200,7 +200,7 @@ int create_bundle(struct bundle_header *header, const char *path,
|
||||
int bundle_fd = -1;
|
||||
int bundle_to_stdout;
|
||||
const char **argv_boundary = xmalloc((argc + 4) * sizeof(const char *));
|
||||
const char **argv_pack = xmalloc(5 * sizeof(const char *));
|
||||
const char **argv_pack = xmalloc(6 * sizeof(const char *));
|
||||
int i, ref_count = 0;
|
||||
char buffer[1024];
|
||||
struct rev_info revs;
|
||||
@@ -346,7 +346,8 @@ int create_bundle(struct bundle_header *header, const char *path,
|
||||
argv_pack[1] = "--all-progress-implied";
|
||||
argv_pack[2] = "--stdout";
|
||||
argv_pack[3] = "--thin";
|
||||
argv_pack[4] = NULL;
|
||||
argv_pack[4] = "--delta-base-offset";
|
||||
argv_pack[5] = NULL;
|
||||
memset(&rls, 0, sizeof(rls));
|
||||
rls.argv = argv_pack;
|
||||
rls.in = -1;
|
||||
|
||||
6
commit.c
6
commit.c
@@ -245,10 +245,10 @@ int unregister_shallow(const unsigned char *sha1)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size)
|
||||
int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size)
|
||||
{
|
||||
char *tail = buffer;
|
||||
char *bufptr = buffer;
|
||||
const char *tail = buffer;
|
||||
const char *bufptr = buffer;
|
||||
unsigned char parent[20];
|
||||
struct commit_list **pptr;
|
||||
struct commit_graft *graft;
|
||||
|
||||
2
commit.h
2
commit.h
@@ -38,7 +38,7 @@ struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
|
||||
int quiet);
|
||||
struct commit *lookup_commit_reference_by_name(const char *name);
|
||||
|
||||
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
|
||||
int parse_commit_buffer(struct commit *item, const void *buffer, unsigned long size);
|
||||
int parse_commit(struct commit *item);
|
||||
|
||||
/* Find beginning and length of commit subject. */
|
||||
|
||||
@@ -709,7 +709,7 @@ if [ -z "$GIT_DIR" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
projectdesc=$(sed -ne '1p' "$GIT_DIR/description")
|
||||
projectdesc=$(sed -ne '1p' "$GIT_DIR/description" 2>/dev/null)
|
||||
# Check if the description is unchanged from it's default, and shorten it to
|
||||
# a more manageable length if it is
|
||||
if expr "$projectdesc" : "Unnamed repository.*$" >/dev/null
|
||||
|
||||
@@ -237,6 +237,12 @@ Requirements
|
||||
- Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
|
||||
- web server
|
||||
|
||||
The following optional Perl modules are required for extra features
|
||||
- Digest::MD5 - for gravatar support
|
||||
- CGI::Fast and FCGI - for running gitweb as FastCGI script
|
||||
- HTML::TagCloud - for fancy tag cloud in project list view
|
||||
- HTTP::Date or Time::ParseDate - to support If-Modified-Since for feeds
|
||||
|
||||
|
||||
Example web server configuration
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
3
quote.h
3
quote.h
@@ -1,8 +1,7 @@
|
||||
#ifndef QUOTE_H
|
||||
#define QUOTE_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
struct strbuf;
|
||||
|
||||
/* Help to copy the thing properly quoted for the shell safety.
|
||||
* any single quote is replaced with '\'', any exclamation point
|
||||
|
||||
@@ -194,6 +194,7 @@ fail_pipe:
|
||||
}
|
||||
|
||||
trace_argv_printf(cmd->argv, "trace: run_command:");
|
||||
fflush(NULL);
|
||||
|
||||
#ifndef WIN32
|
||||
{
|
||||
@@ -201,7 +202,6 @@ fail_pipe:
|
||||
if (pipe(notify_pipe))
|
||||
notify_pipe[0] = notify_pipe[1] = -1;
|
||||
|
||||
fflush(NULL);
|
||||
cmd->pid = fork();
|
||||
if (!cmd->pid) {
|
||||
/*
|
||||
|
||||
78
sha1_file.c
78
sha1_file.c
@@ -37,6 +37,41 @@ const unsigned char null_sha1[20];
|
||||
|
||||
static int git_open_noatime(const char *name, struct packed_git *p);
|
||||
|
||||
/*
|
||||
* This is meant to hold a *small* number of objects that you would
|
||||
* want read_sha1_file() to be able to return, but yet you do not want
|
||||
* to write them into the object store (e.g. a browse-only
|
||||
* application).
|
||||
*/
|
||||
static struct cached_object {
|
||||
unsigned char sha1[20];
|
||||
enum object_type type;
|
||||
void *buf;
|
||||
unsigned long size;
|
||||
} *cached_objects;
|
||||
static int cached_object_nr, cached_object_alloc;
|
||||
|
||||
static struct cached_object empty_tree = {
|
||||
EMPTY_TREE_SHA1_BIN,
|
||||
OBJ_TREE,
|
||||
"",
|
||||
0
|
||||
};
|
||||
|
||||
static struct cached_object *find_cached_object(const unsigned char *sha1)
|
||||
{
|
||||
int i;
|
||||
struct cached_object *co = cached_objects;
|
||||
|
||||
for (i = 0; i < cached_object_nr; i++, co++) {
|
||||
if (!hashcmp(co->sha1, sha1))
|
||||
return co;
|
||||
}
|
||||
if (!hashcmp(sha1, empty_tree.sha1))
|
||||
return &empty_tree;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int safe_create_leading_directories(char *path)
|
||||
{
|
||||
char *pos = path + offset_1st_component(path);
|
||||
@@ -1985,9 +2020,17 @@ static int sha1_loose_object_info(const unsigned char *sha1, unsigned long *size
|
||||
|
||||
int sha1_object_info(const unsigned char *sha1, unsigned long *sizep)
|
||||
{
|
||||
struct cached_object *co;
|
||||
struct pack_entry e;
|
||||
int status;
|
||||
|
||||
co = find_cached_object(sha1);
|
||||
if (co) {
|
||||
if (sizep)
|
||||
*sizep = co->size;
|
||||
return co->type;
|
||||
}
|
||||
|
||||
if (!find_pack_entry(sha1, &e)) {
|
||||
/* Most likely it's a loose object. */
|
||||
status = sha1_loose_object_info(sha1, sizep);
|
||||
@@ -2033,41 +2076,6 @@ static void *read_packed_sha1(const unsigned char *sha1,
|
||||
return data;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is meant to hold a *small* number of objects that you would
|
||||
* want read_sha1_file() to be able to return, but yet you do not want
|
||||
* to write them into the object store (e.g. a browse-only
|
||||
* application).
|
||||
*/
|
||||
static struct cached_object {
|
||||
unsigned char sha1[20];
|
||||
enum object_type type;
|
||||
void *buf;
|
||||
unsigned long size;
|
||||
} *cached_objects;
|
||||
static int cached_object_nr, cached_object_alloc;
|
||||
|
||||
static struct cached_object empty_tree = {
|
||||
EMPTY_TREE_SHA1_BIN,
|
||||
OBJ_TREE,
|
||||
"",
|
||||
0
|
||||
};
|
||||
|
||||
static struct cached_object *find_cached_object(const unsigned char *sha1)
|
||||
{
|
||||
int i;
|
||||
struct cached_object *co = cached_objects;
|
||||
|
||||
for (i = 0; i < cached_object_nr; i++, co++) {
|
||||
if (!hashcmp(co->sha1, sha1))
|
||||
return co;
|
||||
}
|
||||
if (!hashcmp(sha1, empty_tree.sha1))
|
||||
return &empty_tree;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,
|
||||
unsigned char *sha1)
|
||||
{
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
test_description='Test cherry-pick with directory/file conflicts'
|
||||
. ./test-lib.sh
|
||||
|
||||
test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
|
||||
test_expect_success 'Initialize repository' '
|
||||
mkdir a &&
|
||||
>a/f &&
|
||||
git add a &&
|
||||
git commit -m a &&
|
||||
git commit -m a
|
||||
'
|
||||
|
||||
test_expect_success SYMLINKS 'Setup rename across paths each below D/F conflicts' '
|
||||
mkdir b &&
|
||||
ln -s ../a b/a &&
|
||||
git add b &&
|
||||
|
||||
@@ -290,4 +290,15 @@ test_expect_success 'log -S requires an argument' '
|
||||
test_must_fail git log -S
|
||||
'
|
||||
|
||||
test_expect_success 'diff --cached on unborn branch' '
|
||||
echo ref: refs/heads/unborn >.git/HEAD &&
|
||||
git diff --cached >result &&
|
||||
test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--cached" result
|
||||
'
|
||||
|
||||
test_expect_success 'diff --cached -- file on unborn branch' '
|
||||
git diff --cached -- file0 >result &&
|
||||
test_cmp "$TEST_DIRECTORY/t4013/diff.diff_--cached_--_file0" result
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
38
t/t4013/diff.diff_--cached
Normal file
38
t/t4013/diff.diff_--cached
Normal file
@@ -0,0 +1,38 @@
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
new file mode 100644
|
||||
index 0000000..992913c
|
||||
--- /dev/null
|
||||
+++ b/dir/sub
|
||||
@@ -0,0 +1,8 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
+D
|
||||
+E
|
||||
+F
|
||||
+1
|
||||
+2
|
||||
diff --git a/file0 b/file0
|
||||
new file mode 100644
|
||||
index 0000000..10a8a9f
|
||||
--- /dev/null
|
||||
+++ b/file0
|
||||
@@ -0,0 +1,9 @@
|
||||
+1
|
||||
+2
|
||||
+3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
diff --git a/file1 b/file1
|
||||
new file mode 100644
|
||||
index 0000000..b1e6722
|
||||
--- /dev/null
|
||||
+++ b/file1
|
||||
@@ -0,0 +1,3 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
15
t/t4013/diff.diff_--cached_--_file0
Normal file
15
t/t4013/diff.diff_--cached_--_file0
Normal file
@@ -0,0 +1,15 @@
|
||||
diff --git a/file0 b/file0
|
||||
new file mode 100644
|
||||
index 0000000..10a8a9f
|
||||
--- /dev/null
|
||||
+++ b/file0
|
||||
@@ -0,0 +1,9 @@
|
||||
+1
|
||||
+2
|
||||
+3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
@@ -6,6 +6,7 @@
|
||||
test_description='git apply -p handling.'
|
||||
|
||||
. ./test-lib.sh
|
||||
. "$TEST_DIRECTORY"/lib-prereq-FILEMODE.sh
|
||||
|
||||
test_expect_success setup '
|
||||
mkdir sub &&
|
||||
@@ -62,8 +63,12 @@ test_expect_success 'apply (-p2) diff, mode change only' '
|
||||
old mode 100644
|
||||
new mode 100755
|
||||
EOF
|
||||
chmod 644 file1 &&
|
||||
git apply -p2 patch.chmod &&
|
||||
test_chmod -x file1 &&
|
||||
git apply --index -p2 patch.chmod &&
|
||||
case $(git ls-files -s file1) in 100755*) : good;; *) false;; esac
|
||||
'
|
||||
|
||||
test_expect_success FILEMODE 'file mode was changed' '
|
||||
test -x file1
|
||||
'
|
||||
|
||||
|
||||
@@ -238,6 +238,10 @@ test_expect_success 'ensure "status --cached --recursive" preserves the --cached
|
||||
) &&
|
||||
git submodule status --cached --recursive -- nested1 > ../actual
|
||||
) &&
|
||||
if test_have_prereq MINGW
|
||||
then
|
||||
dos2unix actual
|
||||
fi &&
|
||||
test_cmp expect actual
|
||||
'
|
||||
|
||||
|
||||
2
tag.c
2
tag.c
@@ -56,7 +56,7 @@ static unsigned long parse_tag_date(const char *buf, const char *tail)
|
||||
return strtoul(dateptr, NULL, 10);
|
||||
}
|
||||
|
||||
int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
|
||||
int parse_tag_buffer(struct tag *item, const void *data, unsigned long size)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
char type[20];
|
||||
|
||||
2
tag.h
2
tag.h
@@ -13,7 +13,7 @@ struct tag {
|
||||
};
|
||||
|
||||
extern struct tag *lookup_tag(const unsigned char *sha1);
|
||||
extern int parse_tag_buffer(struct tag *item, void *data, unsigned long size);
|
||||
extern int parse_tag_buffer(struct tag *item, const void *data, unsigned long size);
|
||||
extern int parse_tag(struct tag *item);
|
||||
extern struct object *deref_tag(struct object *, const char *, int);
|
||||
extern size_t parse_signature(const char *buf, unsigned long size);
|
||||
|
||||
Reference in New Issue
Block a user