Skip to content

Commit

Permalink
Merge branch 'maint'
Browse files Browse the repository at this point in the history
* maint:
  Prepare draft release notes to 1.7.4.2
  gitweb: highlight: replace tabs with spaces
  make_absolute_path: return the input path if it points to our buffer
  valgrind: ignore SSE-based strlen invalid reads
  diff --submodule: split into bite-sized pieces
  cherry: split off function to print output lines
  branch: split off function that writes tracking info and commit subject
  standardize brace placement in struct definitions
  compat: make gcc bswap an inline function
  enums: omit trailing comma for portability

Conflicts:
	RelNotes
  • Loading branch information
Junio C Hamano committed Mar 16, 2011
2 parents 0631623 + fbcda3c commit b2f6eab
Show file tree
Hide file tree
Showing 27 changed files with 215 additions and 178 deletions.
42 changes: 42 additions & 0 deletions Documentation/RelNotes/1.7.4.2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
Git v1.7.4.2 Release Notes
==========================

Fixes since v1.7.4.1
--------------------

* Many documentation updates to match "git cmd -h" output and the
git-cmd manual page.

* "git clone /no/such/path" did not fail correctly.

* "git commit" did not correctly error out when the user asked to use a
non existent file as the commit message template.

* "git diff --stat -B" ran on binary files counted the changes in lines,
which was nonsensical.

* "git diff -M" opportunistically detected copies, which was not
necessarily a good thing, especially when it is internally run by
recursive merge.

* "git difftool" didn't tell (g)vimdiff that the files it is reading are
to be opened read-only.

* "git merge" didn't pay attention to prepare-commit-msg hook, even
though if a merge is conflicted and manually resolved, the subsequent
"git commit" would have triggered the hook, which was inconsistent.

* "git patch-id" (and commands like "format-patch --ignore-in-upstream"
that use it as their internal logic) handled changes to files that end
with incomplete lines incorrectly.

* The official value to tell "git push" to push the current branch back
to update the upstream branch it forked from is now called "upstream".
The old name "tracking" is and will be supported.

* gitweb's "highlight" interface mishandled tabs.

* gitweb had a few forward-incompatible syntactic constructs and
also used incorrect variable when showing the file mode in a diff.

And other minor fixes and documentation updates.
4 changes: 4 additions & 0 deletions abspath.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ const char *make_absolute_path(const char *path)
char *last_elem = NULL;
struct stat st;

/* We've already done it */
if (path == buf || path == next_buf)
return path;

if (strlcpy(buf, path, PATH_MAX) >= PATH_MAX)
die ("Too long path: %.*s", 60, path);

Expand Down
3 changes: 1 addition & 2 deletions builtin/add.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ static const char * const builtin_add_usage[] = {
static int patch_interactive, add_interactive, edit_interactive;
static int take_worktree_changes;

struct update_callback_data
{
struct update_callback_data {
int flags;
int add_errors;
};
Expand Down
3 changes: 1 addition & 2 deletions builtin/blame.c
Original file line number Diff line number Diff line change
Expand Up @@ -1312,8 +1312,7 @@ static void pass_blame(struct scoreboard *sb, struct origin *origin, int opt)
/*
* Information on commits, used for output.
*/
struct commit_info
{
struct commit_info {
const char *author;
const char *author_mail;
unsigned long author_time;
Expand Down
48 changes: 27 additions & 21 deletions builtin/branch.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,30 @@ static int matches_merge_filter(struct commit *commit)
return (is_merged == (merge_filter == SHOW_MERGED));
}

static void add_verbose_info(struct strbuf *out, struct ref_item *item,
int verbose, int abbrev)
{
struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
const char *sub = " **** invalid ref ****";
struct commit *commit = item->commit;

if (commit && !parse_commit(commit)) {
struct pretty_print_context ctx = {0};
pretty_print_commit(CMIT_FMT_ONELINE, commit,
&subject, &ctx);
sub = subject.buf;
}

if (item->kind == REF_LOCAL_BRANCH)
fill_tracking_info(&stat, item->name, verbose > 1);

strbuf_addf(out, " %s %s%s",
find_unique_abbrev(item->commit->object.sha1, abbrev),
stat.buf, sub);
strbuf_release(&stat);
strbuf_release(&subject);
}

static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,
int abbrev, int current, char *prefix)
{
Expand Down Expand Up @@ -430,27 +454,9 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,

if (item->dest)
strbuf_addf(&out, " -> %s", item->dest);
else if (verbose) {
struct strbuf subject = STRBUF_INIT, stat = STRBUF_INIT;
const char *sub = " **** invalid ref ****";

commit = item->commit;
if (commit && !parse_commit(commit)) {
struct pretty_print_context ctx = {0};
pretty_print_commit(CMIT_FMT_ONELINE, commit,
&subject, &ctx);
sub = subject.buf;
}

if (item->kind == REF_LOCAL_BRANCH)
fill_tracking_info(&stat, item->name, verbose > 1);

strbuf_addf(&out, " %s %s%s",
find_unique_abbrev(item->commit->object.sha1, abbrev),
stat.buf, sub);
strbuf_release(&stat);
strbuf_release(&subject);
}
else if (verbose)
/* " f7c0c00 [ahead 58, behind 197] vcs-svn: drop obj_pool.h" */
add_verbose_info(&out, item, verbose, abbrev);
printf("%s\n", out.buf);
strbuf_release(&name);
strbuf_release(&out);
Expand Down
3 changes: 1 addition & 2 deletions builtin/grep.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ enum work_type {WORK_SHA1, WORK_FILE};
* threads. The producer adds struct work_items to 'todo' and the
* consumers pick work items from the same array.
*/
struct work_item
{
struct work_item {
enum work_type type;
char *name;

Expand Down
6 changes: 2 additions & 4 deletions builtin/index-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [ --keep | --keep=<msg> ] [--strict] (<pack-file> | --stdin [--fix-thin] [<pack-file>])";

struct object_entry
{
struct object_entry {
struct pack_idx_entry idx;
unsigned long size;
unsigned int hdr_size;
Expand Down Expand Up @@ -44,8 +43,7 @@ struct base_data {
#define FLAG_LINK (1u<<20)
#define FLAG_CHECKED (1u<<21)

struct delta_entry
{
struct delta_entry {
union delta_base base;
int obj_no;
};
Expand Down
34 changes: 18 additions & 16 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,23 @@ static const char * const cherry_usage[] = {
NULL
};

static void print_commit(char sign, struct commit *commit, int verbose,
int abbrev)
{
if (!verbose) {
printf("%c %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev));
} else {
struct strbuf buf = STRBUF_INIT;
struct pretty_print_context ctx = {0};
pretty_print_commit(CMIT_FMT_ONELINE, commit, &buf, &ctx);
printf("%c %s %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev),
buf.buf);
strbuf_release(&buf);
}
}

int cmd_cherry(int argc, const char **argv, const char *prefix)
{
struct rev_info revs;
Expand Down Expand Up @@ -1436,22 +1453,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
commit = list->item;
if (has_commit_patch_id(commit, &ids))
sign = '-';

if (verbose) {
struct strbuf buf = STRBUF_INIT;
struct pretty_print_context ctx = {0};
pretty_print_commit(CMIT_FMT_ONELINE, commit,
&buf, &ctx);
printf("%c %s %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev),
buf.buf);
strbuf_release(&buf);
}
else {
printf("%c %s\n", sign,
find_unique_abbrev(commit->object.sha1, abbrev));
}

print_commit(sign, commit, verbose, abbrev);
list = list->next;
}

Expand Down
2 changes: 1 addition & 1 deletion cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ extern enum safe_crlf safe_crlf;
enum auto_crlf {
AUTO_CRLF_FALSE = 0,
AUTO_CRLF_TRUE = 1,
AUTO_CRLF_INPUT = -1,
AUTO_CRLF_INPUT = -1
};

extern enum auto_crlf auto_crlf;
Expand Down
3 changes: 1 addition & 2 deletions commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ enum cmit_fmt {
CMIT_FMT_UNSPECIFIED
};

struct pretty_print_context
{
struct pretty_print_context {
int abbrev;
const char *subject;
const char *after_subject;
Expand Down
18 changes: 10 additions & 8 deletions compat/bswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@ static inline uint32_t default_swab32(uint32_t val)

#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))

#define bswap32(x) ({ \
uint32_t __res; \
if (__builtin_constant_p(x)) { \
__res = default_swab32(x); \
} else { \
__asm__("bswap %0" : "=r" (__res) : "0" ((uint32_t)(x))); \
} \
__res; })
#define bswap32 git_bswap32
static inline uint32_t git_bswap32(uint32_t x)
{
uint32_t result;
if (__builtin_constant_p(x))
result = default_swab32(x);
else
__asm__("bswap %0" : "=r" (result) : "0" (x));
return result;
}

#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))

Expand Down
3 changes: 1 addition & 2 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ static int zlib_compression_seen;

const char *config_exclusive_filename = NULL;

struct config_item
{
struct config_item {
struct config_item *next;
char *name;
char *value;
Expand Down
2 changes: 1 addition & 1 deletion convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum action {
CRLF_TEXT,
CRLF_INPUT,
CRLF_CRLF,
CRLF_AUTO,
CRLF_AUTO
};

struct text_stat {
Expand Down
6 changes: 2 additions & 4 deletions diff.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,16 +615,14 @@ static void diff_words_append(char *line, unsigned long len,
buffer->text.ptr[buffer->text.size] = '\0';
}

struct diff_words_style_elem
{
struct diff_words_style_elem {
const char *prefix;
const char *suffix;
const char *color; /* NULL; filled in by the setup code if
* color is enabled */
};

struct diff_words_style
{
struct diff_words_style {
enum diff_words_type type;
struct diff_words_style_elem new, old, ctx;
const char *newline;
Expand Down
Loading

0 comments on commit b2f6eab

Please sign in to comment.